X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Factivity%2FMainActivity.java;h=f61ebb0ed30124b3daeffd2410e47f1d4f9b8865;hp=dcf653fd4fc761ada654ba852181f5b9d8308d29;hb=d28e54c3e91f3a65e8b4571dc94fe90e953d4c7a;hpb=20aa0282e0bee8ba789de85bfe7a2184c3342e79 diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java index dcf653fd..f61ebb0e 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java @@ -169,6 +169,20 @@ public class MainActivity extends ProfileThemedActivity { fab.hide(); } + int old_index = -1; + int new_index = -1; + if (arg != null) { + MobileLedgerProfile old = (MobileLedgerProfile) arg; + old_index = Data.getProfileIndex(old); + new_index = Data.getProfileIndex(profile); + } + + if ((old_index != -1) && (new_index != -1)) { + mProfileListAdapter.notifyItemChanged(old_index); + mProfileListAdapter.notifyItemChanged(new_index); + } + else mProfileListAdapter.notifyDataSetChanged(); + int newProfileTheme = profile.getThemeId(); if (newProfileTheme != Colors.profileThemeId) { Log.d("profiles", String.format("profile theme %d → %d", Colors.profileThemeId, @@ -298,15 +312,17 @@ public class MainActivity extends ProfileThemedActivity { }); } private void updateLastUpdateDisplay() { + LinearLayout l = findViewById(R.id.transactions_last_update_layout); TextView v = findViewById(R.id.transactions_last_update); Date date = Data.lastUpdateDate.get(); if (date == null) { - v.setText(R.string.transaction_last_update_never); + l.setVisibility(View.INVISIBLE); Log.d("main", "no last update date :("); } else { final String text = DateFormat.getDateTimeInstance().format(date); v.setText(text); + l.setVisibility(View.VISIBLE); Log.d("main", String.format("Date formatted: %s", text)); } }