@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setSubtitle(R.string.profile_subitlte_read_only);
fab.hide();
}
+
+ int newProfileTheme = profile.getThemeId();
+ if (newProfileTheme != Colors.profileThemeId) {
+ Log.d("profiles", String.format("profile theme %d → %d", Colors.profileThemeId,
+ newProfileTheme));
+ profileThemeChanged();
+ Colors.profileThemeId = newProfileTheme;
+ }
});
});
findViewById(R.id.btn_add_transaction).setOnClickListener(this::fabNewTransactionClicked);
}
+ private void profileThemeChanged() {
+ setupProfileColors();
+
+ // restart activity to reflect theme change
+ finish();
+ Intent intent = new Intent(this, this.getClass());
+ startActivity(intent);
+ }
@Override
protected void onResume() {
super.onResume();
Intent intent = new Intent(this, ProfileListActivity.class);
startActivity(intent);
}
+ public void fabShouldShow() {
+ MobileLedgerProfile profile = Data.profile.get();
+ if ((profile != null) && profile.isPostingPermitted()) fab.show();
+ }
+
public class SectionsPagerAdapter extends FragmentPagerAdapter {
public SectionsPagerAdapter(FragmentManager fm) {
return 2;
}
}
- public void fabShouldShow() {
- MobileLedgerProfile profile = Data.profile.get();
- if ((profile != null) && profile.isPostingPermitted()) fab.show();
- }
}