Alert Slider: Add toggle to disable notifications [2/2]
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
@@ -440,4 +440,8 @@
|
||||
<string name="swap_volume_buttons_summary">Swap volume buttons when the screen is rotated</string>
|
||||
<string name="volume_panel_on_left_title">Show volume panel on left</string>
|
||||
<string name="volume_panel_on_left_summary">Display volume panel on the left side of the screen</string>
|
||||
|
||||
<!-- Alert Slider Notifications (OnePlus devices) -->
|
||||
<string name="alert_slider_notifications_title">Alert slider notifications</string>
|
||||
<string name="alert_slider_notifications_summary">Display notification when changing alert slider position</string>
|
||||
</resources>
|
||||
|
||||
@@ -53,6 +53,15 @@
|
||||
android:summary="@string/notification_sound_vib_screen_on_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<!-- Alert Slider Notifications -->
|
||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="alert_slider_notifications"
|
||||
android:title="@string/alert_slider_notifications_title"
|
||||
android:summary="@string/alert_slider_notifications_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="incall_vib_options"
|
||||
android:title="@string/incall_vibration_category" >
|
||||
|
||||
@@ -38,7 +38,10 @@ import java.util.List;
|
||||
public class NotificationSettings extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener{
|
||||
|
||||
private static final String INCALL_VIB_OPTIONS = "incall_vib_options";
|
||||
private static final String ALERT_SLIDER_PREF = "alert_slider_notifications";
|
||||
|
||||
private Preference mChargingLeds;
|
||||
private Preference mAlertSlider;
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
@@ -48,6 +51,12 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
|
||||
final PreferenceScreen prefScreen = getPreferenceScreen();
|
||||
final Resources res = getResources();
|
||||
|
||||
mAlertSlider = (Preference) prefScreen.findPreference(ALERT_SLIDER_PREF);
|
||||
boolean mAlertSliderAvailable = res.getBoolean(
|
||||
com.android.internal.R.bool.config_hasAlertSlider);
|
||||
if (!mAlertSliderAvailable)
|
||||
prefScreen.removePreference(mAlertSlider);
|
||||
|
||||
mChargingLeds = (Preference) findPreference("charging_light");
|
||||
if (mChargingLeds != null
|
||||
&& !getResources().getBoolean(
|
||||
@@ -94,6 +103,10 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
final Resources res = context.getResources();
|
||||
boolean mAlertSliderAvailable = res.getBoolean(
|
||||
com.android.internal.R.bool.config_hasAlertSlider);
|
||||
if (!mAlertSliderAvailable)
|
||||
keys.add(ALERT_SLIDER_PREF);
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user