Optimize getting theme ID

This commit is contained in:
M66B
2022-05-01 16:30:40 +02:00
parent 5909df693c
commit debf05db0f
3 changed files with 21 additions and 8 deletions

View File

@@ -71,6 +71,7 @@ import java.util.List;
import java.util.Map;
abstract class ActivityBase extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
private int themeId;
private Context originalContext;
private boolean visible;
private boolean contacts;
@@ -107,7 +108,8 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
if (!this.getClass().equals(ActivityMain.class)) {
setTheme(FragmentDialogTheme.getTheme(this));
themeId = FragmentDialogTheme.getTheme(this);
setTheme(themeId);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
boolean dark = Helper.isDarkTheme(this);
@@ -379,6 +381,10 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
}
}
public int getThemeId() {
return this.themeId;
}
public String getRequestKey() {
return this.getClass().getName() + ":activity";
}