1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.settingslib.spa.gallery.preference 18 19 import android.os.Bundle 20 import androidx.compose.runtime.Composable 21 import com.android.settingslib.spa.framework.common.SettingsPageProvider 22 import com.android.settingslib.spa.framework.compose.navigator 23 import com.android.settingslib.spa.widget.preference.Preference 24 import com.android.settingslib.spa.widget.preference.PreferenceModel 25 import com.android.settingslib.spa.widget.scaffold.RegularScaffold 26 import com.android.settingslib.spa.widget.ui.Category 27 28 private const val TITLE = "Category: Preference" 29 30 object PreferenceMainPageProvider : SettingsPageProvider { 31 override val name = "PreferenceMain" 32 33 @Composable Pagenull34 override fun Page(arguments: Bundle?) { 35 RegularScaffold(TITLE) { 36 Category { 37 PreferencePageProvider.Entry() 38 ListPreferencePageProvider.Entry() 39 CheckBoxPreferencePageProvider.Entry() 40 } 41 Category { 42 SwitchPreferencePageProvider.Entry() 43 MainSwitchPreferencePageProvider.Entry() 44 TwoTargetSwitchPreferencePageProvider.Entry() 45 TwoTargetButtonPreferencePageProvider.Entry() 46 } 47 Category { 48 ZeroStatePreferencePageProvider.Entry() 49 IntroPreferencePageProvider.Entry() 50 TopIntroPreferencePageProvider.Entry() 51 } 52 } 53 } 54 55 @Composable Entrynull56 fun Entry() { 57 Preference(object : PreferenceModel { 58 override val title = TITLE 59 override val onClick = navigator(name) 60 }) 61 } 62 } 63