Cherish: Only allow edge lights on AOD when AOD is enabled [2/2]

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
idoybh
2020-12-04 19:28:44 +01:00
committed by Hưng Phan
parent be7b6fc307
commit 67b03a9527
3 changed files with 21 additions and 2 deletions

View File

@@ -2,7 +2,14 @@ package com.cherish.settings.fragments;
import com.android.internal.logging.nano.MetricsProto;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.ContentResolver;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Bundle;
import android.os.UserHandle;
import android.content.ContentResolver;
import com.android.settings.R;
import android.content.res.Resources;
@@ -30,6 +37,7 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
private static final String AMBIENT_LIGHT_REPEAT_COUNT = "ambient_light_repeat_count";
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;
@@ -37,7 +45,7 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
private SystemSettingSeekBarPreference mEdgeLightRepeatCountPreference;
private ListPreference mColorMode;
private SystemSettingListPreference mAmbientLightLayout;
private SystemSettingSwitchPreference mAmbientPref;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -58,6 +66,15 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
prefScreen.removePreference(incallVibCategory);
}
mAmbientPref = (SystemSettingSwitchPreference) findPreference(KEY_AMBIENT);
boolean aodEnabled = Settings.Secure.getIntForUser(resolver,
Settings.Secure.DOZE_ALWAYS_ON, 0, UserHandle.USER_CURRENT) == 1;
if (!aodEnabled) {
mAmbientPref.setChecked(false);
mAmbientPref.setEnabled(false);
mAmbientPref.setSummary(R.string.aod_disabled);
}
mEdgeLightRepeatCountPreference = (SystemSettingSeekBarPreference) findPreference(AMBIENT_LIGHT_REPEAT_COUNT);
mEdgeLightRepeatCountPreference.setOnPreferenceChangeListener(this);
int rCount = Settings.System.getInt(getContentResolver(),