]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/ProfileThemedActivity.java
(unsuccessful) attempt to avoid black flicker when switching profiles
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / ProfileThemedActivity.java
index 1ffcbf8bf1965cd6a495603319907c331953c11c..b9726492844cfd959cb208ae6258a423fb1ebd52 100644 (file)
@@ -57,8 +57,11 @@ public class ProfileThemedActivity extends CrashReportingActivity {
         Colors.setupTheme(this, mThemeHue);
 
         if (themeSetUp) {
-            Logger.debug(TAG, "setupProfileColors(): theme already set up, recreating activity");
-            this.recreate();
+            Logger.debug(TAG,
+                    "setupProfileColors(): theme already set up, supposedly the activity will be " +
+                    "recreated");
+//            this.recreate();
+            return;
         }
         themeSetUp = true;
 
@@ -79,10 +82,13 @@ public class ProfileThemedActivity extends CrashReportingActivity {
             }
 
             mProfile = profile;
+            storeProfilePref(profile);
             int hue = profile.getTheme();
 
             if (hue != mThemeHue) {
-                storeProfilePref(profile);
+                Logger.debug(TAG,
+                        String.format(Locale.US, "profile observer calling setupProfileColors(%d)",
+                                hue));
                 setupProfileColors(hue);
             }
         });
@@ -98,6 +104,8 @@ public class ProfileThemedActivity extends CrashReportingActivity {
         if (profileId == -1)
             mThemeHue = Colors.DEFAULT_HUE_DEG;
 
+        Logger.debug(TAG,
+                String.format(Locale.US, "initProfile() calling setupProfileColors(%d)", hue));
         setupProfileColors(hue);
 
         initProfile(profileId);
@@ -105,7 +113,8 @@ public class ProfileThemedActivity extends CrashReportingActivity {
     protected void initProfile(long profileId) {
         BaseDAO.runAsync(() -> initProfileSync(profileId));
     }
-    private void initProfileAsync(long profileId) {
+    private void initProfileSync(long profileId) {
+        Logger.debug(TAG, String.format(Locale.US, "Loading profile %d", profileId));
         ProfileDAO dao = DB.get()
                            .getProfileDAO();
         Profile profile = dao.getByIdSync(profileId);