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

@@ -23,8 +23,7 @@ import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.Switch;
import androidx.preference.Preference;
@@ -32,9 +31,10 @@ import com.android.settings.R;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.notification.NotificationBackend;
import com.android.settings.widget.SettingsMainSwitchPreference;
import com.android.settingslib.widget.OnMainSwitchChangeListener;
public class BlockPreferenceController extends NotificationPreferenceController
implements PreferenceControllerMixin, OnCheckedChangeListener {
implements PreferenceControllerMixin, OnMainSwitchChangeListener {
private static final String KEY_BLOCK = "block";
private NotificationSettings.DependentFieldListener mDependentFieldListener;
@@ -104,7 +104,7 @@ public class BlockPreferenceController extends NotificationPreferenceController
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
public void onSwitchChanged(Switch switchView, boolean isChecked) {
boolean blocked = !isChecked;
if (mChannel != null) {
final int originalImportance = mChannel.getImportance();

View File

@@ -47,7 +47,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView;
import android.widget.TextView;
@@ -65,6 +64,7 @@ import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity;
import com.android.settingslib.utils.StringUtil;
import com.android.settingslib.utils.ThreadUtils;
import com.android.settingslib.widget.MainSwitchBar;
import com.android.settingslib.widget.OnMainSwitchChangeListener;
import java.util.ArrayList;
import java.util.Arrays;
@@ -355,7 +355,7 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity {
mHistoryEmpty.setVisibility(View.GONE);
}
private final OnCheckedChangeListener mOnSwitchClickListener =
private final OnMainSwitchChangeListener mOnSwitchClickListener =
(switchView, isChecked) -> {
int oldState = 0;
try {

View File

@@ -18,8 +18,7 @@ package com.android.settings.notification.zen;
import android.app.AutomaticZenRule;
import android.content.Context;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.Switch;
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
@@ -28,10 +27,11 @@ import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.widget.MainSwitchPreference;
import com.android.settingslib.widget.OnMainSwitchChangeListener;
public class ZenAutomaticRuleSwitchPreferenceController extends
AbstractZenModeAutomaticRulePreferenceController implements
OnCheckedChangeListener {
OnMainSwitchChangeListener {
private static final String KEY = "zen_automatic_rule_switch";
private AutomaticZenRule mRule;
@@ -86,7 +86,7 @@ public class ZenAutomaticRuleSwitchPreferenceController extends
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
public void onSwitchChanged(Switch switchView, boolean isChecked) {
final boolean enabled = isChecked;
if (enabled == mRule.isEnabled()) return;
mRule.setEnabled(enabled);