Fix two minor issues in themes

- Neatly map configured themes to styles
- Make the dark NoActionBar themes inherit from Dark/AMOLED
This commit is contained in:
Alexander Bakker 2020-07-11 18:42:44 +02:00
parent 0eb9a25687
commit 2aa88a2921
7 changed files with 59 additions and 65 deletions

View file

@ -2,7 +2,6 @@ package com.beemdevelopment.aegis.ui;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.view.KeyEvent;
@ -26,7 +25,7 @@ import com.beemdevelopment.aegis.AegisApplication;
import com.beemdevelopment.aegis.CancelAction;
import com.beemdevelopment.aegis.Preferences;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.Theme;
import com.beemdevelopment.aegis.ThemeMap;
import com.beemdevelopment.aegis.crypto.KeyStoreHandle;
import com.beemdevelopment.aegis.crypto.KeyStoreHandleException;
import com.beemdevelopment.aegis.crypto.MasterKey;
@ -159,31 +158,8 @@ public class AuthActivity extends AegisActivity {
}
@Override
protected void setPreferredTheme(Theme theme) {
if (theme == Theme.SYSTEM || theme == Theme.SYSTEM_AMOLED) {
// set the theme based on the system theme
int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
switch (currentNightMode) {
case Configuration.UI_MODE_NIGHT_NO:
theme = Theme.LIGHT;
break;
case Configuration.UI_MODE_NIGHT_YES:
theme = theme == Theme.SYSTEM_AMOLED ? Theme.AMOLED : Theme.DARK;
break;
}
}
switch (theme) {
case LIGHT:
setTheme(R.style.AppTheme_Light_NoActionBar);
break;
case DARK:
setTheme(R.style.AppTheme_Dark_NoActionBar);
break;
case AMOLED:
setTheme(R.style.AppTheme_TrueBlack_NoActionBar);
break;
}
protected void onSetTheme() {
setTheme(ThemeMap.NO_ACTION_BAR);
}
private void selectPassword() {