(unsuccessful) attempt to avoid black flicker when switching profiles
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 9 Sep 2021 19:56:46 +0000 (22:56 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 9 Sep 2021 19:56:46 +0000 (22:56 +0300)
app/src/main/java/net/ktnx/mobileledger/ui/activity/ProfileThemedActivity.java

index dcc83460cf1f391629adede89dc81d4a257e2336..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,10 @@ 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));
@@ -111,6 +114,7 @@ public class ProfileThemedActivity extends CrashReportingActivity {
         BaseDAO.runAsync(() -> initProfileSync(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);