Set the Activity theme before calling super.onCreate (#84)

This fixes a NullPointerException that would occur when restoring from
savedInstanceState due to getSupportActionBar returning null. It also removes
the theme definitions from AndroidManifest as we override those anyway.
This commit is contained in:
Alexander Bakker 2019-05-15 22:01:00 +02:00 committed by Michael Schättgen
parent 0fb33744ae
commit 9958f73926
2 changed files with 9 additions and 15 deletions

View file

@ -20,9 +20,12 @@ public abstract class AegisActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
_app = (AegisApplication) getApplication();
// set the theme and create the activity
setPreferredTheme(Theme.fromInteger(getPreferences().getCurrentTheme()));
super.onCreate(savedInstanceState);
// if the app was killed, relaunch MainActivity and close everything else
if (!(this instanceof MainActivity) && !(this instanceof AuthActivity) && _app.getDatabaseManager().isLocked()) {
Intent intent = new Intent(this, MainActivity.class);
@ -37,9 +40,6 @@ public abstract class AegisActivity extends AppCompatActivity {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
}
// set the theme
setPreferredTheme(getPreferences().getCurrentTheme());
// apply a dirty hack to make progress bars work even if animations are disabled
setGlobalAnimationDurationScale();
}