mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Fix activity theme setting
This commit is contained in:
@@ -302,23 +302,15 @@ public class ThemeManager {
|
||||
switch (theme) {
|
||||
case WHITE:
|
||||
mBackgroundColor = mResources.getColor(R.color.white_pure);
|
||||
if (mContext != null) mContext.setTheme(mContext instanceof MainActivity ?
|
||||
R.style.AppThemeWhite : R.style.AppThemeWhiteDialog);
|
||||
break;
|
||||
case OFFWHITE:
|
||||
mBackgroundColor = mResources.getColor(R.color.grey_light_mega_ultra);
|
||||
if (mContext != null) mContext.setTheme(mContext instanceof MainActivity ?
|
||||
R.style.AppThemeLight : R.style.AppThemeLightDialog);
|
||||
break;
|
||||
case GREY:
|
||||
mBackgroundColor = mResources.getColor(R.color.grey_material);
|
||||
if (mContext != null) mContext.setTheme(mContext instanceof MainActivity ?
|
||||
R.style.AppThemeDark : R.style.AppThemeDarkDialog);
|
||||
break;
|
||||
case BLACK:
|
||||
mBackgroundColor = mResources.getColor(R.color.black);
|
||||
if (mContext != null) mContext.setTheme(mContext instanceof MainActivity ?
|
||||
R.style.AppThemeDarkAmoled : R.style.AppThemeDarkAmoledDialog);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ public abstract class QKActivity extends AppCompatActivity {
|
||||
});
|
||||
|
||||
LiveViewManager.registerView(QKPreference.BACKGROUND, this, key -> {
|
||||
setTheme(getThemeRes());
|
||||
switch (ThemeManager.getTheme()) {
|
||||
case WHITE:
|
||||
case OFFWHITE:
|
||||
@@ -260,6 +261,24 @@ public abstract class QKActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
protected int getThemeRes() {
|
||||
switch (ThemeManager.getTheme()) {
|
||||
case WHITE:
|
||||
return R.style.AppThemeWhite;
|
||||
|
||||
case OFFWHITE:
|
||||
return R.style.AppThemeLight;
|
||||
|
||||
case GREY:
|
||||
return R.style.AppThemeDark;
|
||||
|
||||
case BLACK:
|
||||
return R.style.AppThemeDarkAmoled;
|
||||
}
|
||||
|
||||
return R.style.AppThemeLight;
|
||||
}
|
||||
|
||||
public void makeToast(@StringRes int message) {
|
||||
Toast.makeText(this, message, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
@@ -38,5 +38,24 @@ public abstract class QKPopupActivity extends QKActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getThemeRes() {
|
||||
switch (ThemeManager.getTheme()) {
|
||||
case WHITE:
|
||||
return R.style.AppThemeWhiteDialog;
|
||||
|
||||
case OFFWHITE:
|
||||
return R.style.AppThemeLightDialog;
|
||||
|
||||
case GREY:
|
||||
return R.style.AppThemeDarkDialog;
|
||||
|
||||
case BLACK:
|
||||
return R.style.AppThemeDarkAmoledDialog;
|
||||
}
|
||||
|
||||
return R.style.AppThemeLightDialog;
|
||||
}
|
||||
|
||||
protected abstract int getLayoutResource();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user