- public void onViewClicked(View view) {
- switch (view.getId()) {
- case R.id.clearAccountNameFilter:
- if (transactionListFragment != null)
- transactionListFragment.onClearAccountNameClick(view);
- break;
- default:
- Log.e("click", String.format("View %d click not handled", view.getId()));
+ private void profileThemeChanged() {
+ storeThemeIdInPrefs(profile.getThemeHue());
+
+ // un-hook all observed LiveData
+ Data.removeProfileObservers(this);
+ Data.profiles.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);
+ }
+ private void setupProfile() {
+ MLDB.getOption(MLDB.OPT_PROFILE_UUID, null, new GetOptCallback() {
+ @Override
+ protected void onResult(String profileUUID) {
+ MobileLedgerProfile startupProfile;
+
+ startupProfile = Data.getProfile(profileUUID);
+ Data.setCurrentProfile(startupProfile);
+ }
+ });
+ }
+ public void fabNewTransactionClicked(View view) {
+ Intent intent = new Intent(this, NewTransactionActivity.class);
+ startActivity(intent);
+ overridePendingTransition(R.anim.slide_in_up, R.anim.dummy);
+ }
+ public void markDrawerItemCurrent(int id) {
+ TextView item = drawer.findViewById(id);
+ item.setBackgroundColor(Colors.tableRowDarkBG);
+
+ LinearLayout actions = drawer.findViewById(R.id.nav_actions);
+ for (int i = 0; i < actions.getChildCount(); i++) {
+ View view = actions.getChildAt(i);
+ if (view.getId() != id) {
+ view.setBackgroundColor(Color.TRANSPARENT);
+ }