mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Remove holo theme
This commit is contained in:
@@ -89,7 +89,7 @@ public class FontManager {
|
||||
// Colors and font weight
|
||||
switch (type) {
|
||||
case FontManager.TEXT_TYPE_PRIMARY:
|
||||
boolean isNight = ThemeManager.getTheme() == ThemeManager.Theme.GREY ||
|
||||
boolean isNight = ThemeManager.getTheme() == ThemeManager.Theme.DARK ||
|
||||
ThemeManager.getTheme() == ThemeManager.Theme.BLACK;
|
||||
int id = isNight ? R.color.text_primary_dark : R.color.text_primary_light;
|
||||
return context.getResources().getColorStateList(id);
|
||||
|
||||
@@ -41,11 +41,11 @@ public class NightModeAutoReceiver extends BroadcastReceiver {
|
||||
(calendar.get(Calendar.HOUR_OF_DAY) == day.get(Calendar.HOUR_OF_DAY) && calendar.get(Calendar.MINUTE) <= day.get(Calendar.MINUTE))) {
|
||||
Log.i(TAG, "Switching to night mode");
|
||||
prefs.edit().putString(SettingsFragment.BACKGROUND, ThemeManager.Theme.PREF_GREY).apply();
|
||||
ThemeManager.setTheme(ThemeManager.Theme.GREY);
|
||||
ThemeManager.setTheme(ThemeManager.Theme.DARK);
|
||||
} else {
|
||||
Log.i(TAG, "Switching to day mode");
|
||||
prefs.edit().putString(SettingsFragment.BACKGROUND, ThemeManager.Theme.PREF_OFFWHITE).apply();
|
||||
ThemeManager.setTheme(ThemeManager.Theme.OFFWHITE);
|
||||
ThemeManager.setTheme(ThemeManager.Theme.LIGHT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,29 +39,25 @@ public class ThemeManager {
|
||||
public static final int TRANSITION_LENGTH = 500;
|
||||
|
||||
public enum Theme {
|
||||
WHITE,
|
||||
OFFWHITE,
|
||||
GREY,
|
||||
LIGHT,
|
||||
DARK,
|
||||
BLACK;
|
||||
|
||||
public static final String PREF_WHITE = "white";
|
||||
public static final String PREF_OFFWHITE = "offwhite";
|
||||
public static final String PREF_OFFWHITE = "light";
|
||||
public static final String PREF_GREY = "grey";
|
||||
public static final String PREF_BLACK = "black";
|
||||
|
||||
public static Theme fromString(String color) {
|
||||
switch (color) {
|
||||
case PREF_WHITE:
|
||||
return WHITE;
|
||||
case PREF_OFFWHITE:
|
||||
return OFFWHITE;
|
||||
return LIGHT;
|
||||
case PREF_GREY:
|
||||
return GREY;
|
||||
return DARK;
|
||||
case PREF_BLACK:
|
||||
return BLACK;
|
||||
default:
|
||||
Log.w(TAG, "Tried to set theme with invalid string: " + color);
|
||||
return OFFWHITE;
|
||||
return LIGHT;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -300,13 +296,10 @@ public class ThemeManager {
|
||||
mTheme = theme;
|
||||
|
||||
switch (theme) {
|
||||
case WHITE:
|
||||
mBackgroundColor = mResources.getColor(R.color.white_pure);
|
||||
break;
|
||||
case OFFWHITE:
|
||||
case LIGHT:
|
||||
mBackgroundColor = mResources.getColor(R.color.grey_light_mega_ultra);
|
||||
break;
|
||||
case GREY:
|
||||
case DARK:
|
||||
mBackgroundColor = mResources.getColor(R.color.grey_material);
|
||||
break;
|
||||
case BLACK:
|
||||
@@ -315,13 +308,12 @@ public class ThemeManager {
|
||||
}
|
||||
|
||||
switch (mTheme) {
|
||||
case WHITE:
|
||||
case OFFWHITE:
|
||||
case LIGHT:
|
||||
mTextOnBackgroundPrimary = mResources.getColor(R.color.theme_light_text_primary);
|
||||
mtextOnBackgroundSecondary = mResources.getColor(R.color.theme_light_text_secondary);
|
||||
mRippleBackground = mResources.getDrawable(R.drawable.button_background_transparent);
|
||||
break;
|
||||
case GREY:
|
||||
case DARK:
|
||||
case BLACK:
|
||||
mTextOnBackgroundPrimary = mResources.getColor(R.color.theme_dark_text_primary);
|
||||
mtextOnBackgroundSecondary = mResources.getColor(R.color.theme_dark_text_secondary);
|
||||
@@ -459,17 +451,14 @@ public class ThemeManager {
|
||||
}
|
||||
|
||||
switch (mTheme) {
|
||||
case WHITE:
|
||||
return mResources.getColor(R.color.grey_light_mega_ultra);
|
||||
|
||||
case OFFWHITE:
|
||||
return mResources.getColor(R.color.white_pure);
|
||||
|
||||
case GREY:
|
||||
case DARK:
|
||||
return mResources.getColor(R.color.grey_dark);
|
||||
|
||||
default:
|
||||
case BLACK:
|
||||
return mResources.getColor(R.color.grey_material);
|
||||
|
||||
default:
|
||||
return mResources.getColor(R.color.white_pure);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,7 +479,7 @@ public class ThemeManager {
|
||||
}
|
||||
|
||||
public static boolean isNightMode() {
|
||||
return mTheme == Theme.GREY || mTheme == Theme.BLACK;
|
||||
return mTheme == Theme.DARK || mTheme == Theme.BLACK;
|
||||
}
|
||||
|
||||
public static void showColorPickerDialog(final QKActivity context) {
|
||||
|
||||
@@ -101,12 +101,11 @@ public abstract class QKActivity extends AppCompatActivity {
|
||||
LiveViewManager.registerView(QKPreference.BACKGROUND, this, key -> {
|
||||
setTheme(getThemeRes());
|
||||
switch (ThemeManager.getTheme()) {
|
||||
case WHITE:
|
||||
case OFFWHITE:
|
||||
case LIGHT:
|
||||
mToolbar.setPopupTheme(R.style.PopupThemeLight);
|
||||
break;
|
||||
|
||||
case GREY:
|
||||
case DARK:
|
||||
case BLACK:
|
||||
mToolbar.setPopupTheme(R.style.PopupTheme);
|
||||
break;
|
||||
@@ -263,13 +262,7 @@ 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:
|
||||
case DARK:
|
||||
return R.style.AppThemeDark;
|
||||
|
||||
case BLACK:
|
||||
|
||||
@@ -41,13 +41,7 @@ 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:
|
||||
case DARK:
|
||||
return R.style.AppThemeDarkDialog;
|
||||
|
||||
case BLACK:
|
||||
|
||||
@@ -63,11 +63,11 @@ public class WelcomeNightFragment extends BaseWelcomeFragment implements BaseWel
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.welcome_night_hint) {
|
||||
boolean night = ThemeManager.getTheme() == ThemeManager.Theme.OFFWHITE;
|
||||
boolean night = ThemeManager.getTheme() == ThemeManager.Theme.LIGHT;
|
||||
|
||||
int backgroundColor = mContext.getResources().getColor(night ? R.color.grey_light_mega_ultra : R.color.grey_material);
|
||||
int newBackgroundColor = mContext.getResources().getColor(night ? R.color.grey_material : R.color.grey_light_mega_ultra);
|
||||
ThemeManager.setTheme(night ? ThemeManager.Theme.GREY : ThemeManager.Theme.OFFWHITE);
|
||||
ThemeManager.setTheme(night ? ThemeManager.Theme.DARK : ThemeManager.Theme.LIGHT);
|
||||
|
||||
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), backgroundColor, newBackgroundColor);
|
||||
colorAnimation.setDuration(ThemeManager.TRANSITION_LENGTH);
|
||||
|
||||
Reference in New Issue
Block a user