Cherish: fixup! Add ambient pulse and aod notifications [2/2]
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
@@ -163,8 +163,7 @@
|
|||||||
android:key="ambient_notification_light_enabled"
|
android:key="ambient_notification_light_enabled"
|
||||||
android:title="@string/ambient_notification_light_enabled_title"
|
android:title="@string/ambient_notification_light_enabled_title"
|
||||||
android:summary="@string/ambient_notification_light_enabled_summary"
|
android:summary="@string/ambient_notification_light_enabled_summary"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false" />
|
||||||
android:persistent="false" />
|
|
||||||
|
|
||||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||||
android:key="ambient_notification_light_hide_aod"
|
android:key="ambient_notification_light_hide_aod"
|
||||||
@@ -205,8 +204,8 @@
|
|||||||
ledPreview="true"
|
ledPreview="true"
|
||||||
settings:defaultColorValue="0xFF3980FF" />
|
settings:defaultColorValue="0xFF3980FF" />
|
||||||
|
|
||||||
<com.cherish.settings.preferences.SystemSettingSeekBarPreference
|
<com.cherish.settings.preferences.CustomSeekBarPreference
|
||||||
android:key="ambient_light_duration"
|
android:key="notification_pulse_duration"
|
||||||
android:title="@string/pulse_ambient_light_duration_title"
|
android:title="@string/pulse_ambient_light_duration_title"
|
||||||
android:summary="@string/pulse_ambient_light_duration_summary"
|
android:summary="@string/pulse_ambient_light_duration_summary"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
@@ -217,8 +216,8 @@
|
|||||||
settings:interval="1"
|
settings:interval="1"
|
||||||
android:dependency="pulse_ambient_light" />
|
android:dependency="pulse_ambient_light" />
|
||||||
|
|
||||||
<com.cherish.settings.preferences.SystemSettingSeekBarPreference
|
<com.cherish.settings.preferences.CustomSeekBarPreference
|
||||||
android:key="ambient_light_repeat_count"
|
android:key="notification_pulse_repeats"
|
||||||
android:title="@string/pulse_ambient_light_repeat_count_title"
|
android:title="@string/pulse_ambient_light_repeat_count_title"
|
||||||
android:summary="@string/pulse_ambient_light_repeat_count_summary"
|
android:summary="@string/pulse_ambient_light_repeat_count_summary"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
|
|||||||
@@ -33,16 +33,16 @@ import com.android.internal.util.cherish.CherishUtils;
|
|||||||
public class NotificationSettings extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener{
|
public class NotificationSettings extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener{
|
||||||
|
|
||||||
private static final String NOTIFICATION_PULSE_COLOR = "ambient_notification_light_color";
|
private static final String NOTIFICATION_PULSE_COLOR = "ambient_notification_light_color";
|
||||||
private static final String AMBIENT_LIGHT_DURATION = "ambient_light_duration";
|
private static final String NOTIFICATION_PULSE_DURATION = "notification_pulse_duration";
|
||||||
private static final String AMBIENT_LIGHT_REPEAT_COUNT = "ambient_light_repeat_count";
|
private static final String NOTIFICATION_PULSE_REPEATS = "notification_pulse_repeats";
|
||||||
private static final String PULSE_COLOR_MODE_PREF = "ambient_notification_light_color_mode";
|
private static final String PULSE_COLOR_MODE_PREF = "ambient_notification_light_color_mode";
|
||||||
private static final String INCALL_VIB_OPTIONS = "incall_vib_options";
|
private static final String INCALL_VIB_OPTIONS = "incall_vib_options";
|
||||||
private static final String KEY_AMBIENT = "ambient_notification_light_enabled";
|
private static final String KEY_AMBIENT = "ambient_notification_light_enabled";
|
||||||
|
|
||||||
private Preference mChargingLeds;
|
private Preference mChargingLeds;
|
||||||
private ColorPickerPreference mEdgeLightColorPreference;
|
private ColorPickerPreference mEdgeLightColorPreference;
|
||||||
private SystemSettingSeekBarPreference mEdgeLightDurationPreference;
|
private CustomSeekBarPreference mEdgeLightDurationPreference;
|
||||||
private SystemSettingSeekBarPreference mEdgeLightRepeatCountPreference;
|
private CustomSeekBarPreference mEdgeLightRepeatCountPreference;
|
||||||
private ListPreference mColorMode;
|
private ListPreference mColorMode;
|
||||||
private SystemSettingListPreference mAmbientLightLayout;
|
private SystemSettingListPreference mAmbientLightLayout;
|
||||||
private SystemSettingSwitchPreference mAmbientPref;
|
private SystemSettingSwitchPreference mAmbientPref;
|
||||||
@@ -75,16 +75,16 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
|
|||||||
mAmbientPref.setSummary(R.string.aod_disabled);
|
mAmbientPref.setSummary(R.string.aod_disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
mEdgeLightRepeatCountPreference = (SystemSettingSeekBarPreference) findPreference(AMBIENT_LIGHT_REPEAT_COUNT);
|
mEdgeLightRepeatCountPreference = (CustomSeekBarPreference) findPreference(NOTIFICATION_PULSE_REPEATS);
|
||||||
mEdgeLightRepeatCountPreference.setOnPreferenceChangeListener(this);
|
mEdgeLightRepeatCountPreference.setOnPreferenceChangeListener(this);
|
||||||
int rCount = Settings.System.getInt(getContentResolver(),
|
int repeats = Settings.System.getInt(getContentResolver(),
|
||||||
Settings.System.AMBIENT_LIGHT_REPEAT_COUNT, 0);
|
Settings.System.NOTIFICATION_PULSE_REPEATS, 0);
|
||||||
mEdgeLightRepeatCountPreference.setValue(rCount);
|
mEdgeLightRepeatCountPreference.setValue(repeats);
|
||||||
|
|
||||||
mEdgeLightDurationPreference = (SystemSettingSeekBarPreference) findPreference(AMBIENT_LIGHT_DURATION);
|
mEdgeLightDurationPreference = (CustomSeekBarPreference) findPreference(NOTIFICATION_PULSE_DURATION);
|
||||||
mEdgeLightDurationPreference.setOnPreferenceChangeListener(this);
|
mEdgeLightDurationPreference.setOnPreferenceChangeListener(this);
|
||||||
int duration = Settings.System.getInt(getContentResolver(),
|
int duration = Settings.System.getInt(getContentResolver(),
|
||||||
Settings.System.AMBIENT_LIGHT_DURATION, 2);
|
Settings.System.NOTIFICATION_PULSE_DURATION, 2);
|
||||||
mEdgeLightDurationPreference.setValue(duration);
|
mEdgeLightDurationPreference.setValue(duration);
|
||||||
|
|
||||||
mColorMode = (ListPreference) findPreference(PULSE_COLOR_MODE_PREF);
|
mColorMode = (ListPreference) findPreference(PULSE_COLOR_MODE_PREF);
|
||||||
@@ -113,7 +113,7 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
|
|||||||
mEdgeLightColorPreference.setAlphaSliderEnabled(false);
|
mEdgeLightColorPreference.setAlphaSliderEnabled(false);
|
||||||
mAmbientLightLayout.setEnabled(true);
|
mAmbientLightLayout.setEnabled(true);
|
||||||
String edgeLightColorHex = String.format("#%08x", (0xFF3980FF & edgeLightColor));
|
String edgeLightColorHex = String.format("#%08x", (0xFF3980FF & edgeLightColor));
|
||||||
if (edgeLightColorHex.equals("#ff3980ff")) {
|
if (edgeLightColorHex.equals("#ff1a73e8")) {
|
||||||
mEdgeLightColorPreference.setSummary(R.string.color_default);
|
mEdgeLightColorPreference.setSummary(R.string.color_default);
|
||||||
} else {
|
} else {
|
||||||
mEdgeLightColorPreference.setSummary(edgeLightColorHex);
|
mEdgeLightColorPreference.setSummary(edgeLightColorHex);
|
||||||
@@ -127,7 +127,7 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
|
|||||||
if (preference == mEdgeLightColorPreference) {
|
if (preference == mEdgeLightColorPreference) {
|
||||||
String hex = ColorPickerPreference.convertToARGB(
|
String hex = ColorPickerPreference.convertToARGB(
|
||||||
Integer.valueOf(String.valueOf(newValue)));
|
Integer.valueOf(String.valueOf(newValue)));
|
||||||
if (hex.equals("#ff3980ff")) {
|
if (hex.equals("#ff1a73e8")) {
|
||||||
preference.setSummary(R.string.color_default);
|
preference.setSummary(R.string.color_default);
|
||||||
} else {
|
} else {
|
||||||
preference.setSummary(hex);
|
preference.setSummary(hex);
|
||||||
@@ -139,12 +139,12 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
|
|||||||
} else if (preference == mEdgeLightRepeatCountPreference) {
|
} else if (preference == mEdgeLightRepeatCountPreference) {
|
||||||
int value = (Integer) newValue;
|
int value = (Integer) newValue;
|
||||||
Settings.System.putInt(getContentResolver(),
|
Settings.System.putInt(getContentResolver(),
|
||||||
Settings.System.AMBIENT_LIGHT_REPEAT_COUNT, value);
|
Settings.System.NOTIFICATION_PULSE_REPEATS, value);
|
||||||
return true;
|
return true;
|
||||||
} else if (preference == mEdgeLightDurationPreference) {
|
} else if (preference == mEdgeLightDurationPreference) {
|
||||||
int value = (Integer) newValue;
|
int value = (Integer) newValue;
|
||||||
Settings.System.putInt(getContentResolver(),
|
Settings.System.putInt(getContentResolver(),
|
||||||
Settings.System.AMBIENT_LIGHT_DURATION, value);
|
Settings.System.NOTIFICATION_PULSE_DURATION, value);
|
||||||
return true;
|
return true;
|
||||||
} else if (preference == mColorMode) {
|
} else if (preference == mColorMode) {
|
||||||
int value = Integer.valueOf((String) newValue);
|
int value = Integer.valueOf((String) newValue);
|
||||||
|
|||||||
Reference in New Issue
Block a user