Remove the getSwitch() in SwitchWidgetController

IMHO we don't need to expose switch in SwitchWidgetController.
This controller already has enough API to control the switch.

Also rename mSwitchWidget to mSwitchController because it is not a
widget.

Bug: 69973752
Test: test still pass
Change-Id: I0ac247e34468a44109ab26019f1303c814e381f2
This commit is contained in:
jackqdyulei
2017-11-30 13:55:09 -08:00
parent d5fff3645a
commit 9891b74533
5 changed files with 30 additions and 58 deletions

View File

@@ -74,9 +74,4 @@ public class MasterSwitchController extends SwitchWidgetController implements
public void setDisabledByAdmin(EnforcedAdmin admin) {
mPreference.setDisabledByAdmin(admin);
}
@Override
public Switch getSwitch() {
return mPreference.getSwitch();
}
}

View File

@@ -90,7 +90,7 @@ public class MasterSwitchPreference extends TwoTargetPreference {
}
public boolean isChecked() {
return mSwitch != null && mSwitch.isEnabled() && mChecked;
return mSwitch != null && mChecked;
}
public void setChecked(boolean checked) {

View File

@@ -82,10 +82,4 @@ public class SwitchBarController extends SwitchWidgetController implements
public void setDisabledByAdmin(EnforcedAdmin admin) {
mSwitchBar.setDisabledByAdmin(admin);
}
@Override
public Switch getSwitch() {
return mSwitchBar.getSwitch();
}
}

View File

@@ -16,7 +16,6 @@
package com.android.settings.widget;
import android.widget.Switch;
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
/*
@@ -108,12 +107,4 @@ public abstract class SwitchWidgetController {
* is {@code null}, then this preference will be enabled. Otherwise, it will be disabled.
*/
public abstract void setDisabledByAdmin(EnforcedAdmin admin);
/**
* Get the underlying switch widget.
*
* @return the switch widget.
*/
public abstract Switch getSwitch();
}