+ if (haveProfile) {
+ mainModel.scheduleAccountListReload();
+ Logger.debug("transactions", "requesting list reload");
+ mainModel.scheduleTransactionListReload();
+
+ if (profile.isPostingPermitted()) {
+ mToolbar.setSubtitle(null);
+ fab.show();
+ }
+ else {
+ mToolbar.setSubtitle(R.string.profile_subtitle_read_only);
+ fab.hide();
+ }
+ }
+ else {
+ mToolbar.setSubtitle(null);
+ fab.hide();
+ }
+
+ updateLastUpdateTextFromDB();
+ }
+ private void profileThemeChanged() {
+ storeThemeIdInPrefs(profile.getThemeHue());
+
+ // un-hook all observed LiveData
+ Data.removeProfileObservers(this);
+ Data.profiles.removeObservers(this);
+ Data.lastUpdateTransactionCount.removeObservers(this);
+ Data.lastUpdateAccountCount.removeObservers(this);
+ Data.lastUpdateDate.removeObservers(this);
+
+ recreate();
+ }
+ private void storeThemeIdInPrefs(int themeId) {
+ // store the new theme id in the preferences
+ SharedPreferences prefs = getPreferences(MODE_PRIVATE);
+ SharedPreferences.Editor e = prefs.edit();
+ e.putInt(PREF_THEME_ID, themeId);
+ e.apply();
+ }
+ public void startEditProfileActivity(MobileLedgerProfile profile) {
+ Intent intent = new Intent(this, ProfileDetailActivity.class);
+ Bundle args = new Bundle();
+ if (profile != null) {
+ int index = Data.getProfileIndex(profile);
+ if (index != -1)
+ intent.putExtra(ProfileDetailFragment.ARG_ITEM_ID, index);
+ }
+ intent.putExtras(args);
+ startActivity(intent, args);