From 3f04ed64280e24cc39aad42f7142974d12701e3b Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Fri, 3 May 2019 18:21:25 +0300 Subject: [PATCH] avoid duplicate theme setup upon startup and profile+theme change --- .../ktnx/mobileledger/ui/activity/MainActivity.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 e6309036..ec8c6fbe 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 @@ -139,12 +139,15 @@ public class MainActivity extends ProfileThemedActivity { super.onDestroy(); } @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - debug("flow", "MainActivity.onCreate()"); + protected void setupProfileColors() { int profileColor = Data.retrieveCurrentThemeIdFromDb(); Colors.setupTheme(this, profileColor); Colors.profileThemeId = profileColor; + } + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + debug("flow", "MainActivity.onCreate()"); setContentView(R.layout.activity_main); fab = findViewById(R.id.btn_add_transaction); @@ -421,8 +424,6 @@ public class MainActivity extends ProfileThemedActivity { scheduleDataRetrievalIfStale(newValue); } private void profileThemeChanged() { - setupProfileColors(); - Bundle bundle = new Bundle(); onSaveInstanceState(bundle); // restart activity to reflect theme change -- 2.39.5