From 95cad50874c8f68fd59c112137902a2a4c3c122e Mon Sep 17 00:00:00 2001 From: Chaohui Wang Date: Tue, 24 Oct 2023 23:47:35 +0800 Subject: [PATCH] sm8350-common: parts: Migrate to CompoundButton.OnCheckedChangeListener Switch and SwitchCompat are both CompoundButton. Using CompoundButton in Java will helps migration in the future. Bug: 306658427 Test: manual - check Settings pages Test: m RunSettingsLibRoboTests Change-Id: I85a70d4c504d8584030ea4a058f30d74206ab835 --- .../org/lineageos/settings/doze/DozeSettingsFragment.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parts/src/org/lineageos/settings/doze/DozeSettingsFragment.java b/parts/src/org/lineageos/settings/doze/DozeSettingsFragment.java index 054b07c..9373c80 100644 --- a/parts/src/org/lineageos/settings/doze/DozeSettingsFragment.java +++ b/parts/src/org/lineageos/settings/doze/DozeSettingsFragment.java @@ -26,7 +26,8 @@ import android.content.DialogInterface; import android.content.SharedPreferences; import android.os.Bundle; import android.os.Handler; -import android.widget.Switch; +import android.widget.CompoundButton; +import android.widget.CompoundButton.OnCheckedChangeListener; import androidx.preference.ListPreference; import androidx.preference.Preference; import androidx.preference.Preference.OnPreferenceChangeListener; @@ -35,13 +36,12 @@ import androidx.preference.PreferenceFragment; import androidx.preference.SwitchPreference; import com.android.settingslib.widget.MainSwitchPreference; -import com.android.settingslib.widget.OnMainSwitchChangeListener; import org.lineageos.settings.R; import org.lineageos.settings.utils.FileUtils; public class DozeSettingsFragment extends PreferenceFragment - implements OnPreferenceChangeListener, OnMainSwitchChangeListener { + implements OnPreferenceChangeListener, OnCheckedChangeListener { private MainSwitchPreference mSwitchBar; private SwitchPreference mAlwaysOnDisplayPreference; @@ -112,7 +112,7 @@ public class DozeSettingsFragment extends PreferenceFragment } @Override - public void onSwitchChanged(Switch switchView, boolean isChecked) { + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { DozeUtils.enableDoze(getActivity(), isChecked); DozeUtils.checkDozeService(getActivity());