Channel settings updates
- Update master switch preference to store enabled state in case it's set before the view holder is bound - Update master switch preference to prevent disabled switches from being toggled - Show an importance summary for max importance - properly handle null notification sounds Change-Id: I395b95b76d2a3c1c94b41d1c2720bb0cf1cae917 Fixes: 36920159 Fixes: 37421928 Fixes: 36939825 Test: RunSettingsRoboTests & manual
This commit is contained in:
@@ -36,6 +36,7 @@ public class MasterSwitchPreference extends TwoTargetPreference {
|
||||
|
||||
private Switch mSwitch;
|
||||
private boolean mChecked;
|
||||
private boolean mEnableSwitch = true;
|
||||
|
||||
public MasterSwitchPreference(Context context, AttributeSet attrs,
|
||||
int defStyleAttr, int defStyleRes) {
|
||||
@@ -67,6 +68,9 @@ public class MasterSwitchPreference extends TwoTargetPreference {
|
||||
widgetView.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mSwitch != null && !mSwitch.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
setChecked(!mChecked);
|
||||
if (!callChangeListener(mChecked)) {
|
||||
setChecked(!mChecked);
|
||||
@@ -76,9 +80,11 @@ public class MasterSwitchPreference extends TwoTargetPreference {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mSwitch = (Switch) holder.findViewById(R.id.switchWidget);
|
||||
if (mSwitch != null) {
|
||||
mSwitch.setChecked(mChecked);
|
||||
mSwitch.setEnabled(mEnableSwitch);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +100,7 @@ public class MasterSwitchPreference extends TwoTargetPreference {
|
||||
}
|
||||
|
||||
public void setSwitchEnabled(boolean enabled) {
|
||||
mEnableSwitch = enabled;
|
||||
if (mSwitch != null) {
|
||||
mSwitch.setEnabled(enabled);
|
||||
}
|
||||
|
Reference in New Issue
Block a user