]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java
notify profile list adapter when the currently selected profile changes
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / MainActivity.java
index 86463aac20c22bc34d7f50ec4cec5fc00ee74541..f61ebb0ed30124b3daeffd2410e47f1d4f9b8865 100644 (file)
@@ -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,