+ mProfileListAdapter.notifyDataSetChanged();
+
+ if (haveProfile) {
+ if (newProfile.permitPosting()) {
+ b.toolbar.setSubtitle(null);
+ b.btnAddTransaction.show();
+ }
+ else {
+ b.toolbar.setSubtitle(R.string.profile_subtitle_read_only);
+ b.btnAddTransaction.hide();
+ }
+ }
+ else {
+ b.toolbar.setSubtitle(null);
+ b.btnAddTransaction.hide();
+ }
+
+ updateLastUpdateTextFromDB();
+
+ if (sameProfileId) {
+ Logger.debug(TAG, String.format(Locale.ROOT, "Short-cut profile 'changed' to %d",
+ newProfile.getId()));
+ return;
+ }
+
+ mainModel.stopTransactionsRetrieval();
+
+ mainModel.clearTransactions();
+
+ if (haveProfile) {
+ Logger.debug("transactions", "requesting list reload");
+ mainModel.scheduleTransactionListReload();
+ }
+ }
+ private void profileThemeChanged() {
+ // un-hook all observed LiveData
+ Data.removeProfileObservers(this);
+ Data.profiles.removeObservers(this);
+ Data.lastUpdateTransactionCount.removeObservers(this);
+ Data.lastUpdateAccountCount.removeObservers(this);
+ Data.lastUpdateDate.removeObservers(this);
+
+ Logger.debug("MainActivity", "profileThemeChanged(): recreating activity");
+ recreate();