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 <risen@pixelexperience.org>
Change-Id: I85a70d4c504d8584030ea4a058f30d74206ab835
urubino^2
Chaohui Wang 8 months ago committed by LuK1337
parent 8b14999cd0
commit 8fd19f2d7c
No known key found for this signature in database
  1. 8
      dap/src/org/lineageos/dap/DolbyFragment.kt
  2. 8
      doze/src/org/lineageos/settings/doze/SamsungDozeSettings.java

@ -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)
}

@ -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());

Loading…
Cancel
Save