DO NOT MERGE Set click listeners on displayPreference
Test: manual (tap options multiple times with talkback on) Test: ZenModeVisEffectsCustomPreferenceControllerTest, robotests Change-Id: Iffa701fb486bd9eeda7d2c4c46cb30392a09a5df Bug: 79728671
This commit is contained in:
@@ -19,6 +19,7 @@ package com.android.settings.notification;
|
||||
import android.app.NotificationManager.Policy;
|
||||
import android.content.Context;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
@@ -28,6 +29,9 @@ import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
public class ZenModeVisEffectsCustomPreferenceController
|
||||
extends AbstractZenModePreferenceController {
|
||||
|
||||
private final String KEY;
|
||||
private ZenCustomRadioButtonPreference mPreference;
|
||||
|
||||
protected static final int INTERRUPTIVE_EFFECTS = Policy.SUPPRESSED_EFFECT_AMBIENT
|
||||
| Policy.SUPPRESSED_EFFECT_PEEK
|
||||
| Policy.SUPPRESSED_EFFECT_LIGHTS
|
||||
@@ -36,6 +40,7 @@ public class ZenModeVisEffectsCustomPreferenceController
|
||||
public ZenModeVisEffectsCustomPreferenceController(Context context, Lifecycle lifecycle,
|
||||
String key) {
|
||||
super(context, key, lifecycle);
|
||||
KEY = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,20 +48,25 @@ public class ZenModeVisEffectsCustomPreferenceController
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
mPreference = (ZenCustomRadioButtonPreference) screen.findPreference(KEY);
|
||||
|
||||
mPreference.setOnGearClickListener(p -> {
|
||||
launchCustomSettings();
|
||||
});
|
||||
|
||||
mPreference.setOnRadioButtonClickListener(p -> {
|
||||
launchCustomSettings();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
super.updateState(preference);
|
||||
|
||||
ZenCustomRadioButtonPreference pref = (ZenCustomRadioButtonPreference) preference;
|
||||
pref.setChecked(areCustomOptionsSelected());
|
||||
|
||||
pref.setOnGearClickListener(p -> {
|
||||
launchCustomSettings();
|
||||
});
|
||||
|
||||
pref.setOnRadioButtonClickListener(p -> {
|
||||
launchCustomSettings();
|
||||
});
|
||||
mPreference.setChecked(areCustomOptionsSelected());
|
||||
}
|
||||
|
||||
protected boolean areCustomOptionsSelected() {
|
||||
|
||||
Reference in New Issue
Block a user