diff --git a/res/values/cherish_strings.xml b/res/values/cherish_strings.xml index 153c711..0be6122 100644 --- a/res/values/cherish_strings.xml +++ b/res/values/cherish_strings.xml @@ -371,10 +371,15 @@ %1$s + Flashlight Blink Flashlight for incoming call Disabled When ringing When ringer is silent When entirely silent (no ringer or vibrator) Always + Ignore DND + Whether to flash when in Do Not Disturb mode + Rate + Flashlight on call blink rate diff --git a/res/xml/cherish_settings_notifications.xml b/res/xml/cherish_settings_notifications.xml index 10f248c..6d235ce 100644 --- a/res/xml/cherish_settings_notifications.xml +++ b/res/xml/cherish_settings_notifications.xml @@ -42,12 +42,31 @@ - + + + + + + + + 1); + mFlashOnCallRate.setVisible(value != 0); + + mFlashOnCall = (SystemSettingListPreference) + findPreference(PREF_FLASH_ON_CALL); + mFlashOnCall.setOnPreferenceChangeListener(this); + mChargingLeds = (Preference) findPreference("charging_light"); if (mChargingLeds != null && !getResources().getBoolean( @@ -66,6 +91,20 @@ public class NotificationSettings extends SettingsPreferenceFragment implements @Override public boolean onPreferenceChange(Preference preference, Object newValue) { + final ContentResolver resolver = getActivity().getContentResolver(); + if (preference == mFlashOnCall) { + int value = Integer.parseInt((String) newValue); + Settings.System.putInt(resolver, + Settings.System.FLASHLIGHT_ON_CALL, value); + mFlashOnCallIgnoreDND.setVisible(value > 1); + mFlashOnCallRate.setVisible(value != 0); + return true; + } else if (preference == mFlashOnCallRate) { + int value = (Integer) newValue; + Settings.System.putInt(resolver, + Settings.System.FLASHLIGHT_ON_CALL_RATE, value); + return true; + } return false; }