Cherish: Allow to flash on call only when entirely silent [3/3] and Add DND & Rate settings to flash on call [3/3]
In addition improve the strings
This commit is contained in:
@@ -14,14 +14,23 @@ import android.provider.Settings;
|
||||
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.cherish.settings.preferences.SystemSettingMasterSwitchPreference;
|
||||
import com.cherish.settings.preferences.CustomSeekBarPreference;
|
||||
import com.cherish.settings.preferences.SystemSettingListPreference;
|
||||
import com.cherish.settings.preferences.SystemSettingSwitchPreference;
|
||||
import net.margaritov.preference.colorpicker.ColorPickerPreference;
|
||||
|
||||
public class NotificationSettings extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener{
|
||||
|
||||
private static final String PULSE_AMBIENT_LIGHT = "pulse_ambient_light";
|
||||
private static final String PREF_FLASH_ON_CALL = "flashlight_on_call";
|
||||
private static final String PREF_FLASH_ON_CALL_DND = "flashlight_on_call_ignore_dnd";
|
||||
private static final String PREF_FLASH_ON_CALL_RATE = "flashlight_on_call_rate";
|
||||
|
||||
private Preference mChargingLeds;
|
||||
private SystemSettingMasterSwitchPreference mEdgePulse;
|
||||
private SystemSettingListPreference mFlashOnCall;
|
||||
private SystemSettingSwitchPreference mFlashOnCallIgnoreDND;
|
||||
private CustomSeekBarPreference mFlashOnCallRate;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
@@ -42,6 +51,24 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
|
||||
int edgePulse = Settings.System.getInt(getContentResolver(),
|
||||
PULSE_AMBIENT_LIGHT, 0);
|
||||
mEdgePulse.setChecked(edgePulse != 0);
|
||||
|
||||
mFlashOnCallRate = (CustomSeekBarPreference)
|
||||
findPreference(PREF_FLASH_ON_CALL_RATE);
|
||||
int value = Settings.System.getInt(resolver,
|
||||
Settings.System.FLASHLIGHT_ON_CALL_RATE, 1);
|
||||
mFlashOnCallRate.setValue(value);
|
||||
mFlashOnCallRate.setOnPreferenceChangeListener(this);
|
||||
|
||||
mFlashOnCallIgnoreDND = (SystemSettingSwitchPreference)
|
||||
findPreference(PREF_FLASH_ON_CALL_DND);
|
||||
value = Settings.System.getInt(resolver,
|
||||
Settings.System.FLASHLIGHT_ON_CALL, 0);
|
||||
mFlashOnCallIgnoreDND.setVisible(value > 1);
|
||||
mFlashOnCallRate.setVisible(value != 0);
|
||||
|
||||
mFlashOnCall = (SystemSettingListPreference)
|
||||
findPreference(PREF_FLASH_ON_CALL);
|
||||
mFlashOnCall.setOnPreferenceChangeListener(this);
|
||||
|
||||
}
|
||||
|
||||
@@ -53,7 +80,19 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
|
||||
Settings.System.putInt(getContentResolver(),
|
||||
PULSE_AMBIENT_LIGHT, value ? 1 : 0);
|
||||
return true;
|
||||
}
|
||||
} else 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user