fix status bar background when switching profiles (and themes)
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 20 May 2020 19:31:16 +0000 (22:31 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 20 May 2020 19:39:41 +0000 (22:39 +0300)
it appears that if there is a theme defined in the app manifest, the
status bar takes its background from there when the activity is
recreate()'d after a profile/theme change

however, this needs that the theme is set up before the AppCompatActivity's
onCreate() is called

app/src/main/AndroidManifest.xml
app/src/main/java/net/ktnx/mobileledger/ui/activity/ProfileThemedActivity.java

index c7e09ef..c0ec905 100644 (file)
@@ -29,7 +29,6 @@
         android:roundIcon="@mipmap/app_icon"
         android:supportsRtl="true"
         android:networkSecurityConfig="@xml/network_security_config"
-        android:theme="@style/AppTheme"
         tools:ignore="GoogleAppIndexingWarning">
         <activity
             android:name=".ui.activity.MainActivity"
index 77a9272..6d2fff0 100644 (file)
@@ -40,9 +40,9 @@ public class ProfileThemedActivity extends CrashReportingActivity {
     }
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         initProfile();
+        setupProfileColors();
         super.onCreate(savedInstanceState);
 
-        setupProfileColors();
 
         Data.profile.observe(this, mobileLedgerProfile -> {
             mProfile = mobileLedgerProfile;