X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Faccount_summary%2FAccountSummaryViewModel.java;h=446df6a5cef700da2edb1108768841998a754ef9;hp=ce5f68e2c712acc13f2c24048a3e46a3d8d05686;hb=11c8dff16901782f69287854cb4788ddf8d932c2;hpb=3c1d8e6f4dd22c693ec79dfdb50b5b2f0a915014 diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryViewModel.java b/app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryViewModel.java index ce5f68e2..446df6a5 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryViewModel.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryViewModel.java @@ -22,7 +22,6 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.Typeface; import android.os.Build; -import android.preference.PreferenceManager; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.util.Log; @@ -42,24 +41,18 @@ import net.ktnx.mobileledger.model.LedgerAccount; import java.util.ArrayList; -import static net.ktnx.mobileledger.ui.activity.SettingsActivity.PREF_KEY_SHOW_ONLY_STARRED_ACCOUNTS; - class AccountSummaryViewModel extends ViewModel { - void scheduleAccountListReload(Context context) { - boolean showingOnlyStarred = PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(PREF_KEY_SHOW_ONLY_STARRED_ACCOUNTS, false); - - UAT task = new UAT(); - task.execute(showingOnlyStarred); - - } static void commitSelections(Context context) { - boolean showingOnlyStarred = PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(PREF_KEY_SHOW_ONLY_STARRED_ACCOUNTS, false); CAT task = new CAT(); - //noinspection unchecked - task.execute(new CommitAccountsTaskParams(Data.accounts.get(), showingOnlyStarred)); + task.execute( + new CommitAccountsTaskParams(Data.accounts.get(), Data.optShowOnlyStarred.get())); } + void scheduleAccountListReload() { + UAT task = new UAT(); + task.execute(); + + } + private static class UAT extends UpdateAccountsTask { @Override protected void onPostExecute(ArrayList list) { @@ -70,6 +63,7 @@ class AccountSummaryViewModel extends ViewModel { } } } + private static class CAT extends CommitAccountsTask { @Override protected void onPostExecute(ArrayList list) { @@ -111,8 +105,8 @@ class AccountSummaryAdapter extends RecyclerView.Adapter= Build.VERSION_CODES.M) holder.row - .setBackgroundColor(rm.getColor(R.color.table_row_even_bg, ctx.getTheme())); - else holder.row.setBackgroundColor(rm.getColor(R.color.table_row_even_bg)); + .setBackgroundColor(rm.getColor(R.color.table_row_dark_bg, ctx.getTheme())); + else holder.row.setBackgroundColor(rm.getColor(R.color.table_row_dark_bg)); } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) holder.row @@ -156,15 +150,17 @@ class AccountSummaryAdapter extends RecyclerView.Adapter