Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c29c84cc authored by Jacky Wang's avatar Jacky Wang
Browse files

[Catalyst] Move MainSwitchPreferenceBinding

Remove MainSwitchPreference metadata, which is confusing. Also move
MainSwitchPreferenceBinding to MainSwitchPreference library.

Bug: 374860556
Flag: EXEMPT refactor
Test: atest
Change-Id: I32e8482e8fd31a48c2427f707c366d05ec3f1d6a
parent 8148370f
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -22,4 +22,11 @@ android_library {
        "guava",
    ],
    kotlincflags: ["-Xjvm-default=all"],
    apex_available: [
        "//apex_available:platform",
        "com.android.adservices",
        "com.android.cellbroadcast",
        "com.android.extservices",
        "com.android.healthfitness",
    ],
}
+5 −1
Original line number Diff line number Diff line
@@ -14,11 +14,15 @@ android_library {
        "SettingsLintDefaults",
    ],

    srcs: ["src/**/*.java"],
    srcs: [
        "src/**/*.java",
        "src/**/*.kt",
    ],
    resource_dirs: ["res"],

    static_libs: [
        "androidx.preference_preference",
        "SettingsLibPreference",
        "SettingsLibSettingsTheme",
    ],

+27 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.settingslib.widget

import android.content.Context
import androidx.preference.Preference
import com.android.settingslib.preference.BooleanValuePreferenceBinding

/** A boolean value type preference associated with [MainSwitchPreference]. */
interface MainSwitchPreferenceBinding : BooleanValuePreferenceBinding {

    override fun createWidget(context: Context): Preference = MainSwitchPreference(context)
}
+7 −0
Original line number Diff line number Diff line
@@ -23,4 +23,11 @@ android_library {
    optimize: {
        proguard_flags_files: ["proguard.pgcfg"],
    },
    apex_available: [
        "//apex_available:platform",
        "com.android.adservices",
        "com.android.cellbroadcast",
        "com.android.extservices",
        "com.android.healthfitness",
    ],
}
+0 −6
Original line number Diff line number Diff line
@@ -63,9 +63,3 @@ constructor(
    @StringRes override val title: Int = 0,
    @StringRes override val summary: Int = 0,
) : BooleanValuePreference

/** A preference that provides a two-state toggleable option that can be used as a main switch. */
open class MainSwitchPreference
@JvmOverloads
constructor(override val key: String, @StringRes override val title: Int = 0) :
    BooleanValuePreference
Loading