Revert "Revert "Cherish:Switch Styles[2/3]""
This reverts commit 25fb93e404.
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
@@ -769,6 +769,31 @@
|
|||||||
<item>4</item>
|
<item>4</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<!-- Switch Styles -->
|
||||||
|
<string-array name="switch_style_entries" translatable="false">
|
||||||
|
<item>@string/switch_oneplus</item>
|
||||||
|
<item>@string/switch_narrow</item>
|
||||||
|
<item>@string/switch_contained</item>
|
||||||
|
<item>@string/switch_telegram</item>
|
||||||
|
<item>@string/switch_md2</item>
|
||||||
|
<item>@string/switch_retro</item>
|
||||||
|
<item>@string/switch_oos</item>
|
||||||
|
<item>@string/switch_fluid</item>
|
||||||
|
<item>@string/switch_android_s</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="switch_style_values" translatable="false">
|
||||||
|
<item>0</item>
|
||||||
|
<item>1</item>
|
||||||
|
<item>2</item>
|
||||||
|
<item>3</item>
|
||||||
|
<item>4</item>
|
||||||
|
<item>5</item>
|
||||||
|
<item>6</item>
|
||||||
|
<item>7</item>
|
||||||
|
<item>8</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
<!-- QS tile styles -->
|
<!-- QS tile styles -->
|
||||||
<string-array name="qs_selector_entries" translatable="false">
|
<string-array name="qs_selector_entries" translatable="false">
|
||||||
<item>@string/qstile_default</item>
|
<item>@string/qstile_default</item>
|
||||||
|
|||||||
@@ -848,6 +848,18 @@
|
|||||||
<string name="lockscreen_status_bar_title">Status bar</string>
|
<string name="lockscreen_status_bar_title">Status bar</string>
|
||||||
<string name="lockscreen_status_bar_summary">Display status bar on the lockscreen</string>
|
<string name="lockscreen_status_bar_summary">Display status bar on the lockscreen</string>
|
||||||
|
|
||||||
|
<!-- Switch Styles -->
|
||||||
|
<string name="switch_style_title">Switch Style</string>
|
||||||
|
<string name="switch_oneplus">OnePlus (default)</string>
|
||||||
|
<string name="switch_narrow">Narrow</string>
|
||||||
|
<string name="switch_contained">Contained</string>
|
||||||
|
<string name="switch_telegram">Telegram</string>
|
||||||
|
<string name="switch_md2">Material Design 2</string>
|
||||||
|
<string name="switch_retro">Retro</string>
|
||||||
|
<string name="switch_oos">OxygenOS 11</string>
|
||||||
|
<string name="switch_fluid">Fluid</string>
|
||||||
|
<string name="switch_android_s">Android S</string>
|
||||||
|
|
||||||
<!-- QS tile styles -->
|
<!-- QS tile styles -->
|
||||||
<string name="qs_tile_style_title">QS tile style</string>
|
<string name="qs_tile_style_title">QS tile style</string>
|
||||||
<string name="qstile_default">Default</string>
|
<string name="qstile_default">Default</string>
|
||||||
|
|||||||
@@ -46,6 +46,16 @@
|
|||||||
android:entryValues="@array/ui_style_selector_values"
|
android:entryValues="@array/ui_style_selector_values"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
|
<com.cherish.settings.preferences.SystemSettingListPreference
|
||||||
|
android:key="switch_style"
|
||||||
|
android:icon="@drawable/ic_switch_theme"
|
||||||
|
android:title="@string/switch_style_title"
|
||||||
|
android:dialogTitle="@string/switch_style_title"
|
||||||
|
android:entries="@array/switch_style_entries"
|
||||||
|
android:entryValues="@array/switch_style_values"
|
||||||
|
android:summary="%s"
|
||||||
|
android:defaultValue="0" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="qs_tile_style"
|
android:key="qs_tile_style"
|
||||||
android:icon="@drawable/ic_shape2_icon"
|
android:icon="@drawable/ic_shape2_icon"
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import java.util.Objects;
|
|||||||
|
|
||||||
import com.android.internal.util.cherish.ThemesUtils;
|
import com.android.internal.util.cherish.ThemesUtils;
|
||||||
import com.android.internal.util.cherish.CherishUtils;
|
import com.android.internal.util.cherish.CherishUtils;
|
||||||
|
import com.cherish.settings.preferences.SystemSettingListPreference;
|
||||||
import net.margaritov.preference.colorpicker.ColorPickerPreference;
|
import net.margaritov.preference.colorpicker.ColorPickerPreference;
|
||||||
|
|
||||||
public class ThemeSettings extends SettingsPreferenceFragment implements
|
public class ThemeSettings extends SettingsPreferenceFragment implements
|
||||||
@@ -67,7 +68,9 @@ public class ThemeSettings extends SettingsPreferenceFragment implements
|
|||||||
static final int DEFAULT_QS_PANEL_COLOR = 0xffffffff;
|
static final int DEFAULT_QS_PANEL_COLOR = 0xffffffff;
|
||||||
static final int DEFAULT = 0xff1a73e8;
|
static final int DEFAULT = 0xff1a73e8;
|
||||||
private static final String QS_PANEL_COLOR = "qs_panel_color";
|
private static final String QS_PANEL_COLOR = "qs_panel_color";
|
||||||
|
private static final String SWITCH_STYLE = "switch_style";
|
||||||
|
|
||||||
|
private SystemSettingListPreference mSwitchStyle;
|
||||||
private ColorPickerPreference mQsPanelColor;
|
private ColorPickerPreference mQsPanelColor;
|
||||||
|
|
||||||
private IOverlayManager mOverlayService;
|
private IOverlayManager mOverlayService;
|
||||||
@@ -90,6 +93,13 @@ public class ThemeSettings extends SettingsPreferenceFragment implements
|
|||||||
|
|
||||||
PreferenceScreen prefScreen = getPreferenceScreen();
|
PreferenceScreen prefScreen = getPreferenceScreen();
|
||||||
ContentResolver resolver = getActivity().getContentResolver();
|
ContentResolver resolver = getActivity().getContentResolver();
|
||||||
|
|
||||||
|
mSwitchStyle = (SystemSettingListPreference)findPreference(SWITCH_STYLE);
|
||||||
|
int switchStyle = Settings.System.getInt(resolver,Settings.System.SWITCH_STYLE, 2);
|
||||||
|
int switchIndex = mSwitchStyle.findIndexOfValue(String.valueOf(switchStyle));
|
||||||
|
mSwitchStyle.setValueIndex(switchIndex >= 0 ? switchIndex : 0);
|
||||||
|
mSwitchStyle.setSummary(mSwitchStyle.getEntry());
|
||||||
|
mSwitchStyle.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
mUIStyle = (ListPreference) findPreference(UI_STYLE);
|
mUIStyle = (ListPreference) findPreference(UI_STYLE);
|
||||||
int UIStyle = Settings.System.getInt(getActivity().getContentResolver(),
|
int UIStyle = Settings.System.getInt(getActivity().getContentResolver(),
|
||||||
@@ -247,6 +257,11 @@ public class ThemeSettings extends SettingsPreferenceFragment implements
|
|||||||
Settings.System.QS_HEADER_STYLE, Integer.valueOf(value));
|
Settings.System.QS_HEADER_STYLE, Integer.valueOf(value));
|
||||||
int newIndex = mQsHeaderStyle.findIndexOfValue(value);
|
int newIndex = mQsHeaderStyle.findIndexOfValue(value);
|
||||||
mQsHeaderStyle.setSummary(mQsHeaderStyle.getEntries()[newIndex]);
|
mQsHeaderStyle.setSummary(mQsHeaderStyle.getEntries()[newIndex]);
|
||||||
|
}else if (preference == mSwitchStyle) {
|
||||||
|
String value = (String) objValue;
|
||||||
|
Settings.System.putInt(resolver, Settings.System.SWITCH_STYLE, Integer.valueOf(value));
|
||||||
|
int valueIndex = mSwitchStyle.findIndexOfValue(value);
|
||||||
|
mSwitchStyle.setSummary(mSwitchStyle.getEntries()[valueIndex]);
|
||||||
} else if (preference == mQsTileStyle) {
|
} else if (preference == mQsTileStyle) {
|
||||||
int qsTileStyleValue = Integer.valueOf((String) objValue);
|
int qsTileStyleValue = Integer.valueOf((String) objValue);
|
||||||
Settings.System.putIntForUser(resolver,
|
Settings.System.putIntForUser(resolver,
|
||||||
@@ -355,4 +370,4 @@ private int getOverlayPosition(String[] overlays) {
|
|||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
return MetricsProto.MetricsEvent.CHERISH_SETTINGS;
|
return MetricsProto.MetricsEvent.CHERISH_SETTINGS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user