RM6785: doze: Migrate to CompoundButton.OnCheckedChangeListener
Switch and SwitchCompat are both CompoundButton.
Using CompoundButton in Java will helps migration in the future.
Bug: 306658427 | AOSP | AOSP
Test: manual - check Settings pages
Test: m RunSettingsLibRoboTests
Change-Id: I85a70d4c504d8584030ea4a058f30d74206ab835
diff --git a/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.kt b/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.kt
index d34c3a3..0d61885 100644
--- a/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.kt
+++ b/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.kt
@@ -10,14 +10,13 @@
import android.os.Bundle
import android.os.Handler
import android.os.Looper
-import android.widget.Switch
+import android.widget.CompoundButton
import androidx.preference.*
import com.android.settingslib.widget.MainSwitchPreference
-import com.android.settingslib.widget.OnMainSwitchChangeListener
class DozeSettingsFragment : PreferenceFragment(), Preference.OnPreferenceChangeListener,
- OnMainSwitchChangeListener {
+ CompoundButton.OnCheckedChangeListener {
private lateinit var alwaysOnDisplayPreference: SwitchPreference
private lateinit var switchBar: MainSwitchPreference
@@ -75,7 +74,7 @@
return true
}
- override fun onSwitchChanged(switchView: Switch, isChecked: Boolean) {
+ override fun onCheckedChanged(buttonView: CompoundButton, isChecked: Boolean) {
Utils.enableDoze(context, isChecked)
Utils.checkDozeService(context)