From: Chaohui Wang Date: Fri, 8 Mar 2024 09:54:40 +0000 (+0530) Subject: samsung: Migrate to CompoundButton.OnCheckedChangeListener X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8fd19f2d7c9b4bc6242fb4e47aace82cf9a8bc27;p=GitHub%2FLineageOS%2Fandroid_hardware_samsung.git samsung: Migrate to CompoundButton.OnCheckedChangeListener Switch and SwitchCompat are both CompoundButton. Using CompoundButton in Java will helps migration in the future. Bug: 306658427 | AOSP Test: manual - check Settings pages Test: m RunSettingsLibRoboTests Signed-off-by: RisenID Change-Id: I85a70d4c504d8584030ea4a058f30d74206ab835 --- diff --git a/dap/src/org/lineageos/dap/DolbyFragment.kt b/dap/src/org/lineageos/dap/DolbyFragment.kt index 2331b65..2983434 100644 --- a/dap/src/org/lineageos/dap/DolbyFragment.kt +++ b/dap/src/org/lineageos/dap/DolbyFragment.kt @@ -17,17 +17,17 @@ package org.lineageos.dap import android.os.Bundle -import android.widget.Switch +import android.widget.CompoundButton +import android.widget.CompoundButton.OnCheckedChangeListener import androidx.preference.PreferenceFragment import com.android.settingslib.widget.MainSwitchPreference -import com.android.settingslib.widget.OnMainSwitchChangeListener import com.android.settingslib.widget.RadioButtonPreference import org.lineageos.dap.R -class DolbyFragment : PreferenceFragment(), OnMainSwitchChangeListener { +class DolbyFragment : PreferenceFragment(), OnCheckedChangeListener { private lateinit var switchBar: MainSwitchPreference @@ -47,7 +47,7 @@ class DolbyFragment : PreferenceFragment(), OnMainSwitchChangeListener { } } - override fun onSwitchChanged(switchView: Switch, isChecked: Boolean) { + override fun onCheckedChanged(buttonView: CompoundButton, isChecked: Boolean) { DolbyCore.setEnabled(isChecked) } diff --git a/doze/src/org/lineageos/settings/doze/SamsungDozeSettings.java b/doze/src/org/lineageos/settings/doze/SamsungDozeSettings.java index f0f9b52..0bc7fb8 100644 --- a/doze/src/org/lineageos/settings/doze/SamsungDozeSettings.java +++ b/doze/src/org/lineageos/settings/doze/SamsungDozeSettings.java @@ -19,7 +19,8 @@ package org.lineageos.settings.doze; import android.os.Bundle; import android.os.Handler; -import android.widget.Switch; +import android.widget.CompoundButton; +import android.widget.CompoundButton.OnCheckedChangeListener; import androidx.preference.Preference; import androidx.preference.Preference.OnPreferenceChangeListener; @@ -27,12 +28,11 @@ import androidx.preference.PreferenceFragment; import androidx.preference.SwitchPreference; import com.android.settingslib.widget.MainSwitchPreference; -import com.android.settingslib.widget.OnMainSwitchChangeListener; import org.lineageos.internal.util.ScreenType; public class SamsungDozeSettings extends PreferenceFragment - implements OnPreferenceChangeListener, OnMainSwitchChangeListener { + implements OnPreferenceChangeListener, OnCheckedChangeListener { private MainSwitchPreference mSwitchBar; @@ -108,7 +108,7 @@ public class SamsungDozeSettings extends PreferenceFragment } @Override - public void onSwitchChanged(Switch switchView, boolean isChecked) { + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { Utils.enableDoze(getActivity(), isChecked); Utils.checkDozeService(getActivity());