|
|
|
@ -72,17 +72,20 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
|
|
|
|
this.contacts = hasPermission(Manifest.permission.READ_CONTACTS);
|
|
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
|
|
|
|
String theme = prefs.getString("theme", null);
|
|
|
|
|
if ("system".equals(theme)) {
|
|
|
|
|
int uiMode = getResources().getConfiguration().uiMode;
|
|
|
|
|
Log.i("UI mode=" + uiMode);
|
|
|
|
|
if ((uiMode & Configuration.UI_MODE_NIGHT_YES) != 0)
|
|
|
|
|
|
|
|
|
|
if (!this.getClass().equals(ActivityMain.class)) {
|
|
|
|
|
String theme = prefs.getString("theme", null);
|
|
|
|
|
if ("system".equals(theme)) {
|
|
|
|
|
int uiMode = getResources().getConfiguration().uiMode;
|
|
|
|
|
Log.i("UI mode=" + uiMode);
|
|
|
|
|
if ((uiMode & Configuration.UI_MODE_NIGHT_YES) != 0)
|
|
|
|
|
setTheme(R.style.AppThemeBlack);
|
|
|
|
|
}
|
|
|
|
|
if ("dark".equals(theme))
|
|
|
|
|
setTheme(R.style.AppThemeDark);
|
|
|
|
|
else if ("black".equals(theme))
|
|
|
|
|
setTheme(R.style.AppThemeBlack);
|
|
|
|
|
}
|
|
|
|
|
if ("dark".equals(theme))
|
|
|
|
|
setTheme(R.style.AppThemeDark);
|
|
|
|
|
else if ("black".equals(theme))
|
|
|
|
|
setTheme(R.style.AppThemeBlack);
|
|
|
|
|
|
|
|
|
|
prefs.registerOnSharedPreferenceChangeListener(this);
|
|
|
|
|
|
|
|
|
|