Cherish:Hide Leds if unsupported device

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
Hưng Phan
2021-07-27 18:11:30 +07:00
parent c784783b6c
commit 9fd1411060

View File

@@ -45,8 +45,11 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
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 static final String ALERT_SLIDER_PREF = "alert_slider_notifications"; private static final String ALERT_SLIDER_PREF = "alert_slider_notifications";
private static final String KEY_CHARGING_LIGHT = "charging_light";
private static final String LED_CATEGORY = "led";
private Preference mChargingLeds; private Preference mChargingLeds;
private PreferenceCategory mLedCategory;
private ColorPickerPreference mEdgeLightColorPreference; private ColorPickerPreference mEdgeLightColorPreference;
private CustomSeekBarPreference mEdgeLightDurationPreference; private CustomSeekBarPreference mEdgeLightDurationPreference;
private CustomSeekBarPreference mEdgeLightRepeatCountPreference; private CustomSeekBarPreference mEdgeLightRepeatCountPreference;
@@ -68,11 +71,18 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
if (!mAlertSliderAvailable) if (!mAlertSliderAvailable)
prefScreen.removePreference(mAlertSlider); prefScreen.removePreference(mAlertSlider);
mChargingLeds = (Preference) findPreference("charging_light"); boolean hasLED = res.getBoolean(
if (mChargingLeds != null com.android.internal.R.bool.config_hasNotificationLed);
&& !getResources().getBoolean( if (hasLED) {
com.android.internal.R.bool.config_intrusiveBatteryLed)) { mChargingLeds = findPreference(KEY_CHARGING_LIGHT);
prefScreen.removePreference(mChargingLeds); if (mChargingLeds != null
&& !res.getBoolean(
com.android.internal.R.bool.config_intrusiveBatteryLed)) {
prefScreen.removePreference(mChargingLeds);
}
} else {
mLedCategory = findPreference(LED_CATEGORY);
mLedCategory.setVisible(false);
} }
PreferenceCategory incallVibCategory = (PreferenceCategory) findPreference(INCALL_VIB_OPTIONS); PreferenceCategory incallVibCategory = (PreferenceCategory) findPreference(INCALL_VIB_OPTIONS);