Merge "Allow SettingsMainSwitchBars to be disabled" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-03-17 01:56:40 +00:00
committed by Android (Google) Code Review
2 changed files with 4 additions and 4 deletions

View File

@@ -84,9 +84,8 @@ public class SettingsMainSwitchBar extends MainSwitchBar {
} }
/** /**
* If admin is not null, disables the text and switch but keeps the view clickable. * If admin is not null, disables the text and switch but keeps the view clickable (unless the
* Otherwise, calls setEnabled which will enables the entire view including * switch is disabled for other reasons). Otherwise, calls setEnabled.
* the text and switch.
*/ */
public void setDisabledByAdmin(RestrictedLockUtils.EnforcedAdmin admin) { public void setDisabledByAdmin(RestrictedLockUtils.EnforcedAdmin admin) {
mEnforcedAdmin = admin; mEnforcedAdmin = admin;
@@ -101,7 +100,7 @@ public class SettingsMainSwitchBar extends MainSwitchBar {
mDisabledByAdmin = false; mDisabledByAdmin = false;
mSwitch.setVisibility(View.VISIBLE); mSwitch.setVisibility(View.VISIBLE);
mRestrictedIcon.setVisibility(View.GONE); mRestrictedIcon.setVisibility(View.GONE);
setEnabled(true); setEnabled(isEnabled());
} }
} }

View File

@@ -186,6 +186,7 @@ public class SettingsMainSwitchPreference extends TwoStatePreference {
* Enable or disable the text and switch. * Enable or disable the text and switch.
*/ */
public void setSwitchBarEnabled(boolean enabled) { public void setSwitchBarEnabled(boolean enabled) {
setEnabled(enabled);
if (mMainSwitchBar != null) { if (mMainSwitchBar != null) {
mMainSwitchBar.setEnabled(enabled); mMainSwitchBar.setEnabled(enabled);
} }