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