Revert "Migrate to CompoundButton.OnCheckedChangeListener"

Revert submission 25147565-onSwitchChanged-CompoundButton

Reason for revert: breaking builds 

Bug:309601476

Reverted changes: /q/submissionid:25147565-onSwitchChanged-CompoundButton

Change-Id: Ie746db87d9c642599593aa3d5e5baf6b7ba89c0e
This commit is contained in:
Sebastian Pickl
2023-11-07 13:26:36 +00:00
committed by Android (Google) Code Review
parent 71d1f021af
commit 8979681a8d
49 changed files with 188 additions and 174 deletions

View File

@@ -21,6 +21,7 @@ import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Switch;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.RestrictedLockUtils;
@@ -38,9 +39,10 @@ public class SettingsMainSwitchBar extends MainSwitchBar {
public interface OnBeforeCheckedChangeListener {
/**
* @param isChecked The new checked state of switchView.
* @param switchView The Switch view whose state has changed.
* @param isChecked The new checked state of switchView.
*/
boolean onBeforeCheckedChanged(boolean isChecked);
boolean onBeforeCheckedChanged(Switch switchView, boolean isChecked);
}
private EnforcedAdmin mEnforcedAdmin;
@@ -115,7 +117,7 @@ public class SettingsMainSwitchBar extends MainSwitchBar {
@Override
public void setChecked(boolean checked) {
if (mOnBeforeListener != null
&& mOnBeforeListener.onBeforeCheckedChanged(checked)) {
&& mOnBeforeListener.onBeforeCheckedChanged(mSwitch, checked)) {
return;
}
super.setChecked(checked);