X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Factivity%2FMainActivity.java;h=ad5da965d49ed5f11f059eb6eddd309f8c7c9c28;hp=a96a0b976d6939a7fbfb8ab5898176afe720729c;hb=3c3ae0a0335f908a43efbfca7ac18e5bbee3ea7c;hpb=7fc390cba426710880297bc6790736338f355909 diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java index a96a0b97..ad5da965 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java @@ -106,6 +106,14 @@ public class MainActivity extends CrashReportingActivity { 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; + } }); }); @@ -181,6 +189,14 @@ public class MainActivity extends CrashReportingActivity { 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();