├── .gitignore ├── LICENSE ├── README.assets ├── 1.jpg ├── 2.jpg ├── 3.jpg ├── 5.jpg ├── 6.jpg └── Screenrecorder-2023-11-03-20-20-52-372.gif ├── README.md ├── README_en.md ├── app ├── .gitignore ├── build.gradle.kts ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── kiylx │ │ └── composepreference │ │ ├── AppCtx.kt │ │ ├── testcompose │ │ ├── MainActivity.kt │ │ ├── NewComponents.kt │ │ └── NewComponents2.kt │ │ └── ui │ │ └── theme │ │ ├── Color.kt │ │ ├── DefaultColorScheme.kt │ │ ├── Theme.kt │ │ └── Type.kt │ └── res │ ├── drawable │ ├── ic_launcher_background.xml │ └── ic_launcher_foreground.xml │ ├── mipmap-anydpi │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ ├── mipmap-mdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ ├── mipmap-xhdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ ├── mipmap-xxhdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ ├── mipmap-xxxhdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ ├── values │ ├── colors.xml │ ├── strings.xml │ └── themes.xml │ └── xml │ ├── backup_rules.xml │ └── data_extraction_rules.xml ├── build.gradle.kts ├── datastore-util ├── .gitignore ├── build.gradle.kts ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── kiylx │ └── libx │ └── pref_component │ └── datastore_util │ ├── DataStoreDelegate.kt │ ├── DataStoreEditor.kt │ ├── DataStorePreferenceHolder.kt │ ├── DataStoreUtils.kt │ └── dataStorePreferences.kt ├── gradle.properties ├── gradle ├── composeLibs.versions.toml ├── libs.versions.toml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jitpack.yml ├── preference-data-core ├── .gitignore ├── build.gradle.kts ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ └── java │ └── com │ └── kiylx │ └── libx │ └── pref_component │ └── core │ ├── DefaultPreferenceHolder.kt │ ├── IPreferenceEditor.kt │ └── PreferenceHolder.kt ├── preference-mmkv-util ├── .gitignore ├── build.gradle.kts ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── kiylx │ └── libx │ └── pref_component │ └── mmkv_util │ ├── MMKVEditor.kt │ ├── MMKVPreferenceHolder.kt │ ├── MmkvUtil.kt │ └── delegate │ └── MExt.kt ├── preference-ui-compose ├── .gitignore ├── build.gradle.kts ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── kiylx │ └── compose │ └── preference │ ├── component │ ├── auto │ │ ├── NodeBase.kt │ │ ├── PreferenceItem.kt │ │ ├── PreferenceSlider.kt │ │ ├── PreferenceSwitch.kt │ │ └── PreferencesLocal.kt │ └── cross │ │ ├── PreferenceCheckBox.kt │ │ ├── PreferenceItem.kt │ │ ├── PreferenceRadio.kt │ │ ├── PreferenceSlider.kt │ │ └── PreferenceSwitch.kt │ ├── theme │ ├── PreferenceDimen.kt │ ├── PreferenceStyle.kt │ ├── PreferenceTextStyle.kt │ └── Preferences.kt │ └── ui │ ├── Color.kt │ ├── ComposeSwitch.kt │ ├── Exts.kt │ ├── ImageParser.kt │ ├── PreferenceLayout.kt │ ├── RippleClickable.kt │ └── icons │ ├── ArrowDropDown.kt │ ├── ArrowDropUp.kt │ ├── Check.kt │ └── EmptyIcon.kt ├── preference-util ├── .gitignore ├── build.gradle.kts ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── kiylx │ └── libx │ └── pref_component │ └── preference_util │ ├── OldPreferenceHolder.kt │ ├── PrefsUtil.kt │ ├── SPEditor.kt │ └── delegate │ └── Prefs.kt └── settings.gradle.kts /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | *.iml 3 | .gradle 4 | /local.properties 5 | /.idea/caches 6 | /.idea/libraries 7 | /.idea/modules.xml 8 | /.idea/workspace.xml 9 | /.idea/navEditor.xml 10 | /.idea/assetWizardSettings.xml 11 | .DS_Store 12 | /build 13 | /captures 14 | .externalNativeBuild 15 | .cxx 16 | local.properties 17 | ### Android template 18 | # Built application files 19 | *.apk 20 | *.aar 21 | *.ap_ 22 | *.aab 23 | 24 | # Files for the ART/Dalvik VM 25 | *.dex 26 | 27 | # Java class files 28 | *.class 29 | 30 | # Generated files 31 | bin/ 32 | gen/ 33 | out/ 34 | # Uncomment the following line in case you need and you don't have the release build type files in your app 35 | # release/ 36 | 37 | # Gradle files 38 | .gradle/ 39 | build/ 40 | 41 | # Local configuration file (sdk path, etc) 42 | local.properties 43 | 44 | # Proguard folder generated by Eclipse 45 | proguard/ 46 | 47 | # Log Files 48 | *.log 49 | 50 | # Android Studio Navigation editor temp files 51 | .navigation/ 52 | 53 | # Android Studio captures folder 54 | captures/ 55 | 56 | # IntelliJ 57 | *.iml 58 | .idea/ 59 | .idea/workspace.xml 60 | .idea/tasks.xml 61 | .idea/gradle.xml 62 | .idea/assetWizardSettings.xml 63 | .idea/dictionaries 64 | .idea/libraries 65 | # Android Studio 3 in .gitignore file. 66 | .idea/caches 67 | .idea/modules.xml 68 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you 69 | .idea/navEditor.xml 70 | 71 | # Keystore files 72 | # Uncomment the following lines if you do not want to check your keystore files in. 73 | #*.jks 74 | #*.keystore 75 | 76 | # External native build folder generated in Android Studio 2.2 and later 77 | .externalNativeBuild 78 | .cxx/ 79 | 80 | # Google Services (e.g. APIs or Firebase) 81 | # google-services.json 82 | 83 | # Freeline 84 | freeline.py 85 | freeline/ 86 | freeline_project_description.json 87 | 88 | # fastlane 89 | fastlane/report.xml 90 | fastlane/Preview.html 91 | fastlane/screenshots 92 | fastlane/test_output 93 | fastlane/readme.md 94 | 95 | # Version control 96 | vcs.xml 97 | 98 | # lint 99 | lint/intermediates/ 100 | lint/generated/ 101 | lint/outputs/ 102 | lint/tmp/ 103 | # lint/reports/ 104 | 105 | # Android Profiling 106 | *.hprof 107 | 108 | -------------------------------------------------------------------------------- /README.assets/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Knightwood/ComposePreference/a39ef350056eacdea1a49faf1c7f39b4f8a77f08/README.assets/1.jpg -------------------------------------------------------------------------------- /README.assets/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Knightwood/ComposePreference/a39ef350056eacdea1a49faf1c7f39b4f8a77f08/README.assets/2.jpg -------------------------------------------------------------------------------- /README.assets/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Knightwood/ComposePreference/a39ef350056eacdea1a49faf1c7f39b4f8a77f08/README.assets/3.jpg -------------------------------------------------------------------------------- /README.assets/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Knightwood/ComposePreference/a39ef350056eacdea1a49faf1c7f39b4f8a77f08/README.assets/5.jpg -------------------------------------------------------------------------------- /README.assets/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Knightwood/ComposePreference/a39ef350056eacdea1a49faf1c7f39b4f8a77f08/README.assets/6.jpg -------------------------------------------------------------------------------- /README.assets/Screenrecorder-2023-11-03-20-20-52-372.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Knightwood/ComposePreference/a39ef350056eacdea1a49faf1c7f39b4f8a77f08/README.assets/Screenrecorder-2023-11-03-20-20-52-372.gif -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | @Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed 2 | plugins { 3 | alias(libs.plugins.android.application) 4 | alias(libs.plugins.kotlin.android) 5 | id("org.jetbrains.kotlin.plugin.compose") 6 | } 7 | 8 | android { 9 | namespace = "com.kiylx.composepreference" 10 | compileSdk = 34 11 | 12 | defaultConfig { 13 | applicationId = "com.kiylx.composepreference" 14 | minSdk = 26 15 | targetSdk = 34 16 | versionCode = 1 17 | versionName = "1.0" 18 | 19 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" 20 | vectorDrawables { 21 | useSupportLibrary = true 22 | } 23 | } 24 | 25 | buildTypes { 26 | debug { 27 | applicationIdSuffix = ".debug" 28 | isMinifyEnabled = false 29 | isShrinkResources = false 30 | } 31 | release { 32 | applicationIdSuffix = ".r1" 33 | isMinifyEnabled = true 34 | isShrinkResources = true 35 | proguardFiles( 36 | getDefaultProguardFile("proguard-android-optimize.txt"), 37 | "proguard-rules.pro" 38 | ) 39 | } 40 | } 41 | compileOptions { 42 | sourceCompatibility = JavaVersion.VERSION_17 43 | targetCompatibility = JavaVersion.VERSION_17 44 | } 45 | kotlinOptions { 46 | jvmTarget = "17" 47 | } 48 | buildFeatures { 49 | compose = true 50 | } 51 | 52 | packagingOptions { 53 | resources { 54 | excludes += "/META-INF/{AL2.0,LGPL2.1}" 55 | excludes += "META-INF/versions/9/previous-compilation-data.bin" 56 | } 57 | } 58 | } 59 | 60 | dependencies { 61 | implementation(libs.bundles.bundleAndroidx) 62 | implementation(libs.bundles.kotlins) 63 | 64 | val composeBom = platform(composeLibs.androidx.compose.bom) 65 | implementation(composeBom) 66 | androidTestImplementation(composeBom) 67 | implementation(composeLibs.androidx.compose.material3) 68 | 69 | implementation("androidx.compose.ui:ui-tooling-preview") 70 | debugImplementation("androidx.compose.ui:ui-tooling") 71 | debugImplementation("androidx.compose.ui:ui-test-manifest") 72 | //icons 73 | implementation("androidx.compose.material:material-icons-extended") 74 | // Optional - Add window size utils 75 | implementation("androidx.compose.material3:material3-window-size-class") 76 | // Optional - Integration with activities 77 | implementation(composeLibs.androidx.activity.compose) 78 | // Optional - Integration with ViewModels 79 | implementation(composeLibs.androidx.lifecycle.viewmodel.compose) 80 | // Optional - Integration with LiveData 81 | implementation("androidx.compose.runtime:runtime-livedata") 82 | implementation(composeLibs.google.accompanist.systemUiController) 83 | 84 | //datastore 85 | implementation(libs.androidx.datastore.preferences) { 86 | exclude("org.jetbrains.kotlinx","kotlinx-coroutines-core") 87 | } 88 | 89 | implementation(libs.github.mmkv) 90 | 91 | //lib 92 | implementation(project(":preference-ui-compose")) 93 | implementation(project(":preference-data-core")) 94 | implementation(project(":preference-mmkv-util")) 95 | implementation(project(":preference-util")) 96 | implementation(project(":datastore-util")) 97 | 98 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 16 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/kiylx/composepreference/AppCtx.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 [KnightWood] 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 | 18 | package com.kiylx.composepreference 19 | 20 | import android.app.Application 21 | import com.tencent.mmkv.MMKV 22 | import kotlinx.coroutines.CoroutineName 23 | import kotlinx.coroutines.CoroutineScope 24 | import kotlinx.coroutines.Dispatchers 25 | import kotlinx.coroutines.SupervisorJob 26 | import kotlinx.coroutines.plus 27 | 28 | 29 | class AppCtx : Application() { 30 | 31 | override fun onCreate() { 32 | super.onCreate() 33 | instance = this 34 | scope = CoroutineScope(Dispatchers.IO) + SupervisorJob() + CoroutineName("GLOAB") 35 | //mmkv初始化 36 | MMKV.initialize(this) 37 | } 38 | 39 | companion object { 40 | lateinit var instance: AppCtx 41 | lateinit var scope: CoroutineScope 42 | } 43 | } -------------------------------------------------------------------------------- /app/src/main/java/com/kiylx/composepreference/testcompose/MainActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 [KnightWood] 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 | 18 | package com.kiylx.composepreference.testcompose 19 | 20 | import android.os.Bundle 21 | import androidx.activity.compose.setContent 22 | import androidx.appcompat.app.AppCompatActivity 23 | import androidx.compose.foundation.background 24 | import androidx.compose.foundation.isSystemInDarkTheme 25 | import androidx.compose.foundation.layout.fillMaxSize 26 | import androidx.compose.foundation.layout.padding 27 | import androidx.compose.material.icons.Icons 28 | import androidx.compose.material.icons.filled.ExposurePlus1 29 | import androidx.compose.material.icons.filled.ExposurePlus2 30 | import androidx.compose.material3.Icon 31 | import androidx.compose.material3.MaterialTheme 32 | import androidx.compose.material3.NavigationBar 33 | import androidx.compose.material3.NavigationBarItem 34 | import androidx.compose.material3.Scaffold 35 | import androidx.compose.material3.Surface 36 | import androidx.compose.material3.Text 37 | import androidx.compose.runtime.Composable 38 | import androidx.compose.runtime.CompositionLocalProvider 39 | import androidx.compose.runtime.SideEffect 40 | import androidx.compose.runtime.collectAsState 41 | import androidx.compose.runtime.compositionLocalOf 42 | import androidx.compose.runtime.getValue 43 | import androidx.compose.runtime.mutableStateOf 44 | import androidx.compose.runtime.remember 45 | import androidx.compose.runtime.setValue 46 | import androidx.compose.ui.Modifier 47 | import androidx.compose.ui.graphics.Color 48 | import androidx.core.view.WindowCompat 49 | import com.google.accompanist.systemuicontroller.rememberSystemUiController 50 | import com.kiylx.composepreference.ui.theme.ComposeTestTheme 51 | import kotlinx.coroutines.flow.MutableStateFlow 52 | 53 | var isDarkFlow: MutableStateFlow = MutableStateFlow(false) 54 | var LocalTheme = compositionLocalOf { false } 55 | 56 | class MainActivity : AppCompatActivity() { 57 | val TAG = "MainActivity" 58 | 59 | @Composable 60 | fun TransparentSystemBars() { 61 | WindowCompat.setDecorFitsSystemWindows(window, false) 62 | val systemUiController = rememberSystemUiController() 63 | val useDarkIcons = !isSystemInDarkTheme() 64 | SideEffect { 65 | systemUiController.setSystemBarsColor( 66 | color = Color.Transparent, 67 | darkIcons = useDarkIcons, 68 | isNavigationBarContrastEnforced = false, 69 | ) 70 | } 71 | } 72 | 73 | override fun onCreate(savedInstanceState: Bundle?) { 74 | super.onCreate(savedInstanceState) 75 | setContent { 76 | var selected by remember { 77 | mutableStateOf(1) 78 | } 79 | val isD = isDarkFlow.collectAsState() 80 | CompositionLocalProvider(LocalTheme provides isD.value) { 81 | ComposeTestTheme( 82 | darkTheme = LocalTheme.current 83 | ) { 84 | TransparentSystemBars() 85 | Scaffold(bottomBar = { 86 | NavigationBar { 87 | NavigationBarItem( 88 | selected = selected == 0, 89 | onClick = { selected = 0 }, 90 | icon = { 91 | Icon( 92 | imageVector = Icons.Default.ExposurePlus1, 93 | contentDescription = "one" 94 | ) 95 | }, 96 | label = { Text("First") }) 97 | 98 | NavigationBarItem( 99 | selected = selected == 1, 100 | onClick = { selected = 1 }, 101 | icon = { 102 | Icon( 103 | imageVector = Icons.Default.ExposurePlus2, 104 | contentDescription = "two" 105 | ) 106 | }, 107 | label = { Text("Second") }) 108 | } 109 | }) { 110 | Surface( 111 | modifier = Modifier 112 | .fillMaxSize() 113 | .background(MaterialTheme.colorScheme.background) 114 | .padding(it) 115 | //同时添加状态栏和导航栏高度对应的上下 padding 116 | ) { 117 | if (selected == 0) { 118 | NewComponents() 119 | } else { 120 | NewComponents2(this) 121 | } 122 | } 123 | } 124 | 125 | } 126 | } 127 | 128 | } 129 | } 130 | } -------------------------------------------------------------------------------- /app/src/main/java/com/kiylx/composepreference/testcompose/NewComponents.kt: -------------------------------------------------------------------------------- 1 | package com.kiylx.composepreference.testcompose 2 | 3 | import androidx.compose.foundation.layout.Arrangement 4 | import androidx.compose.foundation.layout.Column 5 | import androidx.compose.foundation.layout.PaddingValues 6 | import androidx.compose.foundation.layout.padding 7 | import androidx.compose.foundation.rememberScrollState 8 | import androidx.compose.foundation.verticalScroll 9 | import androidx.compose.material.icons.Icons 10 | import androidx.compose.material.icons.outlined.AccountCircle 11 | import androidx.compose.material.icons.outlined.CloudSync 12 | import androidx.compose.material.icons.outlined.Language 13 | import androidx.compose.material.icons.outlined.LocalDining 14 | import androidx.compose.material.icons.outlined.Palette 15 | import androidx.compose.material.icons.outlined.TipsAndUpdates 16 | import androidx.compose.material.icons.outlined.TouchApp 17 | import androidx.compose.material3.MaterialTheme 18 | import androidx.compose.runtime.Composable 19 | import androidx.compose.runtime.getValue 20 | import androidx.compose.runtime.mutableStateOf 21 | import androidx.compose.runtime.remember 22 | import androidx.compose.runtime.setValue 23 | import androidx.compose.ui.Modifier 24 | import androidx.compose.ui.unit.dp 25 | import com.kiylx.compose.preference.component.cross.PreferenceCheckBox 26 | import com.kiylx.compose.preference.component.cross.PreferenceCollapseItem 27 | import com.kiylx.compose.preference.component.cross.PreferenceItem 28 | import com.kiylx.compose.preference.component.cross.PreferenceRadio 29 | import com.kiylx.compose.preference.component.cross.PreferenceSlider 30 | import com.kiylx.compose.preference.component.cross.PreferenceSubTitle 31 | import com.kiylx.compose.preference.component.cross.PreferenceSwitch 32 | import com.kiylx.compose.preference.component.cross.PreferenceSwitchWithContainer 33 | import com.kiylx.compose.preference.component.cross.PreferenceWithDividerSwitch 34 | import com.kiylx.compose.preference.component.cross.PreferencesCautionCard 35 | import com.kiylx.compose.preference.theme.PreferenceIconStyle 36 | import com.kiylx.compose.preference.theme.Preferences 37 | 38 | @Composable 39 | fun NewComponents() { 40 | Column( 41 | modifier = Modifier 42 | .verticalScroll(rememberScrollState()), 43 | verticalArrangement = Arrangement.spacedBy(4.dp) 44 | ) { 45 | Preferences.SetTheme( 46 | // boxStyle = defaultPreferenceBoxStyle.copy( 47 | // color = MaterialTheme.colorScheme.secondaryContainer 48 | // ), 49 | iconStyle = PreferenceIconStyle( 50 | paddingValues = PaddingValues(8.dp), 51 | tint = MaterialTheme.colorScheme.onPrimary, 52 | backgroundColor = MaterialTheme.colorScheme.primary, 53 | ) 54 | ) { 55 | PreferenceItemTest() 56 | PreferenceSubTitle( 57 | modifier = Modifier.padding(top = 8.dp), 58 | title = "其他" 59 | ) 60 | var progress by remember { 61 | mutableStateOf(0f) 62 | } 63 | PreferenceSlider( 64 | value = progress, 65 | desc = "滑动条描述", 66 | onValueChanged = { progress = it }) 67 | SwitchTest() 68 | PreferenceSubTitle(title = "多选框", modifier = Modifier) 69 | CheckBoxTest() 70 | PreferenceSubTitle(title = "单选框", modifier = Modifier) 71 | RadioTest() 72 | PreferenceSubTitle(title = "折叠", modifier = Modifier) 73 | var expand by remember { mutableStateOf(false) } 74 | PreferenceCollapseItem( 75 | expand = expand, 76 | title = "附加内容", 77 | stateChanged = { expand = !expand }) 78 | { 79 | Preferences.SetTheme { 80 | Column(modifier = Modifier.padding(top = 12.dp, start = 12.dp, end = 12.dp)) { 81 | PreferenceItemTest() 82 | } 83 | } 84 | } 85 | } 86 | } 87 | } 88 | 89 | @Composable 90 | private fun PreferenceItemTest() { 91 | PreferencesCautionCard( 92 | title = "调整您的设置信息", 93 | desc = "账户、翻译、帮助信息等", 94 | icon = Icons.Outlined.AccountCircle, 95 | ) 96 | PreferenceItem( 97 | modifier = Modifier, 98 | title = "账户", 99 | // icon = Icons.Outlined.AccountCircle, 100 | // desc = "本地、谷歌", 101 | ) 102 | PreferenceItem( 103 | title = "颜色和样式", 104 | icon = Icons.Outlined.Palette, 105 | desc = "主题、色调样式、字体", 106 | ) 107 | PreferenceItem( 108 | title = "动画", 109 | icon = Icons.Outlined.TouchApp, 110 | desc = "动画反馈、触感反馈", 111 | ) 112 | PreferenceItem( 113 | title = "语言", 114 | desc = "中文(zh)", 115 | icon = Icons.Outlined.Language, 116 | ) 117 | PreferenceItem( 118 | enabled = false, 119 | title = "关于", 120 | desc = "开源信息、版权", 121 | icon = Icons.Outlined.TipsAndUpdates, 122 | ) 123 | } 124 | 125 | @Composable 126 | private fun SwitchTest() { 127 | var checked by remember { mutableStateOf(false) } 128 | PreferenceWithDividerSwitch( 129 | icon = Icons.Outlined.CloudSync, 130 | isChecked = checked, 131 | title = "同步", 132 | desc = "同步您的账户数据" 133 | ) { 134 | checked = it 135 | } 136 | 137 | var checked2 by remember { mutableStateOf(false) } 138 | PreferenceSwitch( 139 | icon = Icons.Outlined.LocalDining, 140 | isChecked = checked2, 141 | title = "餐馆", 142 | desc = "查找附近的餐馆" 143 | ) { 144 | checked2 = it 145 | } 146 | 147 | PreferenceSwitchWithContainer( 148 | title = "调整您的设置信息", 149 | desc = "账户、翻译、帮助信息等", 150 | isChecked = checked2, 151 | icon = Icons.Outlined.AccountCircle, 152 | ) { 153 | checked2 = it 154 | } 155 | 156 | } 157 | 158 | @Composable 159 | private fun RadioTest() { 160 | 161 | var selected by remember { 162 | mutableStateOf(1) 163 | } 164 | PreferenceRadio( 165 | title = "激活背包", 166 | selected = selected == 1, 167 | desc = "使用更大的背包", 168 | ) { 169 | if (it) selected = 1 170 | } 171 | PreferenceRadio( 172 | title = "天空材质", 173 | selected = selected == 2, 174 | desc = "使用更精美的天空材质贴图", 175 | ) { 176 | if (it) selected = 2 177 | 178 | } 179 | 180 | PreferenceRadio( 181 | title = "非官方修复补丁", 182 | selected = selected == 3, 183 | desc = "可能会带来新的bug", 184 | ) { 185 | if (it) selected = 3 186 | 187 | } 188 | } 189 | 190 | @Composable 191 | private fun CheckBoxTest() { 192 | var check1 by remember { 193 | mutableStateOf(false) 194 | } 195 | PreferenceCheckBox( 196 | title = "激活背包", 197 | checked = check1, 198 | desc = "使用更大的背包", 199 | ) { 200 | check1 = it 201 | } 202 | 203 | var check2 by remember { 204 | mutableStateOf(false) 205 | } 206 | PreferenceCheckBox( 207 | title = "天空材质", 208 | checked = check2, 209 | desc = "使用更精美的天空材质贴图", 210 | ) { 211 | check2 = it 212 | } 213 | 214 | var check3 by remember { 215 | mutableStateOf(false) 216 | } 217 | PreferenceCheckBox( 218 | title = "非官方修复补丁", 219 | checked = check3, 220 | desc = "可能会带来新的bug", 221 | ) { 222 | check3 = it 223 | } 224 | } -------------------------------------------------------------------------------- /app/src/main/java/com/kiylx/composepreference/testcompose/NewComponents2.kt: -------------------------------------------------------------------------------- 1 | package com.kiylx.composepreference.testcompose 2 | 3 | import android.content.Context 4 | import androidx.compose.foundation.layout.Arrangement 5 | import androidx.compose.foundation.layout.Column 6 | import androidx.compose.foundation.layout.PaddingValues 7 | import androidx.compose.foundation.layout.padding 8 | import androidx.compose.foundation.rememberScrollState 9 | import androidx.compose.foundation.shape.RoundedCornerShape 10 | import androidx.compose.foundation.verticalScroll 11 | import androidx.compose.material.icons.Icons 12 | import androidx.compose.material.icons.outlined.AccountCircle 13 | import androidx.compose.material.icons.outlined.Language 14 | import androidx.compose.material.icons.outlined.TouchApp 15 | import androidx.compose.material3.MaterialTheme 16 | import androidx.compose.runtime.Composable 17 | import androidx.compose.runtime.getValue 18 | import androidx.compose.runtime.mutableStateOf 19 | import androidx.compose.runtime.remember 20 | import androidx.compose.runtime.rememberCoroutineScope 21 | import androidx.compose.runtime.setValue 22 | import androidx.compose.ui.Modifier 23 | import androidx.compose.ui.unit.dp 24 | import androidx.datastore.dataStoreFile 25 | import com.kiylx.compose.preference.component.auto.PreferenceCollapseItem 26 | import com.kiylx.compose.preference.component.auto.PreferenceItem 27 | import com.kiylx.compose.preference.component.auto.PreferenceSwitch 28 | import com.kiylx.compose.preference.component.auto.PreferenceSwitchWithContainer 29 | import com.kiylx.compose.preference.component.auto.PreferencesCautionCard 30 | import com.kiylx.compose.preference.component.auto.SetTheme 31 | import com.kiylx.compose.preference.component.cross.PreferenceItem 32 | import com.kiylx.compose.preference.component.cross.PreferencesHintCard 33 | import com.kiylx.compose.preference.theme.PreferenceDimen 34 | import com.kiylx.compose.preference.theme.PreferenceIconStyle 35 | import com.kiylx.compose.preference.theme.Preferences 36 | import com.kiylx.compose.preference.theme.defaultPreferenceBoxStyle 37 | import com.kiylx.composepreference.AppCtx 38 | import com.kiylx.libx.pref_component.core.DependenceNode 39 | import com.kiylx.libx.pref_component.datastore_util.DataStorePreferenceHolder 40 | import com.kiylx.libx.pref_component.datastore_util.getDataStore 41 | import getting 42 | import gettingNullable 43 | import kotlinx.coroutines.GlobalScope 44 | import kotlinx.coroutines.launch 45 | 46 | @Composable 47 | fun NewComponents2(ctx: Context) { 48 | //1. 使用dataStore存储偏好值 49 | val holder = remember { 50 | val ds = getDataStore(ctx, "test.pb") 51 | DataStorePreferenceHolder.instance(ds) 52 | } 53 | 54 | //2. 使用mmkv存储偏好值 55 | // val holder = remember { 56 | // MMKVPreferenceHolder.instance(MMKV.defaultMMKV()) 57 | // } 58 | //3. 使用sharedprefrence存储偏好值 59 | // val holder = remember { 60 | // OldPreferenceHolder.instance( 61 | // AppCtx.instance.getSharedPreferences( 62 | // "ddd", 63 | // Context.MODE_PRIVATE 64 | // ) 65 | // ) 66 | // } 67 | val customNodeName = "customNode" 68 | //创建一个自定义节点 69 | val node = holder.registerDependence(customNodeName, true) 70 | val scope = rememberCoroutineScope() 71 | 72 | Column( 73 | modifier = Modifier 74 | .verticalScroll(rememberScrollState()), 75 | verticalArrangement = Arrangement.spacedBy(4.dp) 76 | ) { 77 | Preferences.SetTheme( 78 | holder = holder, 79 | iconStyle = PreferenceIconStyle( 80 | paddingValues = PaddingValues(8.dp), 81 | tint = MaterialTheme.colorScheme.onPrimary, 82 | backgroundColor = MaterialTheme.colorScheme.primary, 83 | ) 84 | ) { 85 | 86 | Column { 87 | PreferencesHintCard( 88 | title = "调整您的设置信息", 89 | desc = "账户、翻译、帮助信息等", 90 | ) 91 | 92 | PreferenceSwitch( 93 | defaultValue = false, 94 | title = "使用新特性", 95 | desc = "实验功能,可能不稳定", 96 | dependenceKey = DependenceNode.rootName, 97 | keyName = "s1" 98 | ) { state -> 99 | //这里获取并修改了当前的enable状态, 100 | //依赖这个节点的会改变显示状态, 101 | //如果当前没有指定依赖,自身也会受到影响 102 | scope.launch { 103 | holder.getDependence("s1")?.setEnabled(state) 104 | } 105 | } 106 | PreferenceItem( 107 | dependenceKey = "s1", 108 | title = "关联组件", 109 | icon = Icons.Outlined.AccountCircle 110 | ) 111 | 112 | PreferenceSwitchWithContainer( 113 | title = "调整您的设置信息", 114 | desc = "账户、翻译、帮助信息等", 115 | defaultValue = false, 116 | keyName = "b2", 117 | dependenceKey = DependenceNode.rootName, 118 | icon = Icons.Outlined.AccountCircle, 119 | ) { 120 | scope.launch { 121 | node.setEnabled(it) 122 | } 123 | } 124 | PreferenceItem( 125 | modifier = Modifier, 126 | title = "账户", 127 | icon = Icons.Outlined.AccountCircle, 128 | dependenceKey = customNodeName, 129 | desc = "本地、谷歌", 130 | ) 131 | var expand by remember { mutableStateOf(false) } 132 | PreferenceCollapseItem( 133 | expand = expand, 134 | title = "附加内容", 135 | dependenceKey = customNodeName, 136 | stateChanged = { expand = !expand }) 137 | { 138 | Column(modifier = Modifier.padding(horizontal = 16.dp)) { 139 | PreferenceItem( 140 | title = "动画", 141 | icon = Icons.Outlined.TouchApp, 142 | desc = "动画反馈、触感反馈", 143 | ) 144 | PreferenceItem( 145 | title = "语言", 146 | desc = "中文(zh)", 147 | icon = Icons.Outlined.Language, 148 | ) 149 | } 150 | } 151 | PreferencesCautionCard( 152 | title = "调整您的设置信息", 153 | desc = "账户、翻译、帮助信息等", 154 | dependenceKey = customNodeName, 155 | icon = Icons.Outlined.AccountCircle, 156 | ) 157 | 158 | } 159 | } 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /app/src/main/java/com/kiylx/composepreference/ui/theme/Color.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 [KnightWood] 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 | 18 | package com.kiylx.composepreference.ui.theme 19 | import androidx.compose.ui.graphics.Color 20 | 21 | 22 | val md_theme_light_primary = Color(0xFF6750A4) 23 | val md_theme_light_onPrimary = Color(0xFFFFFFFF) 24 | val md_theme_light_primaryContainer = Color(0xFFEADDFF) 25 | val md_theme_light_onPrimaryContainer = Color(0xFF21005D) 26 | val md_theme_light_secondary = Color(0xFF625B71) 27 | val md_theme_light_onSecondary = Color(0xFFFFFFFF) 28 | val md_theme_light_secondaryContainer = Color(0xFFE8DEF8) 29 | val md_theme_light_onSecondaryContainer = Color(0xFF1D192B) 30 | val md_theme_light_tertiary = Color(0xFF7D5260) 31 | val md_theme_light_onTertiary = Color(0xFFFFFFFF) 32 | val md_theme_light_tertiaryContainer = Color(0xFFFFD8E4) 33 | val md_theme_light_onTertiaryContainer = Color(0xFF31111D) 34 | val md_theme_light_error = Color(0xFFB3261E) 35 | val md_theme_light_onError = Color(0xFFFFFFFF) 36 | val md_theme_light_errorContainer = Color(0xFFF9DEDC) 37 | val md_theme_light_onErrorContainer = Color(0xFF410E0B) 38 | val md_theme_light_outline = Color(0xFF79747E) 39 | val md_theme_light_background = Color(0xFFFFFBFE) 40 | val md_theme_light_onBackground = Color(0xFF1C1B1F) 41 | val md_theme_light_surface = Color(0xFFFFFBFE) 42 | val md_theme_light_onSurface = Color(0xFF1C1B1F) 43 | val md_theme_light_surfaceVariant = Color(0xFFE7E0EC) 44 | val md_theme_light_onSurfaceVariant = Color(0xFF49454F) 45 | val md_theme_light_inverseSurface = Color(0xFF313033) 46 | val md_theme_light_inverseOnSurface = Color(0xFFF4EFF4) 47 | val md_theme_light_inversePrimary = Color(0xFFD0BCFF) 48 | val md_theme_light_shadow = Color(0xFF000000) 49 | val md_theme_light_surfaceTint = Color(0xFF6750A4) 50 | val md_theme_light_outlineVariant = Color(0xFFCAC4D0) 51 | val md_theme_light_scrim = Color(0xFF000000) 52 | 53 | val md_theme_dark_primary = Color(0xFFD0BCFF) 54 | val md_theme_dark_onPrimary = Color(0xFF381E72) 55 | val md_theme_dark_primaryContainer = Color(0xFF4F378B) 56 | val md_theme_dark_onPrimaryContainer = Color(0xFFEADDFF) 57 | val md_theme_dark_secondary = Color(0xFFCCC2DC) 58 | val md_theme_dark_onSecondary = Color(0xFF332D41) 59 | val md_theme_dark_secondaryContainer = Color(0xFF4A4458) 60 | val md_theme_dark_onSecondaryContainer = Color(0xFFE8DEF8) 61 | val md_theme_dark_tertiary = Color(0xFFEFB8C8) 62 | val md_theme_dark_onTertiary = Color(0xFF492532) 63 | val md_theme_dark_tertiaryContainer = Color(0xFF633B48) 64 | val md_theme_dark_onTertiaryContainer = Color(0xFFFFD8E4) 65 | val md_theme_dark_error = Color(0xFFF2B8B5) 66 | val md_theme_dark_onError = Color(0xFF601410) 67 | val md_theme_dark_errorContainer = Color(0xFF8C1D18) 68 | val md_theme_dark_onErrorContainer = Color(0xFFF9DEDC) 69 | val md_theme_dark_outline = Color(0xFF938F99) 70 | val md_theme_dark_background = Color(0xFF1C1B1F) 71 | val md_theme_dark_onBackground = Color(0xFFE6E1E5) 72 | val md_theme_dark_surface = Color(0xFF1C1B1F) 73 | val md_theme_dark_onSurface = Color(0xFFE6E1E5) 74 | val md_theme_dark_surfaceVariant = Color(0xFF49454F) 75 | val md_theme_dark_onSurfaceVariant = Color(0xFFCAC4D0) 76 | val md_theme_dark_inverseSurface = Color(0xFFE6E1E5) 77 | val md_theme_dark_inverseOnSurface = Color(0xFF313033) 78 | val md_theme_dark_inversePrimary = Color(0xFF6750A4) 79 | val md_theme_dark_shadow = Color(0xFF000000) 80 | val md_theme_dark_surfaceTint = Color(0xFFD0BCFF) 81 | val md_theme_dark_outlineVariant = Color(0xFF49454F) 82 | val md_theme_dark_scrim = Color(0xFF000000) 83 | 84 | val seed = Color(0xFF6750A4) 85 | 86 | val pink = Color(0xFFA2B2ED) 87 | val light_pink = Color(0xFF405AA9) 88 | val light_onpink = Color(0xFFFFFFFF) 89 | val light_pinkContainer = Color(0xFFDBE1FF) 90 | val light_onpinkContainer = Color(0xFF00164D) 91 | val dark_pink = Color(0xFFB5C4FF) 92 | val dark_onpink = Color(0xFF042978) 93 | val dark_pinkContainer = Color(0xFF254190) 94 | val dark_onpinkContainer = Color(0xFFDBE1FF) 95 | 96 | val gray =Color(0xFFAAA8AD) 97 | -------------------------------------------------------------------------------- /app/src/main/java/com/kiylx/composepreference/ui/theme/DefaultColorScheme.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 [KnightWood] 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 | 18 | package com.kiylx.composepreference.ui.theme 19 | 20 | import androidx.compose.material3.darkColorScheme 21 | import androidx.compose.material3.lightColorScheme 22 | 23 | object DefaultColorScheme{ 24 | val LightColorScheme = lightColorScheme( 25 | primary = md_theme_light_primary, 26 | onPrimary = md_theme_light_onPrimary, 27 | primaryContainer = md_theme_light_primaryContainer, 28 | onPrimaryContainer = md_theme_light_onPrimaryContainer, 29 | secondary = md_theme_light_secondary, 30 | onSecondary = md_theme_light_onSecondary, 31 | secondaryContainer = md_theme_light_secondaryContainer, 32 | onSecondaryContainer = md_theme_light_onSecondaryContainer, 33 | tertiary = md_theme_light_tertiary, 34 | onTertiary = md_theme_light_onTertiary, 35 | tertiaryContainer = md_theme_light_tertiaryContainer, 36 | onTertiaryContainer = md_theme_light_onTertiaryContainer, 37 | error = md_theme_light_error, 38 | errorContainer = md_theme_light_errorContainer, 39 | onError = md_theme_light_onError, 40 | onErrorContainer = md_theme_light_onErrorContainer, 41 | background = md_theme_light_background, 42 | onBackground = md_theme_light_onBackground, 43 | surface = md_theme_light_surface, 44 | onSurface = md_theme_light_onSurface, 45 | surfaceVariant = md_theme_light_surfaceVariant, 46 | onSurfaceVariant = md_theme_light_onSurfaceVariant, 47 | outline = md_theme_light_outline, 48 | inverseOnSurface = md_theme_light_inverseOnSurface, 49 | inverseSurface = md_theme_light_inverseSurface, 50 | inversePrimary = md_theme_light_inversePrimary, 51 | surfaceTint = md_theme_light_surfaceTint, 52 | outlineVariant = md_theme_light_outlineVariant, 53 | scrim = md_theme_light_scrim, 54 | ) 55 | 56 | 57 | val DarkColorScheme = darkColorScheme( 58 | primary = md_theme_dark_primary, 59 | onPrimary = md_theme_dark_onPrimary, 60 | primaryContainer = md_theme_dark_primaryContainer, 61 | onPrimaryContainer = md_theme_dark_onPrimaryContainer, 62 | secondary = md_theme_dark_secondary, 63 | onSecondary = md_theme_dark_onSecondary, 64 | secondaryContainer = md_theme_dark_secondaryContainer, 65 | onSecondaryContainer = md_theme_dark_onSecondaryContainer, 66 | tertiary = md_theme_dark_tertiary, 67 | onTertiary = md_theme_dark_onTertiary, 68 | tertiaryContainer = md_theme_dark_tertiaryContainer, 69 | onTertiaryContainer = md_theme_dark_onTertiaryContainer, 70 | error = md_theme_dark_error, 71 | errorContainer = md_theme_dark_errorContainer, 72 | onError = md_theme_dark_onError, 73 | onErrorContainer = md_theme_dark_onErrorContainer, 74 | background = md_theme_dark_background, 75 | onBackground = md_theme_dark_onBackground, 76 | surface = md_theme_dark_surface, 77 | onSurface = md_theme_dark_onSurface, 78 | surfaceVariant = md_theme_dark_surfaceVariant, 79 | onSurfaceVariant = md_theme_dark_onSurfaceVariant, 80 | outline = md_theme_dark_outline, 81 | inverseOnSurface = md_theme_dark_inverseOnSurface, 82 | inverseSurface = md_theme_dark_inverseSurface, 83 | inversePrimary = md_theme_dark_inversePrimary, 84 | surfaceTint = md_theme_dark_surfaceTint, 85 | outlineVariant = md_theme_dark_outlineVariant, 86 | scrim = md_theme_dark_scrim, 87 | ) 88 | } -------------------------------------------------------------------------------- /app/src/main/java/com/kiylx/composepreference/ui/theme/Theme.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 [KnightWood] 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 | 18 | package com.kiylx.composepreference.ui.theme 19 | 20 | import android.app.Activity 21 | import android.os.Build 22 | import androidx.compose.foundation.isSystemInDarkTheme 23 | import androidx.compose.material3.MaterialTheme 24 | import androidx.compose.material3.dynamicDarkColorScheme 25 | import androidx.compose.material3.dynamicLightColorScheme 26 | import androidx.compose.runtime.Composable 27 | import androidx.compose.runtime.SideEffect 28 | import androidx.compose.ui.graphics.toArgb 29 | import androidx.compose.ui.platform.LocalContext 30 | import androidx.compose.ui.platform.LocalView 31 | import androidx.core.view.WindowCompat 32 | import com.kiylx.composepreference.ui.theme.DefaultColorScheme.DarkColorScheme 33 | import com.kiylx.composepreference.ui.theme.DefaultColorScheme.LightColorScheme 34 | 35 | 36 | @Composable 37 | fun ComposeTestTheme( 38 | darkTheme: Boolean = isSystemInDarkTheme(), 39 | // Dynamic color is available on Android 12+ 40 | dynamicColor: Boolean = true, 41 | content: @Composable () -> Unit 42 | ) { 43 | val colorScheme = when { 44 | dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { 45 | val context = LocalContext.current 46 | if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) 47 | } 48 | 49 | darkTheme -> DarkColorScheme 50 | else -> LightColorScheme 51 | } 52 | val view = LocalView.current 53 | if (!view.isInEditMode) { 54 | SideEffect { 55 | val window = (view.context as Activity).window 56 | window.statusBarColor = colorScheme.primary.toArgb() 57 | WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme 58 | } 59 | } 60 | 61 | MaterialTheme( 62 | colorScheme = colorScheme, 63 | typography = Typography, 64 | content = content 65 | ) 66 | } -------------------------------------------------------------------------------- /app/src/main/java/com/kiylx/composepreference/ui/theme/Type.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 [KnightWood] 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 | 18 | package com.kiylx.composepreference.ui.theme 19 | 20 | import androidx.compose.material3.Typography 21 | import androidx.compose.ui.text.TextStyle 22 | import androidx.compose.ui.text.font.FontFamily 23 | import androidx.compose.ui.text.font.FontWeight 24 | import androidx.compose.ui.unit.sp 25 | 26 | // Set of Material typography styles to start with 27 | val Typography = Typography( 28 | bodyLarge = TextStyle( 29 | fontFamily = FontFamily.Default, 30 | fontWeight = FontWeight.Normal, 31 | fontSize = 16.sp, 32 | lineHeight = 24.sp, 33 | letterSpacing = 0.5.sp 34 | ) 35 | /* Other default text styles to override 36 | titleLarge = TextStyle( 37 | fontFamily = FontFamily.Default, 38 | fontWeight = FontWeight.Normal, 39 | fontSize = 22.sp, 40 | lineHeight = 28.sp, 41 | letterSpacing = 0.sp 42 | ), 43 | labelSmall = TextStyle( 44 | fontFamily = FontFamily.Default, 45 | fontWeight = FontWeight.Medium, 46 | fontSize = 11.sp, 47 | lineHeight = 16.sp, 48 | letterSpacing = 0.5.sp 49 | ) 50 | */ 51 | ) -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 24 | 27 | 32 | 37 | 42 | 47 | 52 | 57 | 62 | 67 | 72 | 77 | 82 | 87 | 92 | 97 | 102 | 107 | 112 | 117 | 122 | 127 | 132 | 137 | 142 | 147 | 152 | 157 | 162 | 167 | 172 | 177 | 182 | 187 | 188 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 24 | 25 | 26 | 32 | 35 | 38 | 39 | 40 | 41 | 47 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Knightwood/ComposePreference/a39ef350056eacdea1a49faf1c7f39b4f8a77f08/app/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Knightwood/ComposePreference/a39ef350056eacdea1a49faf1c7f39b4f8a77f08/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Knightwood/ComposePreference/a39ef350056eacdea1a49faf1c7f39b4f8a77f08/app/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Knightwood/ComposePreference/a39ef350056eacdea1a49faf1c7f39b4f8a77f08/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Knightwood/ComposePreference/a39ef350056eacdea1a49faf1c7f39b4f8a77f08/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Knightwood/ComposePreference/a39ef350056eacdea1a49faf1c7f39b4f8a77f08/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Knightwood/ComposePreference/a39ef350056eacdea1a49faf1c7f39b4f8a77f08/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Knightwood/ComposePreference/a39ef350056eacdea1a49faf1c7f39b4f8a77f08/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Knightwood/ComposePreference/a39ef350056eacdea1a49faf1c7f39b4f8a77f08/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Knightwood/ComposePreference/a39ef350056eacdea1a49faf1c7f39b4f8a77f08/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | #FFBB86FC 21 | #FF6200EE 22 | #FF3700B3 23 | #FF03DAC5 24 | #FF018786 25 | #FF000000 26 | #FFFFFFFF 27 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | ComposeTset 20 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 |