Cherish:Cleanup old themes
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
@@ -13,34 +13,6 @@
|
|||||||
-->
|
-->
|
||||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
|
||||||
<!-- Themes -->
|
|
||||||
<string-array name="theme_type_titles">
|
|
||||||
<item>@string/theme_type_light</item>
|
|
||||||
<item>@string/theme_type_pitch_black</item>
|
|
||||||
<item>@string/theme_type_solarized_dark</item>
|
|
||||||
<item>@string/theme_type_baked_green</item>
|
|
||||||
<item>@string/theme_type_choco_x</item>
|
|
||||||
<item>@string/theme_type_du_pitchblack</item>
|
|
||||||
<item>@string/theme_type_dark_grey</item>
|
|
||||||
<item>@string/theme_type_material_ocean</item>
|
|
||||||
<item>@string/theme_type_clear_spring</item>
|
|
||||||
<item>@string/theme_type_dark_12</item>
|
|
||||||
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<string-array name="theme_type_values">
|
|
||||||
<item>1</item>
|
|
||||||
<item>2</item>
|
|
||||||
<item>3</item>
|
|
||||||
<item>4</item>
|
|
||||||
<item>5</item>
|
|
||||||
<item>6</item>
|
|
||||||
<item>7</item>
|
|
||||||
<item>8</item>
|
|
||||||
<item>9</item>
|
|
||||||
<item>10</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<!--- Volume key cursor control -->
|
<!--- Volume key cursor control -->
|
||||||
<string-array name="volume_key_cursor_control_entries">
|
<string-array name="volume_key_cursor_control_entries">
|
||||||
<item>@string/volume_key_cursor_control_off</item>
|
<item>@string/volume_key_cursor_control_off</item>
|
||||||
|
|||||||
@@ -89,16 +89,6 @@
|
|||||||
<!-- Themes -->
|
<!-- Themes -->
|
||||||
<string name="theme_type_title">System theme</string>
|
<string name="theme_type_title">System theme</string>
|
||||||
<string name="theme_type_summary">Select theme</string>
|
<string name="theme_type_summary">Select theme</string>
|
||||||
<string name="theme_type_light">Light</string>
|
|
||||||
<string name="theme_type_pitch_black">Google dark</string>
|
|
||||||
<string name="theme_type_solarized_dark">Solarized Dark</string>
|
|
||||||
<string name="theme_type_baked_green">Baked Green</string>
|
|
||||||
<string name="theme_type_choco_x">Choco X</string>
|
|
||||||
<string name="theme_type_dark_grey">Dark Grey</string>
|
|
||||||
<string name="theme_type_du_pitchblack">Pitch black</string>
|
|
||||||
<string name="theme_type_material_ocean">Material Ocean</string>
|
|
||||||
<string name="theme_type_clear_spring">Clear Spring</string>
|
|
||||||
<string name="theme_type_dark_12">Android 12 Dark</string>
|
|
||||||
|
|
||||||
<!--Accenter -->
|
<!--Accenter -->
|
||||||
<string name="themes_hub_title">Themes</string>
|
<string name="themes_hub_title">Themes</string>
|
||||||
|
|||||||
@@ -38,16 +38,6 @@
|
|||||||
android:defaultValue="0xffffff"
|
android:defaultValue="0xffffff"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
<ListPreference
|
|
||||||
android:key="theme_switch"
|
|
||||||
android:icon="@drawable/ic_system_theme"
|
|
||||||
android:title="@string/theme_type_title"
|
|
||||||
android:summary="%s"
|
|
||||||
android:dialogTitle="@string/theme_type_summary"
|
|
||||||
android:entries="@array/theme_type_titles"
|
|
||||||
android:entryValues="@array/theme_type_values"
|
|
||||||
android:defaultValue="1"/>
|
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="ui_style"
|
android:key="ui_style"
|
||||||
android:title="@string/ui_style_title"
|
android:title="@string/ui_style_title"
|
||||||
|
|||||||
@@ -190,7 +190,6 @@ public class ThemeSettings extends SettingsPreferenceFragment implements
|
|||||||
mOverlayService = IOverlayManager.Stub
|
mOverlayService = IOverlayManager.Stub
|
||||||
.asInterface(ServiceManager.getService(Context.OVERLAY_SERVICE));
|
.asInterface(ServiceManager.getService(Context.OVERLAY_SERVICE));
|
||||||
|
|
||||||
setupThemeSwitchPref();
|
|
||||||
setupAccentPref();
|
setupAccentPref();
|
||||||
setupGradientPref();
|
setupGradientPref();
|
||||||
setupNavbarSwitchPref();
|
setupNavbarSwitchPref();
|
||||||
@@ -227,118 +226,7 @@ public class ThemeSettings extends SettingsPreferenceFragment implements
|
|||||||
mOverlayService.reloadAssets("com.android.systemui", UserHandle.USER_CURRENT);
|
mOverlayService.reloadAssets("com.android.systemui", UserHandle.USER_CURRENT);
|
||||||
} catch (RemoteException ignored) {
|
} catch (RemoteException ignored) {
|
||||||
}
|
}
|
||||||
} else if (preference == mThemeSwitch) {
|
} else if (preference == mPanelBg) {
|
||||||
String theme_switch = (String) objValue;
|
|
||||||
final Context context = getContext();
|
|
||||||
switch (theme_switch) {
|
|
||||||
case "1":
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_NO, ThemesUtils.SOLARIZED_DARK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_NO, ThemesUtils.BAKED_GREEN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_NO, ThemesUtils.CHOCO_X);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_NO, ThemesUtils.PITCH_BLACK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_NO, ThemesUtils.DARK_GREY);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_NO, ThemesUtils.MATERIAL_OCEAN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_NO, ThemesUtils.CLEAR_SPRING);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_NO, ThemesUtils.DARK_12);
|
|
||||||
break;
|
|
||||||
case "2":
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.SOLARIZED_DARK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.BAKED_GREEN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CHOCO_X);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.PITCH_BLACK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_GREY);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.MATERIAL_OCEAN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CLEAR_SPRING);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_12);
|
|
||||||
break;
|
|
||||||
case "3":
|
|
||||||
handleBackgrounds(true, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.SOLARIZED_DARK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.BAKED_GREEN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CHOCO_X);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.PITCH_BLACK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_GREY);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.MATERIAL_OCEAN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CLEAR_SPRING);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_12);
|
|
||||||
break;
|
|
||||||
case "4":
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.SOLARIZED_DARK);
|
|
||||||
handleBackgrounds(true, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.BAKED_GREEN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CHOCO_X);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.PITCH_BLACK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_GREY);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.MATERIAL_OCEAN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CLEAR_SPRING);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_12);
|
|
||||||
break;
|
|
||||||
case "5":
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.SOLARIZED_DARK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.BAKED_GREEN);
|
|
||||||
handleBackgrounds(true, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CHOCO_X);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.PITCH_BLACK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_GREY);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.MATERIAL_OCEAN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CLEAR_SPRING);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_12);
|
|
||||||
break;
|
|
||||||
case "6":
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.SOLARIZED_DARK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.BAKED_GREEN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CHOCO_X);
|
|
||||||
handleBackgrounds(true, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.PITCH_BLACK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_GREY);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.MATERIAL_OCEAN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CLEAR_SPRING);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_12);
|
|
||||||
break;
|
|
||||||
case "7":
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.SOLARIZED_DARK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.BAKED_GREEN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CHOCO_X);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.PITCH_BLACK);
|
|
||||||
handleBackgrounds(true, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_GREY);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.MATERIAL_OCEAN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CLEAR_SPRING);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_12);
|
|
||||||
break;
|
|
||||||
case "8":
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.SOLARIZED_DARK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.BAKED_GREEN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CHOCO_X);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.PITCH_BLACK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_GREY);
|
|
||||||
handleBackgrounds(true, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.MATERIAL_OCEAN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CLEAR_SPRING);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_12);
|
|
||||||
break;
|
|
||||||
case "9":
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.SOLARIZED_DARK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.BAKED_GREEN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CHOCO_X);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.PITCH_BLACK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_GREY);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.MATERIAL_OCEAN);
|
|
||||||
handleBackgrounds(true, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CLEAR_SPRING);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_12);
|
|
||||||
break;
|
|
||||||
case "10":
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.SOLARIZED_DARK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.BAKED_GREEN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CHOCO_X);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.PITCH_BLACK);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_GREY);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.MATERIAL_OCEAN);
|
|
||||||
handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CLEAR_SPRING);
|
|
||||||
handleBackgrounds(true, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_12);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
mOverlayService.reloadAndroidAssets(UserHandle.USER_CURRENT);
|
|
||||||
mOverlayService.reloadAssets("com.android.settings", UserHandle.USER_CURRENT);
|
|
||||||
mOverlayService.reloadAssets("com.android.systemui", UserHandle.USER_CURRENT);
|
|
||||||
} catch (RemoteException ignored) {
|
|
||||||
}
|
|
||||||
} else if (preference == mPanelBg) {
|
|
||||||
String panelbg = (String) objValue;
|
String panelbg = (String) objValue;
|
||||||
int panelBgValue = Integer.parseInt(panelbg);
|
int panelBgValue = Integer.parseInt(panelbg);
|
||||||
mPanelBg.setValue(String.valueOf(panelBgValue));
|
mPanelBg.setValue(String.valueOf(panelBgValue));
|
||||||
@@ -406,32 +294,6 @@ public class ThemeSettings extends SettingsPreferenceFragment implements
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupThemeSwitchPref() {
|
|
||||||
mThemeSwitch = (ListPreference) findPreference(PREF_THEME_SWITCH);
|
|
||||||
mThemeSwitch.setOnPreferenceChangeListener(this);
|
|
||||||
if (CherishUtils.isThemeEnabled("com.android.theme.dark12.system")) {
|
|
||||||
mThemeSwitch.setValue("10");
|
|
||||||
} else if (CherishUtils.isThemeEnabled("com.android.theme.clearspring.system")) {
|
|
||||||
mThemeSwitch.setValue("9");
|
|
||||||
} else if (CherishUtils.isThemeEnabled("com.android.theme.darkgrey.system")) {
|
|
||||||
mThemeSwitch.setValue("7");
|
|
||||||
} else if (CherishUtils.isThemeEnabled("com.android.theme.pitchblack.system")) {
|
|
||||||
mThemeSwitch.setValue("6");
|
|
||||||
} else if (CherishUtils.isThemeEnabled("com.android.theme.materialocean.system")) {
|
|
||||||
mThemeSwitch.setValue("8");
|
|
||||||
} else if (CherishUtils.isThemeEnabled("com.android.theme.chocox.system")) {
|
|
||||||
mThemeSwitch.setValue("5");
|
|
||||||
} else if (CherishUtils.isThemeEnabled("com.android.theme.bakedgreen.system")) {
|
|
||||||
mThemeSwitch.setValue("4");
|
|
||||||
} else if (CherishUtils.isThemeEnabled("com.android.theme.solarizeddark.system")) {
|
|
||||||
mThemeSwitch.setValue("3");
|
|
||||||
} else if (mUiModeManager.getNightMode() == UiModeManager.MODE_NIGHT_YES) {
|
|
||||||
mThemeSwitch.setValue("2");
|
|
||||||
} else {
|
|
||||||
mThemeSwitch.setValue("1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupAccentPref() {
|
private void setupAccentPref() {
|
||||||
mThemeColor = (ColorPickerPreference) findPreference(ACCENT_COLOR);
|
mThemeColor = (ColorPickerPreference) findPreference(ACCENT_COLOR);
|
||||||
String colorVal = SystemProperties.get(ACCENT_COLOR_PROP, "-1");
|
String colorVal = SystemProperties.get(ACCENT_COLOR_PROP, "-1");
|
||||||
@@ -467,21 +329,6 @@ public class ThemeSettings extends SettingsPreferenceFragment implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleBackgrounds(Boolean state, Context context, int mode, String[] overlays) {
|
|
||||||
if (context != null) {
|
|
||||||
Objects.requireNonNull(context.getSystemService(UiModeManager.class))
|
|
||||||
.setNightMode(mode);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < overlays.length; i++) {
|
|
||||||
String background = overlays[i];
|
|
||||||
try {
|
|
||||||
mOverlayService.setEnabled(background, state, USER_SYSTEM);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getOverlayName(String[] overlays) {
|
private String getOverlayName(String[] overlays) {
|
||||||
String overlayName = null;
|
String overlayName = null;
|
||||||
for (int i = 0; i < overlays.length; i++) {
|
for (int i = 0; i < overlays.length; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user