mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-04 20:30:36 +00:00
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:
parent
0fb33744ae
commit
9958f73926
2 changed files with 9 additions and 15 deletions
|
@ -19,15 +19,13 @@
|
||||||
tools:replace="android:theme">
|
tools:replace="android:theme">
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.SelectEntriesActivity"
|
android:name=".ui.SelectEntriesActivity"
|
||||||
android:label="Select entries"
|
android:label="Select entries" />
|
||||||
android:theme="@style/AppTheme.TransparentActionBar"></activity>
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.MainActivity"
|
android:name=".ui.MainActivity"
|
||||||
android:label="${title}"
|
android:label="${title}"
|
||||||
android:launchMode="singleTask">
|
android:launchMode="singleTask">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
@ -35,12 +33,10 @@
|
||||||
android:name=".ui.ScannerActivity"
|
android:name=".ui.ScannerActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="Scan a QR code"
|
android:label="Scan a QR code"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait" />
|
||||||
android:theme="@style/AppTheme.Fullscreen" />
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.EditEntryActivity"
|
android:name=".ui.EditEntryActivity"
|
||||||
android:label="Edit profile"
|
android:label="Edit profile" />
|
||||||
android:theme="@style/AppTheme.NoActionBar" />
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.IntroActivity"
|
android:name=".ui.IntroActivity"
|
||||||
android:theme="@style/Theme.Intro" />
|
android:theme="@style/Theme.Intro" />
|
||||||
|
@ -48,12 +44,10 @@
|
||||||
<activity android:name=".ui.PreferencesActivity" />
|
<activity android:name=".ui.PreferencesActivity" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.SlotManagerActivity"
|
android:name=".ui.SlotManagerActivity"
|
||||||
android:label="Manage key slots"
|
android:label="Manage key slots" />
|
||||||
android:theme="@style/AppTheme.TransparentActionBar" />
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.GroupManagerActivity"
|
android:name=".ui.GroupManagerActivity"
|
||||||
android:label="Manage groups"
|
android:label="Manage groups" />
|
||||||
android:theme="@style/AppTheme.TransparentActionBar" />
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
|
@ -20,9 +20,12 @@ public abstract class AegisActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
_app = (AegisApplication) getApplication();
|
_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 the app was killed, relaunch MainActivity and close everything else
|
||||||
if (!(this instanceof MainActivity) && !(this instanceof AuthActivity) && _app.getDatabaseManager().isLocked()) {
|
if (!(this instanceof MainActivity) && !(this instanceof AuthActivity) && _app.getDatabaseManager().isLocked()) {
|
||||||
Intent intent = new Intent(this, MainActivity.class);
|
Intent intent = new Intent(this, MainActivity.class);
|
||||||
|
@ -37,9 +40,6 @@ public abstract class AegisActivity extends AppCompatActivity {
|
||||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
|
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
|
// apply a dirty hack to make progress bars work even if animations are disabled
|
||||||
setGlobalAnimationDurationScale();
|
setGlobalAnimationDurationScale();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue