From 6f169997e9bc78fac5c3e1c8b094885fca0c21cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=BChlbauer?= Date: Wed, 8 May 2024 00:29:42 +0200 Subject: [PATCH] Migrate Settings UI to Material 3 (#2467) * implement material3 for the settings ui * fix chip colors * fix statusbar color * fix aboutlibraries color * fix alignment of subcheckboxen * fix wrong card colors * Update cornershape of the dropdown menu * update ScrollableModifiers to material 3 * better card and background colors * update jetpref * change contrast of outlined cards * apply suggestions * implement suggestions * add corners on text background in the theme editor * apply the systembar color for the navbar * set material you as default on android 12+ * fix card content padding * Fix status bar color not adapting to navbar color state * update jetpref dependency to 0.2.0-beta01 --------- Co-authored-by: Patrick Goldinger --- .../florisboard/FlorisImeService.kt | 4 +- .../patrickgold/florisboard/app/AppPrefs.kt | 4 + .../florisboard/app/FlorisAppActivity.kt | 13 +- .../florisboard/app/apptheme/Color.kt | 78 ++++++ .../florisboard/app/apptheme/Shape.kt | 2 +- .../florisboard/app/apptheme/Theme.kt | 224 +++++++++++++++--- .../florisboard/app/apptheme/Type.kt | 4 +- .../app/devtools/AndroidLocalesScreen.kt | 3 +- .../app/devtools/AndroidSettingsScreen.kt | 2 +- .../app/devtools/DevtoolsOverlay.kt | 4 +- .../app/devtools/ExportDebugLogScreen.kt | 2 +- .../app/ext/ExtensionComponentView.kt | 32 ++- .../app/ext/ExtensionEditScreen.kt | 17 +- .../app/ext/ExtensionImportScreen.kt | 38 +-- .../app/ext/ExtensionNotFoundScreen.kt | 2 +- .../app/ext/ExtensionViewScreen.kt | 11 +- .../app/settings/about/AboutScreen.kt | 2 +- .../settings/about/ProjectLicenseScreen.kt | 2 +- .../about/ThirdPartyLicensesScreen.kt | 11 +- .../app/settings/advanced/AdvancedScreen.kt | 9 + .../app/settings/advanced/BackupScreen.kt | 6 +- .../app/settings/advanced/RestoreScreen.kt | 20 +- .../dictionary/UserDictionaryScreen.kt | 17 +- .../localization/LanguagePackManagerScreen.kt | 8 +- .../localization/LocalizationScreen.kt | 8 +- .../localization/SelectLocaleScreen.kt | 13 +- .../localization/SubtypeEditorScreen.kt | 19 +- .../app/settings/theme/EditPropertyDialog.kt | 26 +- .../app/settings/theme/EditRuleDialog.kt | 55 +++-- .../app/settings/theme/SnyggValueIcon.kt | 17 +- .../app/settings/theme/ThemeEditorScreen.kt | 33 +-- .../app/settings/theme/ThemeManagerScreen.kt | 12 +- .../app/settings/theme/ThemeScreen.kt | 6 +- .../typing/SpellCheckerServiceSelector.kt | 3 +- .../app/settings/typing/TypingScreen.kt | 4 +- .../florisboard/app/setup/SetupScreen.kt | 4 +- .../ime/clipboard/ClipboardInputLayout.kt | 12 +- .../florisboard/lib/compose/FlorisAppBar.kt | 17 +- .../lib/compose/FlorisBulletSpacer.kt | 5 +- .../lib/compose/FlorisButtonBar.kt | 28 +-- .../florisboard/lib/compose/FlorisButtons.kt | 33 ++- .../florisboard/lib/compose/FlorisCards.kt | 74 +++--- .../florisboard/lib/compose/FlorisChip.kt | 76 ++++-- .../florisboard/lib/compose/FlorisDialogs.kt | 2 +- .../lib/compose/FlorisDropdownMenu.kt | 48 ++-- .../lib/compose/FlorisHyperlinkText.kt | 6 +- .../florisboard/lib/compose/FlorisScreen.kt | 30 ++- .../lib/compose/FlorisStepLayout.kt | 23 +- .../lib/compose/FlorisTextFields.kt | 67 ++++-- .../lib/compose/PreviewKeyboardField.kt | 18 +- .../lib/compose/ScrollableModifiers.kt | 20 +- .../florisboard/lib/compose/SystemUi.kt | 20 -- app/src/main/res/values/strings.xml | 1 + gradle/libs.versions.toml | 4 +- settings.gradle.kts | 2 +- 55 files changed, 754 insertions(+), 447 deletions(-) diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/FlorisImeService.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/FlorisImeService.kt index 5afc418e..37b34639 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/FlorisImeService.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/FlorisImeService.kt @@ -47,7 +47,7 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentHeight -import androidx.compose.material.ButtonDefaults +import androidx.compose.material3.ButtonDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.SideEffect @@ -769,7 +769,7 @@ class FlorisImeService : LifecycleInputMethodService() { ?: "ACTION", shape = actionStyle.shape.shape(), colors = ButtonDefaults.buttonColors( - backgroundColor = actionStyle.background.solidColor(context, FlorisImeTheme.fallbackContentColor()), + containerColor = actionStyle.background.solidColor(context, FlorisImeTheme.fallbackContentColor()), contentColor = actionStyle.foreground.solidColor(context, FlorisImeTheme.fallbackSurfaceColor()), ), ) diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/AppPrefs.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/AppPrefs.kt index 5e1b7e97..69a1431f 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/AppPrefs.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/AppPrefs.kt @@ -65,6 +65,10 @@ class AppPrefs : PreferenceModel("florisboard-app-prefs") { key = "advanced__settings_theme", default = AppTheme.AUTO, ) + val useMaterialYou = boolean( + key = "advanced__use_material_you", + default = true, + ) val settingsLanguage = string( key = "advanced__settings_language", default = "auto", diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/FlorisAppActivity.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/FlorisAppActivity.kt index 2a3c9070..e19e2059 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/FlorisAppActivity.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/FlorisAppActivity.kt @@ -25,8 +25,8 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.imePadding import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.statusBarsPadding -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Surface +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.SideEffect @@ -50,7 +50,6 @@ import dev.patrickgold.florisboard.lib.android.showAppIcon import dev.patrickgold.florisboard.lib.compose.LocalPreviewFieldController import dev.patrickgold.florisboard.lib.compose.PreviewKeyboardField import dev.patrickgold.florisboard.lib.compose.ProvideLocalizedResources -import dev.patrickgold.florisboard.lib.compose.SystemUiApp import dev.patrickgold.florisboard.lib.compose.rememberPreviewFieldController import dev.patrickgold.florisboard.lib.compose.stringRes import dev.patrickgold.florisboard.lib.util.AppVersionUtils @@ -111,9 +110,9 @@ class FlorisAppActivity : ComponentActivity() { AppVersionUtils.updateVersionOnInstallAndLastUse(this, prefs) setContent { ProvideLocalizedResources(resourcesContext) { - FlorisAppTheme(theme = appTheme) { - Surface(color = MaterialTheme.colors.background) { - SystemUiApp() + FlorisAppTheme(theme = appTheme, isMaterialYouAware = prefs.advanced.useMaterialYou.observeAsState().value) { + Surface(color = MaterialTheme.colorScheme.background) { + //SystemUiApp() AppContent() } } @@ -154,7 +153,7 @@ class FlorisAppActivity : ComponentActivity() { ) { Column( modifier = Modifier - .statusBarsPadding() + //.statusBarsPadding() .navigationBarsPadding() .imePadding(), ) { diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/apptheme/Color.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/apptheme/Color.kt index 864467c3..62f7bfee 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/apptheme/Color.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/apptheme/Color.kt @@ -18,7 +18,85 @@ package dev.patrickgold.florisboard.app.apptheme import androidx.compose.ui.graphics.Color +/* Legacy Colors val Green500 = Color(0xFF4CAF50) val Green700 = Color(0xFF388E3C) val Orange700 = Color(0xFFF57C00) val Orange900 = Color(0xFFE65100) +*/ + +//Colors created with the material theme builder + +val primaryLight = Color(0xFF006E1C) +val onPrimaryLight = Color(0xFFFFFFFF) +val primaryContainerLight = Color(0xFF58BC5B) +val onPrimaryContainerLight = Color(0xFF002204) +val secondaryLight = Color(0xFF005E16) +val onSecondaryLight = Color(0xFFFFFFFF) +val secondaryContainerLight = Color(0xFF2E8534) +val onSecondaryContainerLight = Color(0xFFFFFFFF) +val tertiaryLight = Color(0xFF964900) +val onTertiaryLight = Color(0xFFFFFFFF) +val tertiaryContainerLight = Color(0xFFFF8926) +val onTertiaryContainerLight = Color(0xFF341500) +val errorLight = Color(0xFFBA1A1A) +val onErrorLight = Color(0xFFFFFFFF) +val errorContainerLight = Color(0xFFFFDAD6) +val onErrorContainerLight = Color(0xFF410002) +val backgroundLight = Color(0xFFF5FBEF) +val onBackgroundLight = Color(0xFF171D16) +val surfaceLight = Color(0xFFF5FBEF) +val onSurfaceLight = Color(0xFF171D16) +val surfaceVariantLight = Color(0xFFDAE6D4) +val onSurfaceVariantLight = Color(0xFF3F4A3C) +val outlineLight = Color(0xFF6F7A6B) +val outlineVariantLight = Color(0xFFBECAB9) +val scrimLight = Color(0xFF000000) +val inverseSurfaceLight = Color(0xFF2C322A) +val inverseOnSurfaceLight = Color(0xFFEDF3E7) +val inversePrimaryLight = Color(0xFF78DC77) +val surfaceDimLight = Color(0xFFD6DCD0) +val surfaceBrightLight = Color(0xFFF5FBEF) +val surfaceContainerLowestLight = Color(0xFFFFFFFF) +val surfaceContainerLowLight = Color(0xFFF0F6EA) +val surfaceContainerLight = Color(0xFFEAF0E4) +val surfaceContainerHighLight = Color(0xFFE4EADE) +val surfaceContainerHighestLight = Color(0xFFDEE4D9) + +val primaryDark = Color(0xFF78DC77) +val onPrimaryDark = Color(0xFF00390A) +val primaryContainerDark = Color(0xFF43A648) +val onPrimaryContainerDark = Color(0xFF000000) +val secondaryDark = Color(0xFF82DB7E) +val onSecondaryDark = Color(0xFF00390A) +val secondaryContainerDark = Color(0xFF2D8433) +val onSecondaryContainerDark = Color(0xFFFFFFFF) +val tertiaryDark = Color(0xFFFFB786) +val onTertiaryDark = Color(0xFF502400) +val tertiaryContainerDark = Color(0xFFEA7600) +val onTertiaryContainerDark = Color(0xFF030100) +val errorDark = Color(0xFFFFB4AB) +val onErrorDark = Color(0xFF690005) +val errorContainerDark = Color(0xFF93000A) +val onErrorContainerDark = Color(0xFFFFDAD6) +val backgroundDark = Color(0xFF0F120E) +val onBackgroundDark = Color(0xFFDEE4D9) +val surfaceDark = Color(0xFF0F120E) +val onSurfaceDark = Color(0xFFDEE4D9) +val surfaceVariantDark = Color(0xFF3F4A3C) +val onSurfaceVariantDark = Color(0xFFBECAB9) +val outlineDark = Color(0xFF899484) +val outlineVariantDark = Color(0xFF3F4A3C) +val scrimDark = Color(0xFF000000) +val inverseSurfaceDark = Color(0xFFDEE4D9) +val inverseOnSurfaceDark = Color(0xFF2C322A) +val inversePrimaryDark = Color(0xFF006E1C) +val surfaceDimDark = Color(0xFF0F150E) +val surfaceBrightDark = Color(0xFF353B33) +val surfaceContainerLowestDark = Color(0xFF0A1009) +val surfaceContainerLowDark = Color(0xFF171D16) +val surfaceContainerDark = Color(0xFF1B211A) +val surfaceContainerHighDark = Color(0xFF262C24) +val surfaceContainerHighestDark = Color(0xFF30362E) + +val amoledDark = Color(0xFF000000) diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/apptheme/Shape.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/apptheme/Shape.kt index 07465296..0167c387 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/apptheme/Shape.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/apptheme/Shape.kt @@ -17,7 +17,7 @@ package dev.patrickgold.florisboard.app.apptheme import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.Shapes +import androidx.compose.material3.Shapes import androidx.compose.ui.unit.dp val Shapes = Shapes( diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/apptheme/Theme.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/apptheme/Theme.kt index 40a7e786..11b8c5d8 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/apptheme/Theme.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/apptheme/Theme.kt @@ -16,41 +16,50 @@ package dev.patrickgold.florisboard.app.apptheme +import android.app.Activity import androidx.compose.foundation.isSystemInDarkTheme -import androidx.compose.material.ButtonDefaults -import androidx.compose.material.Colors -import androidx.compose.material.MaterialTheme -import androidx.compose.material.darkColors -import androidx.compose.material.lightColors +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.TopAppBarDefaults +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable +import androidx.compose.runtime.SideEffect import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.toArgb +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalView +import androidx.core.view.WindowCompat import dev.patrickgold.florisboard.app.AppTheme +import dev.patrickgold.florisboard.lib.android.AndroidVersion -private val AmoledDarkColorPalette = darkColors( +/*private val AmoledDarkColorPalette = darkColorScheme( primary = Green500, - primaryVariant = Green700, - secondary = Orange700, - secondaryVariant = Orange900, + secondary = Green700, + tertiary = Orange700, + // = Orange900, background = Color(0xFF000000), surface = Color(0xFF212121), ) -private val DarkColorPalette = darkColors( +private val DarkColorPalette = darkColorScheme( primary = Green500, - primaryVariant = Green700, - secondary = Orange700, - secondaryVariant = Orange900, + secondary = Green700, + tertiary = Orange700, + //secondaryVariant = Orange900, background = Color(0xFF1F1F1F), surface = Color(0xFF212121), ) -private val LightColorPalette = lightColors( +private val LightColorPalette = lightColorScheme( primary = Green500, - primaryVariant = Green700, - secondary = Orange700, - secondaryVariant = Orange900, + secondary = Green700, + tertiary = Orange700, + //secondaryVariant = Orange900, background = Color(0xFFFFFFFF), surface = Color(0xFFE7E7E7), @@ -63,35 +72,184 @@ private val LightColorPalette = lightColors( onBackground = Color.Black, onSurface = Color.Black, */ +)*/ + +private val lightScheme = lightColorScheme( + primary = primaryLight, + onPrimary = onPrimaryLight, + primaryContainer = primaryContainerLight, + onPrimaryContainer = onPrimaryContainerLight, + secondary = secondaryLight, + onSecondary = onSecondaryLight, + secondaryContainer = secondaryContainerLight, + onSecondaryContainer = onSecondaryContainerLight, + tertiary = tertiaryLight, + onTertiary = onTertiaryLight, + tertiaryContainer = tertiaryContainerLight, + onTertiaryContainer = onTertiaryContainerLight, + error = errorLight, + onError = onErrorLight, + errorContainer = errorContainerLight, + onErrorContainer = onErrorContainerLight, + background = backgroundLight, + onBackground = onBackgroundLight, + surface = surfaceLight, + onSurface = onSurfaceLight, + surfaceVariant = surfaceVariantLight, + onSurfaceVariant = onSurfaceVariantLight, + outline = outlineLight, + outlineVariant = outlineVariantLight, + scrim = scrimLight, + inverseSurface = inverseSurfaceLight, + inverseOnSurface = inverseOnSurfaceLight, + inversePrimary = inversePrimaryLight, + surfaceDim = surfaceDimLight, + surfaceBright = surfaceBrightLight, + surfaceContainerLowest = surfaceContainerLowestLight, + surfaceContainerLow = surfaceContainerLowLight, + surfaceContainer = surfaceContainerLight, + surfaceContainerHigh = surfaceContainerHighLight, + surfaceContainerHighest = surfaceContainerHighestLight, +) + +private val darkScheme = darkColorScheme( + primary = primaryDark, + onPrimary = onPrimaryDark, + primaryContainer = primaryContainerDark, + onPrimaryContainer = onPrimaryContainerDark, + secondary = secondaryDark, + onSecondary = onSecondaryDark, + secondaryContainer = secondaryContainerDark, + onSecondaryContainer = onSecondaryContainerDark, + tertiary = tertiaryDark, + onTertiary = onTertiaryDark, + tertiaryContainer = tertiaryContainerDark, + onTertiaryContainer = onTertiaryContainerDark, + error = errorDark, + onError = onErrorDark, + errorContainer = errorContainerDark, + onErrorContainer = onErrorContainerDark, + background = backgroundDark, + onBackground = onBackgroundDark, + surface = surfaceDark, + onSurface = onSurfaceDark, + surfaceVariant = surfaceVariantDark, + onSurfaceVariant = onSurfaceVariantDark, + outline = outlineDark, + outlineVariant = outlineVariantDark, + scrim = scrimDark, + inverseSurface = inverseSurfaceDark, + inverseOnSurface = inverseOnSurfaceDark, + inversePrimary = inversePrimaryDark, + surfaceDim = surfaceDimDark, + surfaceBright = surfaceBrightDark, + surfaceContainerLowest = surfaceContainerLowestDark, + surfaceContainerLow = surfaceContainerLowDark, + surfaceContainer = surfaceContainerDark, + surfaceContainerHigh = surfaceContainerHighDark, + surfaceContainerHighest = surfaceContainerHighestDark, +) + +private val amoledScheme = darkScheme.copy( + background = amoledDark, + surface = amoledDark ) @Composable fun FlorisAppTheme( theme: AppTheme, + isMaterialYouAware: Boolean, content: @Composable () -> Unit ) { - val colors = when (theme) { - AppTheme.AUTO -> when { - isSystemInDarkTheme() -> DarkColorPalette - else -> LightColorPalette + + val colors = if (AndroidVersion.ATLEAST_API31_S) { + when (theme) { + AppTheme.AUTO -> when { + isMaterialYouAware -> when { + isSystemInDarkTheme() -> dynamicDarkColorScheme(LocalContext.current) + else -> dynamicLightColorScheme(LocalContext.current) + } + + else -> { + when { + isSystemInDarkTheme() -> darkScheme + else -> lightScheme + } + } + } + + AppTheme.AUTO_AMOLED -> when { + isMaterialYouAware -> when { + isSystemInDarkTheme() -> dynamicDarkColorScheme(LocalContext.current).copy( + background = amoledDark, + surface = amoledDark, + ) + + else -> dynamicLightColorScheme(LocalContext.current) + } + + else -> { + when { + isSystemInDarkTheme() -> amoledScheme + else -> lightScheme + } + } + } + + AppTheme.LIGHT -> when { + isMaterialYouAware -> dynamicLightColorScheme(LocalContext.current) + else -> lightScheme + } + + AppTheme.DARK -> when { + isMaterialYouAware -> dynamicDarkColorScheme(LocalContext.current) + else -> darkScheme + } + + AppTheme.AMOLED_DARK -> when { + isMaterialYouAware -> dynamicDarkColorScheme(LocalContext.current).copy( + background = amoledDark, + surface = amoledDark, + ) + + else -> amoledScheme + } } - AppTheme.AUTO_AMOLED -> when { - isSystemInDarkTheme() -> AmoledDarkColorPalette - else -> LightColorPalette + } else { + when (theme) { + AppTheme.AUTO -> when { + isSystemInDarkTheme() -> darkScheme + else -> lightScheme + } + + AppTheme.AUTO_AMOLED -> when { + isSystemInDarkTheme() -> darkScheme + else -> lightScheme + } + + AppTheme.LIGHT -> lightScheme + AppTheme.DARK -> darkScheme + AppTheme.AMOLED_DARK -> amoledScheme + } + } + + val darkTheme = + theme == AppTheme.DARK + || theme == AppTheme.AMOLED_DARK + || (theme == AppTheme.AUTO && isSystemInDarkTheme()) + || (theme == AppTheme.AUTO_AMOLED && isSystemInDarkTheme()) + + val view = LocalView.current + if (!view.isInEditMode) { + SideEffect { + val window = (view.context as Activity).window + WindowCompat.getInsetsController(window, window.decorView).isAppearanceLightStatusBars = !darkTheme } - AppTheme.LIGHT -> LightColorPalette - AppTheme.DARK -> DarkColorPalette - AppTheme.AMOLED_DARK -> AmoledDarkColorPalette } MaterialTheme( - colors = colors, + colorScheme = colors, typography = Typography, - shapes = Shapes, content = content, ) } - -val Colors.outline: Color - @Composable - get() = this.onSurface.copy(alpha = ButtonDefaults.OutlinedBorderOpacity) diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/apptheme/Type.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/apptheme/Type.kt index cdfb842b..431ce4e8 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/apptheme/Type.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/apptheme/Type.kt @@ -16,7 +16,7 @@ package dev.patrickgold.florisboard.app.apptheme -import androidx.compose.material.Typography +import androidx.compose.material3.Typography import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight @@ -24,7 +24,7 @@ import androidx.compose.ui.unit.sp // Set of Material typography styles to start with val Typography = Typography( - body1 = TextStyle( + bodyLarge = TextStyle( fontFamily = FontFamily.Default, fontWeight = FontWeight.Normal, fontSize = 16.sp diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/AndroidLocalesScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/AndroidLocalesScreen.kt index c3cd2185..3cbc9fca 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/AndroidLocalesScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/AndroidLocalesScreen.kt @@ -21,15 +21,14 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.text.selection.SelectionContainer -import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Save +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontFamily import dev.patrickgold.florisboard.R import dev.patrickgold.florisboard.ime.core.DisplayLanguageNamesIn diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/AndroidSettingsScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/AndroidSettingsScreen.kt index e177eda3..b5f222bd 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/AndroidSettingsScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/AndroidSettingsScreen.kt @@ -19,7 +19,7 @@ package dev.patrickgold.florisboard.app.devtools import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.text.selection.SelectionContainer -import androidx.compose.material.Text +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/DevtoolsOverlay.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/DevtoolsOverlay.kt index cce80cf2..35286c56 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/DevtoolsOverlay.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/DevtoolsOverlay.kt @@ -21,8 +21,8 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.material.LocalContentColor -import androidx.compose.material.Text +import androidx.compose.material3.LocalContentColor +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.collectAsState diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/ExportDebugLogScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/ExportDebugLogScreen.kt index 7cdb89ce..a51fc8dd 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/ExportDebugLogScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/ExportDebugLogScreen.kt @@ -21,7 +21,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.rememberLazyListState -import androidx.compose.material.Text +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.LaunchedEffect diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionComponentView.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionComponentView.kt index c189cbc4..12e428c4 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionComponentView.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionComponentView.kt @@ -21,21 +21,18 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.material.ButtonDefaults -import androidx.compose.material.ExperimentalMaterialApi -import androidx.compose.material.ListItem -import androidx.compose.material.LocalContentAlpha -import androidx.compose.material.LocalContentColor -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Add import androidx.compose.material.icons.filled.Delete import androidx.compose.material.icons.filled.Edit +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.ListItem +import androidx.compose.material3.LocalContentColor +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow @@ -97,8 +94,8 @@ fun ExtensionComponentView( } Text( text = text, - style = MaterialTheme.typography.body2, - color = LocalContentColor.current.copy(alpha = LocalContentAlpha.current), + style = MaterialTheme.typography.bodyMedium, + color = LocalContentColor.current, ) } is LanguagePackComponent -> { @@ -113,8 +110,8 @@ fun ExtensionComponentView( } Text( text = text, - style = MaterialTheme.typography.body2, - color = LocalContentColor.current.copy(alpha = LocalContentAlpha.current), + style = MaterialTheme.typography.bodyMedium, + color = LocalContentColor.current, ) } else -> { } @@ -132,7 +129,7 @@ fun ExtensionComponentView( icon = Icons.Default.Delete, text = stringRes(R.string.action__delete), colors = ButtonDefaults.textButtonColors( - contentColor = MaterialTheme.colors.error, + contentColor = MaterialTheme.colorScheme.error, ), ) } @@ -149,7 +146,6 @@ fun ExtensionComponentView( } } -@OptIn(ExperimentalMaterialApi::class) @Composable fun ExtensionComponentListView( modifier: Modifier = Modifier, @@ -160,19 +156,19 @@ fun ExtensionComponentListView( ) { Column(modifier = modifier) { ListItem( - text = { Text( + headlineContent = { Text( text = title, - color = MaterialTheme.colors.secondary, + color = MaterialTheme.colorScheme.secondary, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis, ) }, - trailing = if (onCreateBtnClick != null) { + trailingContent = if (onCreateBtnClick != null) { @Composable { FlorisIconButton( onClick = onCreateBtnClick, icon = Icons.Default.Add, - iconColor = MaterialTheme.colors.secondary, + iconColor = MaterialTheme.colorScheme.secondary, ) } } else { null }, diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionEditScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionEditScreen.kt index d0d6ac3e..cf2a9438 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionEditScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionEditScreen.kt @@ -28,14 +28,14 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text -import androidx.compose.material.TextFieldDefaults import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.filled.Code import androidx.compose.material.icons.outlined.LibraryBooks +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.OutlinedTextFieldDefaults +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -47,7 +47,6 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.unit.dp import dev.patrickgold.florisboard.R import dev.patrickgold.florisboard.app.LocalNavController -import dev.patrickgold.florisboard.app.apptheme.outline import dev.patrickgold.florisboard.app.settings.advanced.RadioListItem import dev.patrickgold.florisboard.app.settings.theme.DialogProperty import dev.patrickgold.florisboard.app.settings.theme.ThemeEditorScreen @@ -863,7 +862,7 @@ private fun EditorSheetTextField( showValidationError: Boolean = false, validationResult: ValidationResult? = null, ) { - val borderColor = MaterialTheme.colors.outline + val borderColor = MaterialTheme.colorScheme.outline Column(modifier = Modifier.padding(vertical = TextFieldVerticalPadding)) { Row( modifier = Modifier @@ -872,14 +871,14 @@ private fun EditorSheetTextField( ) { Text( text = label, - style = MaterialTheme.typography.subtitle2, + style = MaterialTheme.typography.titleSmall, ) if (isRequired) { Text( modifier = Modifier.padding(start = 2.dp), text = "*", - style = MaterialTheme.typography.subtitle2, - color = MaterialTheme.colors.error, + style = MaterialTheme.typography.titleSmall, + color = MaterialTheme.colorScheme.error, ) } } @@ -891,7 +890,7 @@ private fun EditorSheetTextField( singleLine = singleLine, showValidationError = showValidationError, validationResult = validationResult, - colors = TextFieldDefaults.outlinedTextFieldColors( + colors = OutlinedTextFieldDefaults.colors( unfocusedBorderColor = borderColor, disabledBorderColor = borderColor, ) diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionImportScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionImportScreen.kt index 09b47c6a..f72fe3eb 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionImportScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionImportScreen.kt @@ -29,9 +29,9 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.text.selection.SelectionContainer -import androidx.compose.material.LocalContentColor -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text +import androidx.compose.material3.LocalContentColor +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -228,8 +228,8 @@ fun ExtensionImportScreen(type: ExtensionImportScreenType, initUuid: String?) = Text( modifier = Modifier.padding(horizontal = 16.dp), text = stringRes(R.string.ext__import__error_unexpected_exception), - style = MaterialTheme.typography.body2, - color = MaterialTheme.colors.error, + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.error, ) SelectionContainer { Text( @@ -237,8 +237,8 @@ fun ExtensionImportScreen(type: ExtensionImportScreenType, initUuid: String?) = .florisHorizontalScroll() .padding(horizontal = 16.dp), text = result.exceptionOrNull()?.stackTraceToString() ?: "null", - style = MaterialTheme.typography.body2, - color = MaterialTheme.colors.error, + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.error, fontStyle = FontStyle.Italic, ) } @@ -266,20 +266,20 @@ private fun FileInfoView( Row { Text( text = Formatter.formatShortFileSize(LocalContext.current, fileInfo.size), - style = MaterialTheme.typography.body2, + style = MaterialTheme.typography.bodyMedium, color = grayColor, ) if (ext != null) { FlorisBulletSpacer() Text( text = ext.meta.id, - style = MaterialTheme.typography.body2, + style = MaterialTheme.typography.bodyMedium, color = grayColor, ) FlorisBulletSpacer() Text( text = ext.meta.version, - style = MaterialTheme.typography.body2, + style = MaterialTheme.typography.bodyMedium, color = grayColor, ) } @@ -288,12 +288,12 @@ private fun FileInfoView( Spacer(modifier = Modifier.height(8.dp)) Text( text = ext.meta.title, - style = MaterialTheme.typography.body2, + style = MaterialTheme.typography.bodyMedium, ) ext.meta.description?.let { description -> Text( text = description, - style = MaterialTheme.typography.body2, + style = MaterialTheme.typography.bodyMedium, fontStyle = FontStyle.Italic, ) } @@ -303,13 +303,13 @@ private fun FileInfoView( } Text( text = stringRes(R.string.ext__meta__maintainers_by, "maintainers" to maintainers), - style = MaterialTheme.typography.body2, + style = MaterialTheme.typography.bodyMedium, ) Spacer(modifier = Modifier.height(8.dp)) for (component in ext.components()) { Text( text = component.id, - style = MaterialTheme.typography.body2, + style = MaterialTheme.typography.bodyMedium, ) } } @@ -318,16 +318,16 @@ private fun FileInfoView( .fillMaxWidth() .height(19.dp) .padding(top = 10.dp, bottom = 8.dp) - .background(MaterialTheme.colors.error.copy(alpha = 0.56f))) + .background(MaterialTheme.colorScheme.error.copy(alpha = 0.56f))) Text( text = stringRes(R.string.ext__import__file_skip), - style = MaterialTheme.typography.body2, - color = MaterialTheme.colors.error, + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.error, ) Text( text = stringRes(fileInfo.skipReason), - style = MaterialTheme.typography.body2, - color = MaterialTheme.colors.error, + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.error, fontStyle = FontStyle.Italic, ) } diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionNotFoundScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionNotFoundScreen.kt index 6a75a6cc..3cbb7d55 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionNotFoundScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionNotFoundScreen.kt @@ -18,7 +18,7 @@ package dev.patrickgold.florisboard.app.ext import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding -import androidx.compose.material.Text +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionViewScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionViewScreen.kt index 3b6bfff8..9d472b6b 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionViewScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/ext/ExtensionViewScreen.kt @@ -27,13 +27,13 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.rememberScrollState -import androidx.compose.material.ButtonDefaults -import androidx.compose.material.Divider -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Delete import androidx.compose.material.icons.filled.Share +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Divider +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -42,7 +42,6 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.painterResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import dev.patrickgold.florisboard.R @@ -150,7 +149,7 @@ private fun ViewScreen(ext: Extension) = FlorisScreen { icon = Icons.Default.Delete, text = stringRes(R.string.action__delete), colors = ButtonDefaults.outlinedButtonColors( - contentColor = MaterialTheme.colors.error, + contentColor = MaterialTheme.colorScheme.error, ), ) } diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/about/AboutScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/about/AboutScreen.kt index 75fae3f7..64be6a54 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/about/AboutScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/about/AboutScreen.kt @@ -22,13 +22,13 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.requiredSize -import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Code import androidx.compose.material.icons.filled.History import androidx.compose.material.icons.outlined.Description import androidx.compose.material.icons.outlined.Info import androidx.compose.material.icons.outlined.Policy +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/about/ProjectLicenseScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/about/ProjectLicenseScreen.kt index 01fa23f5..b1222673 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/about/ProjectLicenseScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/about/ProjectLicenseScreen.kt @@ -18,7 +18,7 @@ package dev.patrickgold.florisboard.app.settings.about import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.text.selection.SelectionContainer -import androidx.compose.material.Text +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.ui.Modifier diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/about/ThirdPartyLicensesScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/about/ThirdPartyLicensesScreen.kt index 043b9821..5ed7f971 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/about/ThirdPartyLicensesScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/about/ThirdPartyLicensesScreen.kt @@ -18,9 +18,11 @@ package dev.patrickgold.florisboard.app.settings.about import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.lazy.rememberLazyListState +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import com.mikepenz.aboutlibraries.ui.compose.LibrariesContainer +import com.mikepenz.aboutlibraries.ui.compose.m3.LibrariesContainer +import com.mikepenz.aboutlibraries.ui.compose.m3.LibraryDefaults import dev.patrickgold.florisboard.R import dev.patrickgold.florisboard.lib.compose.FlorisScreen import dev.patrickgold.florisboard.lib.compose.florisScrollbar @@ -39,6 +41,13 @@ fun ThirdPartyLicensesScreen() = FlorisScreen { modifier = Modifier .fillMaxSize() .florisScrollbar(lazyListState, isVertical = true), + colors = LibraryDefaults.libraryColors( + backgroundColor = MaterialTheme.colorScheme.background, + badgeBackgroundColor = MaterialTheme.colorScheme.primaryContainer, + badgeContentColor = MaterialTheme.colorScheme.onPrimaryContainer, + contentColor = MaterialTheme.colorScheme.onBackground, + dialogConfirmButtonColor = MaterialTheme.colorScheme.primary, + ), lazyListState = lazyListState, ) } diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/advanced/AdvancedScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/advanced/AdvancedScreen.kt index 92dd1412..b8f32f8a 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/advanced/AdvancedScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/advanced/AdvancedScreen.kt @@ -18,6 +18,7 @@ package dev.patrickgold.florisboard.app.settings.advanced import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Archive +import androidx.compose.material.icons.filled.FormatPaint import androidx.compose.material.icons.filled.Language import androidx.compose.material.icons.filled.Palette import androidx.compose.material.icons.filled.Preview @@ -77,6 +78,14 @@ fun AdvancedScreen() = FlorisScreen { ) }, ) + SwitchPreference( + pref = prefs.advanced.useMaterialYou, + icon = Icons.Default.FormatPaint, + title = stringRes(R.string.pref__advanced__settings_material_you__label), + visibleIf = { + AndroidVersion.ATLEAST_API31_S + }, + ) ListPreference( prefs.advanced.settingsLanguage, icon = Icons.Default.Language, diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/advanced/BackupScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/advanced/BackupScreen.kt index d1b218b3..cccb4a47 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/advanced/BackupScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/advanced/BackupScreen.kt @@ -23,8 +23,8 @@ import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.width -import androidx.compose.material.Checkbox -import androidx.compose.material.RadioButton +import androidx.compose.material3.Checkbox +import androidx.compose.material3.RadioButton import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -370,7 +370,7 @@ internal fun CheckboxListItem( icon = { Row { if (isSecondaryListItem) { - Spacer(modifier = Modifier.width(56.dp)) + Spacer(modifier = Modifier.width(40.dp)) } Checkbox( checked = checked, diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/advanced/RestoreScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/advanced/RestoreScreen.kt index 6ba74c00..c7138b6e 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/advanced/RestoreScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/advanced/RestoreScreen.kt @@ -25,13 +25,13 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.material.LocalContentAlpha -import androidx.compose.material.LocalContentColor -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Code import androidx.compose.material.icons.filled.Schedule import androidx.compose.material.icons.outlined.Info +import androidx.compose.material3.LocalContentColor +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -54,8 +54,8 @@ import dev.patrickgold.florisboard.ime.clipboard.provider.ItemType import dev.patrickgold.florisboard.lib.android.readToFile import dev.patrickgold.florisboard.lib.android.showLongToast import dev.patrickgold.florisboard.lib.cache.CacheManager -import dev.patrickgold.florisboard.lib.compose.CardDefaults import dev.patrickgold.florisboard.lib.compose.FlorisButtonBar +import dev.patrickgold.florisboard.lib.compose.FlorisCardDefaults import dev.patrickgold.florisboard.lib.compose.FlorisOutlinedBox import dev.patrickgold.florisboard.lib.compose.FlorisOutlinedButton import dev.patrickgold.florisboard.lib.compose.FlorisScreen @@ -314,23 +314,23 @@ fun RestoreScreen() = FlorisScreen { }, ) if (workspace.restoreErrorId != null) { - Column(modifier = Modifier.padding(CardDefaults.ContentPadding)) { + Column(modifier = Modifier.padding(FlorisCardDefaults.ContentPadding)) { Box( modifier = Modifier .fillMaxWidth() .height(9.dp) .padding(bottom = 8.dp) - .background(MaterialTheme.colors.error.copy(alpha = 0.56f)) + .background(MaterialTheme.colorScheme.error.copy(alpha = 0.56f)) ) Text( text = stringRes(workspace.restoreErrorId!!), - style = MaterialTheme.typography.body2, - color = MaterialTheme.colors.error, + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.error, fontStyle = FontStyle.Italic, ) } } else if (workspace.restoreWarningId != null) { - Column(modifier = Modifier.padding(CardDefaults.ContentPadding)) { + Column(modifier = Modifier.padding(FlorisCardDefaults.ContentPadding)) { Box( modifier = Modifier .fillMaxWidth() @@ -340,7 +340,7 @@ fun RestoreScreen() = FlorisScreen { ) Text( text = stringRes(workspace.restoreWarningId!!), - style = MaterialTheme.typography.body2, + style = MaterialTheme.typography.bodyMedium, color = LocalContentColor.current.copy(alpha = LocalContentAlpha.current), fontStyle = FontStyle.Italic, ) diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/dictionary/UserDictionaryScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/dictionary/UserDictionaryScreen.kt index 991bc5b4..88a91448 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/dictionary/UserDictionaryScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/dictionary/UserDictionaryScreen.kt @@ -23,16 +23,16 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items -import androidx.compose.material.DropdownMenu -import androidx.compose.material.DropdownMenuItem -import androidx.compose.material.ExtendedFloatingActionButton -import androidx.compose.material.Icon -import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Add import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.filled.MoreVert +import androidx.compose.material3.DropdownMenu +import androidx.compose.material3.DropdownMenuItem +import androidx.compose.material3.ExtendedFloatingActionButton +import androidx.compose.material3.Icon +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue @@ -43,7 +43,6 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.unit.dp import dev.patrickgold.florisboard.R @@ -214,14 +213,14 @@ fun UserDictionaryScreen(type: UserDictionaryType) = FlorisScreen { importDictionary.launch("*/*") expanded = false }, - content = { Text(text = stringRes(R.string.action__import)) }, + text = { Text(text = stringRes(R.string.action__import)) }, ) DropdownMenuItem( onClick = { exportDictionary.launch("my-personal-dictionary.clb") expanded = false }, - content = { Text(text = stringRes(R.string.action__export)) }, + text = { Text(text = stringRes(R.string.action__export)) }, ) if (type == UserDictionaryType.SYSTEM) { DropdownMenuItem( @@ -229,7 +228,7 @@ fun UserDictionaryScreen(type: UserDictionaryType) = FlorisScreen { context.launchActivity { it.action = SystemUserDictionaryUiIntentAction } expanded = false }, - content = { Text(text = stringRes(R.string.settings__udm__open_system_manager_ui)) }, + text = { Text(text = stringRes(R.string.settings__udm__open_system_manager_ui)) }, ) } } diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/localization/LanguagePackManagerScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/localization/LanguagePackManagerScreen.kt index 946983c8..d60e9574 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/localization/LanguagePackManagerScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/localization/LanguagePackManagerScreen.kt @@ -25,12 +25,12 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.rememberScrollState -import androidx.compose.material.ButtonDefaults -import androidx.compose.material.LocalContentColor -import androidx.compose.material.MaterialTheme import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Delete import androidx.compose.material.icons.filled.Input +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.LocalContentColor +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.key @@ -177,7 +177,7 @@ fun LanguagePackManagerScreen(action: LanguagePackManagerScreenAction?) = Floris icon = Icons.Default.Delete, text = stringRes(R.string.action__delete), colors = ButtonDefaults.textButtonColors( - contentColor = MaterialTheme.colors.error, + contentColor = MaterialTheme.colorScheme.error, ), ) Spacer(modifier = Modifier.weight(1f)) diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/localization/LocalizationScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/localization/LocalizationScreen.kt index 3a5f9a6a..7356dd56 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/localization/LocalizationScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/localization/LocalizationScreen.kt @@ -17,11 +17,12 @@ package dev.patrickgold.florisboard.app.settings.localization import androidx.compose.foundation.layout.padding -import androidx.compose.material.ExtendedFloatingActionButton -import androidx.compose.material.Icon -import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Add +import androidx.compose.material3.ExtendedFloatingActionButton +import androidx.compose.material3.FloatingActionButtonDefaults +import androidx.compose.material3.Icon +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue @@ -70,6 +71,7 @@ fun LocalizationScreen() = FlorisScreen { text = stringRes(R.string.settings__localization__subtype_add_title), ) }, + shape = FloatingActionButtonDefaults.extendedFabShape, onClick = { navController.navigate(Routes.Settings.SubtypeAdd) }, ) } diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/localization/SelectLocaleScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/localization/SelectLocaleScreen.kt index d03e6dce..2877b85e 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/localization/SelectLocaleScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/localization/SelectLocaleScreen.kt @@ -24,13 +24,13 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.rememberLazyListState -import androidx.compose.material.Icon -import androidx.compose.material.LocalContentColor -import androidx.compose.material.Text -import androidx.compose.material.TextField -import androidx.compose.material.TextFieldDefaults import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Search +import androidx.compose.material3.Icon +import androidx.compose.material3.LocalContentColor +import androidx.compose.material3.Text +import androidx.compose.material3.TextField +import androidx.compose.material3.TextFieldDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -41,7 +41,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.dp import dev.patrickgold.florisboard.R @@ -107,7 +106,7 @@ fun SelectLocaleScreen() = FlorisScreen { }, singleLine = true, shape = RectangleShape, - colors = TextFieldDefaults.textFieldColors( + colors = TextFieldDefaults.colors( focusedIndicatorColor = Color.Transparent, unfocusedIndicatorColor = Color.Transparent, disabledIndicatorColor = Color.Transparent, diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/localization/SubtypeEditorScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/localization/SubtypeEditorScreen.kt index f357bef0..ed0e396c 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/localization/SubtypeEditorScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/localization/SubtypeEditorScreen.kt @@ -25,14 +25,14 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items -import androidx.compose.material.Button -import androidx.compose.material.Card -import androidx.compose.material.Icon -import androidx.compose.material.IconButton -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Delete +import androidx.compose.material3.Button +import androidx.compose.material3.Card +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.MutableState @@ -48,7 +48,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalLifecycleOwner -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp @@ -66,7 +65,6 @@ import dev.patrickgold.florisboard.ime.core.SubtypePreset import dev.patrickgold.florisboard.ime.keyboard.LayoutArrangementComponent import dev.patrickgold.florisboard.ime.keyboard.LayoutType import dev.patrickgold.florisboard.ime.keyboard.extCorePopupMapping -import dev.patrickgold.florisboard.ime.text.key.KeyCode import dev.patrickgold.florisboard.ime.nlp.han.HanShapeBasedLanguageProvider import dev.patrickgold.florisboard.ime.nlp.latin.LatinLanguageProvider import dev.patrickgold.florisboard.keyboardManager @@ -82,7 +80,6 @@ import dev.patrickgold.florisboard.subtypeManager import dev.patrickgold.jetpref.datastore.model.observeAsState import dev.patrickgold.jetpref.material.ui.JetPrefAlertDialog import dev.patrickgold.jetpref.material.ui.JetPrefListItem -import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString private val SelectComponentName = ExtensionComponentName("00", "00") @@ -281,7 +278,7 @@ fun SubtypeEditorScreen(id: Long?) = FlorisScreen { Text( modifier = Modifier.padding(vertical = 8.dp, horizontal = 16.dp), text = stringRes(R.string.settings__localization__suggested_subtype_presets), - color = MaterialTheme.colors.primary, + color = MaterialTheme.colorScheme.primary, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis, @@ -583,7 +580,7 @@ private fun SubtypeProperty(text: String, content: @Composable () -> Unit) { Text( modifier = Modifier.padding(bottom = 8.dp), text = text, - style = MaterialTheme.typography.subtitle2, + style = MaterialTheme.typography.titleSmall, ) content() } diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/EditPropertyDialog.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/EditPropertyDialog.kt index c85be3eb..9bb232f6 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/EditPropertyDialog.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/EditPropertyDialog.kt @@ -30,12 +30,11 @@ import androidx.compose.foundation.shape.CutCornerShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions -import androidx.compose.material.ButtonDefaults -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.HelpOutline -import androidx.compose.material.icons.outlined.HelpOutline +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.LaunchedEffect @@ -49,7 +48,6 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.platform.LocalLayoutDirection -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType @@ -94,7 +92,7 @@ import dev.patrickgold.florisboard.lib.snygg.value.SnyggValue import dev.patrickgold.florisboard.lib.snygg.value.SnyggValueEncoder import dev.patrickgold.florisboard.lib.snygg.value.SnyggVarValueEncoders import dev.patrickgold.florisboard.lib.stripUnicodeCtrlChars -import dev.patrickgold.jetpref.material.ui.ExperimentalJetPrefMaterialUi +import dev.patrickgold.jetpref.material.ui.ExperimentalJetPrefMaterial3Ui import dev.patrickgold.jetpref.material.ui.JetPrefAlertDialog import dev.patrickgold.jetpref.material.ui.JetPrefColorPicker import dev.patrickgold.jetpref.material.ui.rememberJetPrefColorPickerState @@ -220,7 +218,7 @@ internal fun EditPropertyDialog( }, onNeutral = onDelete, neutralColors = ButtonDefaults.textButtonColors( - contentColor = MaterialTheme.colors.error, + contentColor = MaterialTheme.colorScheme.error, ), ) { Column { @@ -228,7 +226,7 @@ internal fun EditPropertyDialog( Text( modifier = Modifier.padding(bottom = 16.dp), text = stringRes(R.string.settings__theme_editor__property_already_exists), - color = MaterialTheme.colors.error, + color = MaterialTheme.colorScheme.error, ) } @@ -353,7 +351,7 @@ private fun PropertyValueEncoderDropdown( ) } -@OptIn(ExperimentalJetPrefMaterialUi::class) +@OptIn(ExperimentalJetPrefMaterial3Ui::class) @Composable private fun PropertyValueEditor( value: SnyggValue, @@ -417,7 +415,7 @@ private fun PropertyValueEditor( .padding(end = 12.dp) .weight(1f), text = colorPickerStr, - style = MaterialTheme.typography.body2, + style = MaterialTheme.typography.bodyMedium, fontFamily = FontFamily.Monospace, ) SnyggValueIcon( @@ -477,7 +475,7 @@ private fun PropertyValueEditor( rgb(r,g,b) -> r,g,b in 0..255 """.trimIndent(), - style = MaterialTheme.typography.body2, + style = MaterialTheme.typography.bodyMedium, fontFamily = FontFamily.Monospace, ) } @@ -680,7 +678,7 @@ private fun PropertyValueEditor( Box( modifier = Modifier .requiredSize(40.dp) - .border(1.dp, MaterialTheme.colors.onBackground, shape), + .border(1.dp, MaterialTheme.colorScheme.onBackground, shape), ) Column { FlorisChip( @@ -849,7 +847,7 @@ private fun PropertyValueEditor( Box( modifier = Modifier .requiredSize(40.dp) - .border(1.dp, MaterialTheme.colors.onBackground, shape), + .border(1.dp, MaterialTheme.colorScheme.onBackground, shape), ) Column { FlorisChip( @@ -938,7 +936,7 @@ private fun PropertyValueEditor( Box( modifier = Modifier .requiredSize(40.dp) - .border(1.dp, MaterialTheme.colors.onBackground, value.shape), + .border(1.dp, MaterialTheme.colorScheme.onBackground, value.shape), ) } } diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/EditRuleDialog.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/EditRuleDialog.kt index 5a35ccd8..3499e47f 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/EditRuleDialog.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/EditRuleDialog.kt @@ -39,16 +39,17 @@ import androidx.compose.foundation.layout.requiredSize import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.text.selection.LocalTextSelectionColors import androidx.compose.foundation.text.selection.TextSelectionColors -import androidx.compose.material.ButtonDefaults -import androidx.compose.material.Icon -import androidx.compose.material.LocalContentColor -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text -import androidx.compose.material.TextFieldDefaults import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Add import androidx.compose.material.icons.filled.HelpOutline import androidx.compose.material.icons.filled.Pageview +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.LocalContentColor +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.OutlinedTextFieldDefaults +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.DisposableEffect @@ -65,7 +66,6 @@ import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp @@ -190,7 +190,7 @@ internal fun EditRuleDialog( } else { null }, - neutralColors = ButtonDefaults.textButtonColors(contentColor = MaterialTheme.colors.error), + neutralColors = ButtonDefaults.textButtonColors(contentColor = MaterialTheme.colorScheme.error), onNeutral = { onDeleteRule(initRule) }, ) { Column { @@ -198,7 +198,7 @@ internal fun EditRuleDialog( Text( modifier = Modifier.padding(bottom = 16.dp), text = stringRes(R.string.settings__theme_editor__rule_already_exists), - color = MaterialTheme.colors.error, + color = MaterialTheme.colorScheme.error, ) } @@ -224,7 +224,8 @@ internal fun EditRuleDialog( SnyggLevel.DEVELOPER -> SnyggRule.PRESSED_SELECTOR else -> stringRes(R.string.snygg__rule_selector__pressed) }, - color = if (pressedSelector) MaterialTheme.colors.primaryVariant else Color.Unspecified, + selected = pressedSelector, + color = if (pressedSelector) MaterialTheme.colorScheme.secondary else Color.Unspecified, ) FlorisChip( onClick = { focusSelector = !focusSelector }, @@ -233,7 +234,8 @@ internal fun EditRuleDialog( SnyggLevel.DEVELOPER -> SnyggRule.FOCUS_SELECTOR else -> stringRes(R.string.snygg__rule_selector__focus) }, - color = if (focusSelector) MaterialTheme.colors.primaryVariant else Color.Unspecified, + selected = focusSelector, + color = if (focusSelector) MaterialTheme.colorScheme.secondary else Color.Unspecified, ) FlorisChip( onClick = { disabledSelector = !disabledSelector }, @@ -241,7 +243,8 @@ internal fun EditRuleDialog( SnyggLevel.DEVELOPER -> SnyggRule.DISABLED_SELECTOR else -> stringRes(R.string.snygg__rule_selector__disabled) }, - color = if (disabledSelector) MaterialTheme.colors.primaryVariant else Color.Unspecified, + selected = disabledSelector, + color = if (disabledSelector) MaterialTheme.colorScheme.secondary else Color.Unspecified, ) } } @@ -270,6 +273,7 @@ internal fun EditRuleDialog( FlorisChip( onClick = { editCodeDialogValue = code }, text = code.toString(), + selected = editCodeDialogValue == code, shape = MaterialTheme.shapes.medium, ) } @@ -286,7 +290,8 @@ internal fun EditRuleDialog( } else -> stringRes(R.string.enum__input_shift_state__unshifted) }, - color = if (shiftStateUnshifted) MaterialTheme.colors.primaryVariant else Color.Unspecified, + selected = shiftStateUnshifted, + color = if (shiftStateUnshifted) MaterialTheme.colorScheme.secondary else Color.Unspecified, ) FlorisChip( onClick = { shiftStateShiftedManual = !shiftStateShiftedManual }, @@ -296,7 +301,8 @@ internal fun EditRuleDialog( } else -> stringRes(R.string.enum__input_shift_state__shifted_manual) }, - color = if (shiftStateShiftedManual) MaterialTheme.colors.primaryVariant else Color.Unspecified, + selected = shiftStateShiftedManual, + color = if (shiftStateShiftedManual) MaterialTheme.colorScheme.secondary else Color.Unspecified, ) FlorisChip( onClick = { shiftStateShiftedAutomatic = !shiftStateShiftedAutomatic }, @@ -306,7 +312,8 @@ internal fun EditRuleDialog( } else -> stringRes(R.string.enum__input_shift_state__shifted_automatic) }, - color = if (shiftStateShiftedAutomatic) MaterialTheme.colors.primaryVariant else Color.Unspecified, + selected = shiftStateShiftedAutomatic, + color = if (shiftStateShiftedAutomatic) MaterialTheme.colorScheme.secondary else Color.Unspecified, ) FlorisChip( onClick = { shiftStateCapsLock = !shiftStateCapsLock }, @@ -316,7 +323,8 @@ internal fun EditRuleDialog( } else -> stringRes(R.string.enum__input_shift_state__caps_lock) }, - color = if (shiftStateCapsLock) MaterialTheme.colors.primaryVariant else Color.Unspecified, + selected = shiftStateCapsLock, + color = if (shiftStateCapsLock) MaterialTheme.colorScheme.secondary else Color.Unspecified, ) } } @@ -335,6 +343,7 @@ internal fun EditRuleDialog( } } +@OptIn(ExperimentalMaterial3Api::class) @Composable private fun EditCodeValueDialog( codeValue: Int, @@ -368,7 +377,7 @@ private fun EditCodeValueDialog( val recordingKeyColor = if (isRecordingKey) { rememberInfiniteTransition().animateColor( initialValue = LocalContentColor.current, - targetValue = MaterialTheme.colors.error, + targetValue = MaterialTheme.colorScheme.error, animationSpec = infiniteRepeatable( tween(750), repeatMode = RepeatMode.Reverse, @@ -461,7 +470,7 @@ private fun EditCodeValueDialog( } else { null }, - neutralColors = ButtonDefaults.textButtonColors(contentColor = MaterialTheme.colors.error), + neutralColors = ButtonDefaults.textButtonColors(contentColor = MaterialTheme.colorScheme.error), onNeutral = { onDelete(codeValue) onDismiss() @@ -526,12 +535,12 @@ private fun EditCodeValueDialog( isError = showError, singleLine = true, colors = if (isRecordingKey) { - TextFieldDefaults.outlinedTextFieldColors( - textColor = Color.Transparent, + OutlinedTextFieldDefaults.colors( + focusedTextColor = Color.Transparent, cursorColor = Color.Transparent, ) } else { - TextFieldDefaults.outlinedTextFieldColors() + OutlinedTextFieldDefaults.colors() }, ) } @@ -550,7 +559,7 @@ private fun EditCodeValueDialog( "i_min" to KeyCode.Spec.INTERNAL_MIN, "i_max" to KeyCode.Spec.INTERNAL_MAX, ), - color = MaterialTheme.colors.error, + color = MaterialTheme.colorScheme.error, ) } } @@ -593,7 +602,7 @@ private fun TextKeyDataPreviewBox( modifier = Modifier .padding(end = 16.dp) .background( - color = MaterialTheme.colors.onSurface.copy(alpha = 0.12f), + color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.12f), shape = MaterialTheme.shapes.medium, ) .height(36.dp) diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/SnyggValueIcon.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/SnyggValueIcon.kt index 6bc55951..fc73e207 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/SnyggValueIcon.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/SnyggValueIcon.kt @@ -25,26 +25,23 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.requiredSize import androidx.compose.foundation.shape.CutCornerShape import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.Icon -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Surface import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.FormatSize import androidx.compose.material.icons.filled.Link import androidx.compose.material.icons.filled.Straighten +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Shape import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import dev.patrickgold.florisboard.R import dev.patrickgold.florisboard.lib.snygg.value.SnyggCutCornerDpShapeValue import dev.patrickgold.florisboard.lib.snygg.value.SnyggDefinedVarValue import dev.patrickgold.florisboard.lib.snygg.value.SnyggDpSizeValue -import dev.patrickgold.florisboard.lib.snygg.value.SnyggMaterialYouLightColorValue import dev.patrickgold.florisboard.lib.snygg.value.SnyggMaterialYouValue import dev.patrickgold.florisboard.lib.snygg.value.SnyggRoundedCornerDpShapeValue import dev.patrickgold.florisboard.lib.snygg.value.SnyggShapeValue @@ -102,7 +99,7 @@ internal fun SnyggValueIcon( Box( modifier = modifier .requiredSize(spec.iconSizeMinusBorder) - .border(spec.borderWith, MaterialTheme.colors.onBackground, value.alwaysPercentShape()) + .border(spec.borderWith, MaterialTheme.colorScheme.onBackground, value.alwaysPercentShape()) ) } is SnyggDpSizeValue -> { @@ -143,7 +140,7 @@ internal fun SnyggValueIcon( .offset(x = 1.dp) .requiredSize(smallSpec.iconSize) .padding(vertical = 2.dp) - .background(MaterialTheme.colors.background, spec.boxShape), + .background(MaterialTheme.colorScheme.background, spec.boxShape), ) Icon( modifier = Modifier.requiredSize(smallSpec.iconSize), @@ -167,8 +164,8 @@ internal fun SnyggValueColorBox( ) { Surface( modifier = modifier.requiredSize(spec.iconSize), - color = MaterialTheme.colors.background, - elevation = spec.elevation, + color = MaterialTheme.colorScheme.background, + shadowElevation = spec.elevation, shape = spec.boxShape, ) { Box( diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/ThemeEditorScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/ThemeEditorScreen.kt index e04430d8..bc8d7c4a 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/ThemeEditorScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/ThemeEditorScreen.kt @@ -33,18 +33,19 @@ import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.selection.toggleable import androidx.compose.foundation.text.KeyboardOptions -import androidx.compose.material.ButtonDefaults -import androidx.compose.material.ExtendedFloatingActionButton -import androidx.compose.material.Icon -import androidx.compose.material.LocalContentColor -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Switch -import androidx.compose.material.Text +import androidx.compose.material.ChipDefaults import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Add import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.filled.Edit import androidx.compose.material.icons.filled.Tune +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.ExtendedFloatingActionButton +import androidx.compose.material3.Icon +import androidx.compose.material3.LocalContentColor +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Switch +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect @@ -62,13 +63,13 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalFocusManager -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import dev.patrickgold.florisboard.R +import dev.patrickgold.florisboard.app.apptheme.Shapes import dev.patrickgold.florisboard.app.ext.ExtensionComponentView import dev.patrickgold.florisboard.app.florisPreferenceModel import dev.patrickgold.florisboard.ime.theme.FlorisImeUiSpec @@ -300,7 +301,7 @@ fun ThemeEditorScreen( Text( modifier = Modifier.padding(bottom = 8.dp, start = 16.dp, end = 16.dp), text = stringRes(R.string.snygg__rule_element__defines_description), - style = MaterialTheme.typography.body2, + style = MaterialTheme.typography.bodyMedium, fontStyle = FontStyle.Italic, ) } @@ -549,9 +550,9 @@ private fun SnyggRuleRow( Text( modifier = Modifier .padding(end = 8.dp) - .background(MaterialTheme.colors.primaryVariant), + .background(MaterialTheme.colorScheme.primaryContainer, shape = Shapes.small), text = text, - style = MaterialTheme.typography.body2, + style = MaterialTheme.typography.bodyMedium, fontFamily = FontFamily.Monospace, maxLines = 1, overflow = TextOverflow.Ellipsis, @@ -562,7 +563,7 @@ private fun SnyggRuleRow( fun AttributesList(text: String, list: String) { Text( text = "$text = $list", - style = MaterialTheme.typography.body2, + style = MaterialTheme.typography.bodyMedium, color = LocalContentColor.current.copy(alpha = 0.56f), fontFamily = FontFamily.Monospace, maxLines = 1, @@ -582,7 +583,7 @@ private fun SnyggRuleRow( ) { Text( text = translateElementName(rule, level), - style = MaterialTheme.typography.body2, + style = MaterialTheme.typography.bodyMedium, fontFamily = FontFamily.Monospace, maxLines = 1, overflow = TextOverflow.Ellipsis, @@ -618,14 +619,14 @@ private fun SnyggRuleRow( FlorisIconButton( onClick = onEditRuleBtnClick, icon = Icons.Default.Edit, - iconColor = MaterialTheme.colors.primary, + iconColor = MaterialTheme.colorScheme.primary, iconModifier = Modifier.size(ButtonDefaults.IconSize), ) } FlorisIconButton( onClick = onAddPropertyBtnClick, icon = Icons.Default.Add, - iconColor = MaterialTheme.colors.secondary, + iconColor = MaterialTheme.colorScheme.secondary, iconModifier = Modifier.size(ButtonDefaults.IconSize), ) } @@ -645,7 +646,7 @@ internal fun DialogProperty( .weight(1f) .padding(vertical = 8.dp), text = text, - style = MaterialTheme.typography.subtitle2, + style = MaterialTheme.typography.titleSmall, ) trailingIconTitle() } diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/ThemeManagerScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/ThemeManagerScreen.kt index 076888ac..11e55545 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/ThemeManagerScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/ThemeManagerScreen.kt @@ -21,11 +21,6 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.material.ButtonDefaults -import androidx.compose.material.Icon -import androidx.compose.material.LocalContentColor -import androidx.compose.material.MaterialTheme -import androidx.compose.material.RadioButton import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Add import androidx.compose.material.icons.filled.DarkMode @@ -33,6 +28,11 @@ import androidx.compose.material.icons.filled.Delete import androidx.compose.material.icons.filled.Edit import androidx.compose.material.icons.filled.Input import androidx.compose.material.icons.filled.LightMode +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Icon +import androidx.compose.material3.LocalContentColor +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.RadioButton import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.getValue @@ -204,7 +204,7 @@ fun ThemeManagerScreen(action: ThemeManagerScreenAction?) = FlorisScreen { icon = Icons.Default.Delete, text = stringRes(R.string.action__delete), colors = ButtonDefaults.textButtonColors( - contentColor = MaterialTheme.colors.error, + contentColor = MaterialTheme.colorScheme.error, ), ) Spacer(modifier = Modifier.weight(1f)) diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/ThemeScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/ThemeScreen.kt index a854aba0..c9a49e7c 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/ThemeScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/theme/ThemeScreen.kt @@ -18,15 +18,15 @@ package dev.patrickgold.florisboard.app.settings.theme import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding -import androidx.compose.material.Button -import androidx.compose.material.Card -import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.BrightnessAuto import androidx.compose.material.icons.filled.DarkMode import androidx.compose.material.icons.filled.FormatPaint import androidx.compose.material.icons.filled.LightMode import androidx.compose.material.icons.outlined.Palette +import androidx.compose.material3.Button +import androidx.compose.material3.Card +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/typing/SpellCheckerServiceSelector.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/typing/SpellCheckerServiceSelector.kt index 12bbe9e4..7dddf25b 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/typing/SpellCheckerServiceSelector.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/typing/SpellCheckerServiceSelector.kt @@ -23,16 +23,15 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.requiredSize -import androidx.compose.material.Icon import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.HelpOutline +import androidx.compose.material3.Icon import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp import dev.patrickgold.florisboard.R import dev.patrickgold.florisboard.lib.android.AndroidSettings diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/typing/TypingScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/typing/TypingScreen.kt index bd2f19b7..91b8b523 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/typing/TypingScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/settings/typing/TypingScreen.kt @@ -18,13 +18,13 @@ package dev.patrickgold.florisboard.app.settings.typing import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding -import androidx.compose.material.Card -import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Contacts import androidx.compose.material.icons.filled.Language import androidx.compose.material.icons.filled.LibraryBooks import androidx.compose.material.icons.filled.SpaceBar +import androidx.compose.material3.Card +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/app/setup/SetupScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/app/setup/SetupScreen.kt index f5687539..8931f3ec 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/app/setup/SetupScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/app/setup/SetupScreen.kt @@ -28,8 +28,8 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.material.Text -import androidx.compose.material.TextButton +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/ime/clipboard/ClipboardInputLayout.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/ime/clipboard/ClipboardInputLayout.kt index 961d86bd..7fa24bb4 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/ime/clipboard/ClipboardInputLayout.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/ime/clipboard/ClipboardInputLayout.kt @@ -46,10 +46,6 @@ import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.foundation.shape.CircleShape -import androidx.compose.material.Button -import androidx.compose.material.ButtonDefaults -import androidx.compose.material.Icon -import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material.icons.filled.ClearAll @@ -58,6 +54,11 @@ import androidx.compose.material.icons.filled.ToggleOff import androidx.compose.material.icons.filled.ToggleOn import androidx.compose.material.icons.filled.Videocam import androidx.compose.material.ripple.rememberRipple +import androidx.compose.material3.Button +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -81,7 +82,6 @@ import androidx.compose.ui.text.style.TextDirection import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import dev.patrickgold.florisboard.R -import dev.patrickgold.florisboard.app.apptheme.Green500 import dev.patrickgold.florisboard.app.florisPreferenceModel import dev.patrickgold.florisboard.clipboardManager import dev.patrickgold.florisboard.ime.ImeUiMode @@ -543,7 +543,7 @@ fun ClipboardInputLayout( .align(Alignment.End), onClick = { prefs.clipboard.historyEnabled.set(true) }, colors = ButtonDefaults.buttonColors( - backgroundColor = Green500, + containerColor = MaterialTheme.colorScheme.primary, contentColor = Color.White, ), ) { diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisAppBar.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisAppBar.kt index 1aa00966..e28c485e 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisAppBar.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisAppBar.kt @@ -17,21 +17,24 @@ package dev.patrickgold.florisboard.lib.compose import androidx.compose.foundation.layout.RowScope -import androidx.compose.material.Text -import androidx.compose.material.TopAppBar +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar +import androidx.compose.material3.TopAppBarDefaults +import androidx.compose.material3.TopAppBarScrollBehavior import androidx.compose.runtime.Composable -import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.style.TextOverflow -import androidx.compose.ui.unit.dp +@OptIn(ExperimentalMaterial3Api::class) @Composable fun FlorisAppBar( title: String, navigationIcon: FlorisScreenNavigationIcon?, actions: @Composable RowScope.() -> Unit = { }, + scrollBehavior: TopAppBarScrollBehavior ) { TopAppBar( - navigationIcon = navigationIcon, + navigationIcon = navigationIcon ?: {}, title = { Text( text = title, @@ -40,7 +43,7 @@ fun FlorisAppBar( ) }, actions = actions, - backgroundColor = Color.Transparent, - elevation = 0.dp, + colors = TopAppBarDefaults.topAppBarColors(), + scrollBehavior = scrollBehavior ) } diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisBulletSpacer.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisBulletSpacer.kt index 77405c50..9c243a97 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisBulletSpacer.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisBulletSpacer.kt @@ -22,13 +22,12 @@ import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape -import androidx.compose.material.MaterialTheme +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.unit.dp -import dev.patrickgold.florisboard.app.apptheme.outline @Composable fun RowScope.FlorisBulletSpacer( @@ -40,6 +39,6 @@ fun RowScope.FlorisBulletSpacer( .padding(horizontal = 8.dp) .size(4.dp) .clip(CircleShape) - .background(MaterialTheme.colors.outline), + .background(MaterialTheme.colorScheme.outline), ) } diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisButtonBar.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisButtonBar.kt index ca0d1f0b..62a70c7c 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisButtonBar.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisButtonBar.kt @@ -16,7 +16,6 @@ package dev.patrickgold.florisboard.lib.compose -import androidx.annotation.DrawableRes import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope @@ -24,33 +23,32 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.material.Button -import androidx.compose.material.ButtonDefaults -import androidx.compose.material.Icon -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Surface -import androidx.compose.material.Text -import androidx.compose.material.TextButton +import androidx.compose.material3.Button +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp @Composable fun FlorisButtonBar(content: @Composable FlorisButtonBarScope.() -> Unit) { Surface( modifier = Modifier.fillMaxWidth(), - color = MaterialTheme.colors.background, - elevation = 8.dp, + color = MaterialTheme.colorScheme.background, + tonalElevation = 8.dp, ) { Column { Surface( modifier = Modifier .fillMaxWidth() .height(1.dp), - color = MaterialTheme.colors.surface, + color = MaterialTheme.colorScheme.surface, ) {} Row( modifier = Modifier @@ -77,8 +75,8 @@ class FlorisButtonBarScope(rowScope: RowScope) : RowScope by rowScope { modifier = modifier.padding(start = 16.dp), enabled = enabled, colors = ButtonDefaults.buttonColors( - backgroundColor = MaterialTheme.colors.primary, - contentColor = MaterialTheme.colors.onPrimary, + containerColor = MaterialTheme.colorScheme.primary, + contentColor = MaterialTheme.colorScheme.onPrimary, ), onClick = onClick, ) { @@ -105,7 +103,7 @@ class FlorisButtonBarScope(rowScope: RowScope) : RowScope by rowScope { modifier = modifier.padding(start = 16.dp), enabled = enabled, colors = ButtonDefaults.textButtonColors( - contentColor = MaterialTheme.colors.primary, + contentColor = MaterialTheme.colorScheme.primary, ), onClick = onClick, ) { diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisButtons.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisButtons.kt index 0073e016..cc4daa5e 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisButtons.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisButtons.kt @@ -22,21 +22,21 @@ import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.material.Button -import androidx.compose.material.ButtonColors -import androidx.compose.material.ButtonDefaults -import androidx.compose.material.Icon -import androidx.compose.material.IconButton -import androidx.compose.material.LocalContentAlpha -import androidx.compose.material.LocalContentColor -import androidx.compose.material.MaterialTheme -import androidx.compose.material.OutlinedButton -import androidx.compose.material.Text -import androidx.compose.material.TextButton +import androidx.compose.material3.Button +import androidx.compose.material3.ButtonColors +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.LocalContentColor +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.OutlinedButton +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.alpha import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Shape import androidx.compose.ui.graphics.takeOrElse @@ -114,7 +114,7 @@ fun FlorisTextButton( icon: ImageVector? = null, text: String, enabled: Boolean = true, - shape: Shape = MaterialTheme.shapes.small, + shape: Shape = ButtonDefaults.shape, contentPadding: PaddingValues = ButtonDefaults.TextButtonContentPadding, colors: ButtonColors = ButtonDefaults.textButtonColors(), ) { @@ -153,10 +153,9 @@ fun FlorisIconButton( enabled = enabled, onClick = onClick, ) { - val contentAlpha = if (enabled) LocalContentAlpha.current else 0.14f - val contentColor = iconColor.takeOrElse { LocalContentColor.current } + val contentAlpha = if (enabled) 1f else 0.14f + val contentColor = iconColor.takeOrElse { LocalContentColor.current }.copy(alpha = contentAlpha) CompositionLocalProvider( - LocalContentAlpha provides contentAlpha, LocalContentColor provides contentColor, ) { Icon( @@ -182,9 +181,8 @@ fun FlorisIconButtonWithInnerPadding( enabled = enabled, onClick = onClick, ) { - val contentAlpha = if (enabled) LocalContentAlpha.current else 0.14f + val contentAlpha = if (enabled) 1f else 0.14f CompositionLocalProvider( - LocalContentAlpha provides contentAlpha, LocalContentColor provides iconColor, ) { Box( @@ -195,6 +193,7 @@ fun FlorisIconButtonWithInnerPadding( contentAlignment = Alignment.Center, ) { Icon( + modifier = modifier.alpha(contentAlpha), imageVector = icon, contentDescription = null, ) diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisCards.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisCards.kt index 18bd5603..077cfcb0 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisCards.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisCards.kt @@ -29,39 +29,36 @@ import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.requiredSize import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.Card -import androidx.compose.material.ExperimentalMaterialApi -import androidx.compose.material.Icon -import androidx.compose.material.LocalContentColor -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text -import androidx.compose.material.contentColorFor import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.ErrorOutline import androidx.compose.material.icons.filled.Info import androidx.compose.material.icons.outlined.Warning +import androidx.compose.material3.Card +import androidx.compose.material3.CardDefaults +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.LocalContentColor +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Shape -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import dev.patrickgold.florisboard.R -import dev.patrickgold.florisboard.app.apptheme.outline -object CardDefaults { +object FlorisCardDefaults { val IconRequiredSize = 24.dp - val IconSpacing = 8.dp + val IconSpacing = 12.dp - val ContentPadding = PaddingValues(vertical = 8.dp, horizontal = 16.dp) + val ContentPadding = PaddingValues(start = 0.dp, end = 16.dp, top = 8.dp, bottom = 8.dp) } object BoxDefaults { @@ -70,15 +67,14 @@ object BoxDefaults { val ContentPadding = PaddingValues(all = 0.dp) } -@OptIn(ExperimentalMaterialApi::class) @Composable fun FlorisSimpleCard( modifier: Modifier = Modifier, text: String, secondaryText: String? = null, - backgroundColor: Color = MaterialTheme.colors.surface, - contentColor: Color = contentColorFor(backgroundColor), - contentPadding: PaddingValues = CardDefaults.ContentPadding, + backgroundColor: Color = MaterialTheme.colorScheme.surfaceContainer, + contentColor: Color = MaterialTheme.colorScheme.onSurface, + contentPadding: PaddingValues = FlorisCardDefaults.ContentPadding, icon: (@Composable () -> Unit)? = null, onClick: (() -> Unit)? = null, ) { @@ -86,8 +82,14 @@ fun FlorisSimpleCard( onClick = onClick ?: { }, enabled = onClick != null, modifier = modifier.fillMaxWidth(), - backgroundColor = backgroundColor, - contentColor = contentColor, + colors = CardDefaults.cardColors( + contentColor = contentColor, + containerColor = backgroundColor, + disabledContainerColor = backgroundColor, + disabledContentColor = contentColor, + ) + //backgroundColor = backgroundColor, + //contentColor = contentColor, ) { Row( modifier = Modifier.padding(contentPadding), @@ -99,18 +101,18 @@ fun FlorisSimpleCard( Column( modifier = Modifier .weight(1f) - .padding(start = if (icon != null) 16.dp else 0.dp), + .padding(start = if (icon == null) 16.dp else 0.dp), ) { Text( modifier = Modifier.fillMaxWidth(), text = text, - style = MaterialTheme.typography.subtitle1, + style = MaterialTheme.typography.titleMedium, ) if (secondaryText != null) { Text( modifier = Modifier.fillMaxWidth(), text = secondaryText, - style = MaterialTheme.typography.subtitle2, + style = MaterialTheme.typography.titleSmall, ) } } @@ -123,18 +125,18 @@ fun FlorisErrorCard( text: String, modifier: Modifier = Modifier, showIcon: Boolean = true, - contentPadding: PaddingValues = CardDefaults.ContentPadding, + contentPadding: PaddingValues = FlorisCardDefaults.ContentPadding, onClick: (() -> Unit)? = null, ) { FlorisSimpleCard( modifier = modifier, - backgroundColor = Color(0xFFCC0000), + backgroundColor = Color.Red, contentColor = Color.White, onClick = onClick, icon = if (showIcon) ({ Icon( modifier = Modifier - .padding(end = CardDefaults.IconSpacing) - .requiredSize(CardDefaults.IconRequiredSize), + .padding(all = FlorisCardDefaults.IconSpacing) + .requiredSize(FlorisCardDefaults.IconRequiredSize), imageVector = Icons.Default.ErrorOutline, contentDescription = null, ) }) else null, @@ -148,7 +150,7 @@ fun FlorisWarningCard( text: String, modifier: Modifier = Modifier, showIcon: Boolean = true, - contentPadding: PaddingValues = CardDefaults.ContentPadding, + contentPadding: PaddingValues = FlorisCardDefaults.ContentPadding, onClick: (() -> Unit)? = null, ) { FlorisSimpleCard( @@ -158,8 +160,8 @@ fun FlorisWarningCard( onClick = onClick, icon = if (showIcon) ({ Icon( modifier = Modifier - .padding(end = CardDefaults.IconSpacing) - .requiredSize(CardDefaults.IconRequiredSize), + .padding(all = FlorisCardDefaults.IconSpacing) + .requiredSize(FlorisCardDefaults.IconRequiredSize), imageVector = Icons.Outlined.Warning, contentDescription = null, ) }) else null, @@ -173,7 +175,7 @@ fun FlorisInfoCard( text: String, modifier: Modifier = Modifier, showIcon: Boolean = true, - contentPadding: PaddingValues = CardDefaults.ContentPadding, + contentPadding: PaddingValues = FlorisCardDefaults.ContentPadding, onClick: (() -> Unit)? = null, ) { FlorisSimpleCard( @@ -181,8 +183,8 @@ fun FlorisInfoCard( onClick = onClick, icon = if (showIcon) ({ Icon( modifier = Modifier - .padding(end = CardDefaults.IconSpacing) - .requiredSize(CardDefaults.IconRequiredSize), + .padding(all = FlorisCardDefaults.IconSpacing) + .requiredSize(FlorisCardDefaults.IconRequiredSize), imageVector = Icons.Default.Info, contentDescription = null, ) }) else null, @@ -199,7 +201,7 @@ fun FlorisOutlinedBox( subtitle: String? = null, onSubtitleClick: (() -> Unit)? = null, borderWidth: Dp = 1.dp, - borderColor: Color = MaterialTheme.colors.outline, + borderColor: Color = MaterialTheme.colorScheme.outlineVariant, shape: Shape = BoxDefaults.OutlinedBoxShape, contentPadding: PaddingValues = BoxDefaults.ContentPadding, content: @Composable ColumnScope.() -> Unit, @@ -209,7 +211,7 @@ fun FlorisOutlinedBox( title = { Text( text = title, - style = MaterialTheme.typography.subtitle2, + style = MaterialTheme.typography.titleSmall, maxLines = 1, overflow = TextOverflow.Ellipsis, ) @@ -249,7 +251,7 @@ fun FlorisOutlinedBox( subtitle: (@Composable () -> Unit)? = null, onSubtitleClick: (() -> Unit)? = null, borderWidth: Dp = 1.dp, - borderColor: Color = MaterialTheme.colors.outline, + borderColor: Color = MaterialTheme.colorScheme.outlineVariant, shape: Shape = BoxDefaults.OutlinedBoxShape, contentPadding: PaddingValues = BoxDefaults.ContentPadding, content: @Composable ColumnScope.() -> Unit, @@ -287,7 +289,7 @@ fun FlorisOutlinedBox( modifier = Modifier .height(23.dp) .offset(x = 10.dp, y = (-12).dp) - .background(MaterialTheme.colors.background) + .background(MaterialTheme.colorScheme.background) .rippleClickable(enabled = onTitleClick != null) { onTitleClick!!() } diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisChip.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisChip.kt index b69a6e88..e9edc019 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisChip.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisChip.kt @@ -16,44 +16,82 @@ package dev.patrickgold.florisboard.lib.compose -import androidx.annotation.DrawableRes import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.foundation.shape.CircleShape -import androidx.compose.material.ExperimentalMaterialApi -import androidx.compose.material.Icon -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Surface -import androidx.compose.material.Text -import androidx.compose.material.TextFieldDefaults +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.InputChip +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Shape import androidx.compose.ui.graphics.takeOrElse import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp -@OptIn(ExperimentalMaterialApi::class) +@OptIn(ExperimentalMaterial3Api::class) @Composable fun FlorisChip( text: String, modifier: Modifier = Modifier, onClick: () -> Unit = { }, + selected: Boolean = false, enabled: Boolean = true, color: Color = Color.Unspecified, - shape: Shape = CircleShape, + shape: Shape = MaterialTheme.shapes.small, leadingIcons: List = listOf(), trailingIcons: List = listOf(), ) { val backgroundColor = color.takeOrElse { - MaterialTheme.colors.onSurface.copy(alpha = TextFieldDefaults.BackgroundOpacity) + MaterialTheme.colorScheme.onSurface.copy() } - Surface( + + InputChip( + selected = selected, + onClick = onClick, + enabled = enabled, + shape = shape, + label = { + Text( + text = text, + maxLines = 1, + overflow = TextOverflow.Ellipsis + ) + }, + modifier = modifier, + leadingIcon = { + Row { + for (leadingIcon in leadingIcons) { + Icon( + modifier = Modifier + .padding(end = 8.dp) + .size(16.dp), + imageVector = leadingIcon, + contentDescription = null, + ) + } + } + }, + trailingIcon = { + Row { + for (trailingIcon in trailingIcons) { + Icon( + modifier = Modifier + .padding(start = 8.dp) + .size(16.dp), + imageVector = trailingIcon, + contentDescription = null, + ) + } + } + } + ) + + /*Surface( modifier = modifier, onClick = onClick, enabled = enabled, @@ -67,7 +105,9 @@ fun FlorisChip( ) { for (leadingIcon in leadingIcons) { Icon( - modifier = Modifier.padding(end = 8.dp).size(16.dp), + modifier = Modifier + .padding(end = 8.dp) + .size(16.dp), imageVector = leadingIcon, contentDescription = null, ) @@ -79,11 +119,13 @@ fun FlorisChip( ) for (trailingIcon in trailingIcons) { Icon( - modifier = Modifier.padding(start = 8.dp).size(16.dp), + modifier = Modifier + .padding(start = 8.dp) + .size(16.dp), imageVector = trailingIcon, contentDescription = null, ) } } - } + }*/ } diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisDialogs.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisDialogs.kt index 05efd156..65f58195 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisDialogs.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisDialogs.kt @@ -16,7 +16,7 @@ package dev.patrickgold.florisboard.lib.compose -import androidx.compose.material.Text +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import dev.patrickgold.florisboard.R diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisDropdownMenu.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisDropdownMenu.kt index 7dc9fd05..5e2f8aac 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisDropdownMenu.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisDropdownMenu.kt @@ -21,17 +21,17 @@ import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.wrapContentSize -import androidx.compose.material.ButtonDefaults -import androidx.compose.material.ContentAlpha -import androidx.compose.material.DropdownMenu -import androidx.compose.material.DropdownMenuItem -import androidx.compose.material.Icon -import androidx.compose.material.MaterialTheme -import androidx.compose.material.OutlinedButton -import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight import androidx.compose.material.icons.filled.KeyboardArrowDown +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.DropdownMenu +import androidx.compose.material3.DropdownMenuItem +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.OutlinedButton +import androidx.compose.material3.ShapeDefaults +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment @@ -40,7 +40,6 @@ import androidx.compose.ui.draw.rotate import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow -import dev.patrickgold.florisboard.app.apptheme.outline @Composable fun FlorisDropdownMenu( @@ -64,19 +63,20 @@ fun FlorisDropdownMenu( val indicatorRotation by animateFloatAsState(targetValue = if (expanded) 180f else 0f) val index = selectedIndex.coerceIn(items.indices) val color = if (!enabled) { - MaterialTheme.colors.outline + MaterialTheme.colorScheme.outline } else if (isError) { - MaterialTheme.colors.error + MaterialTheme.colorScheme.error } else { - MaterialTheme.colors.onBackground + MaterialTheme.colorScheme.onBackground } OutlinedButton( modifier = Modifier.fillMaxWidth(), border = if (isError && enabled) { - BorderStroke(ButtonDefaults.OutlinedBorderSize, MaterialTheme.colors.error) + BorderStroke(ButtonDefaults.outlinedButtonBorder.width, MaterialTheme.colorScheme.error) } else { - ButtonDefaults.outlinedBorder + ButtonDefaults.outlinedButtonBorder }, + shape = ShapeDefaults.ExtraSmall, enabled = enabled, onClick = onExpandRequest, ) { @@ -93,7 +93,7 @@ fun FlorisDropdownMenu( modifier = Modifier.rotate(indicatorRotation), imageVector = Icons.Filled.KeyboardArrowDown, tint = if (enabled) { - color.copy(alpha = ContentAlpha.medium) + color.copy(alpha = 0.74f) //Also test 0.60f } else { color }, @@ -106,13 +106,14 @@ fun FlorisDropdownMenu( ) { for ((n, item) in items.withIndex()) { DropdownMenuItem( + text = { + Text(text = asString(item)) + }, onClick = { onSelectItem(n) onDismissRequest() }, - ) { - Text(text = asString(item)) - } + ) } } } @@ -127,18 +128,19 @@ fun FlorisDropdownLikeButton( ) { Box(modifier = modifier.wrapContentSize(Alignment.TopStart)) { val color = if (isError) { - MaterialTheme.colors.error + MaterialTheme.colorScheme.error } else { - MaterialTheme.colors.onBackground + MaterialTheme.colorScheme.onBackground } OutlinedButton( modifier = Modifier .fillMaxWidth(), border = if (isError) { - BorderStroke(ButtonDefaults.OutlinedBorderSize, MaterialTheme.colors.error) + BorderStroke(ButtonDefaults.outlinedButtonBorder.width, MaterialTheme.colorScheme.error) } else { - ButtonDefaults.outlinedBorder + ButtonDefaults.outlinedButtonBorder }, + shape = ShapeDefaults.ExtraSmall, onClick = onClick, ) { Text( @@ -152,7 +154,7 @@ fun FlorisDropdownLikeButton( ) Icon( imageVector = Icons.AutoMirrored.Filled.KeyboardArrowRight, - tint = color.copy(alpha = ContentAlpha.medium), + tint = color.copy(alpha = 0.74f), //Also test 0.60f contentDescription = "Dropdown indicator", ) } diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisHyperlinkText.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisHyperlinkText.kt index cf05a729..c214a93c 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisHyperlinkText.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisHyperlinkText.kt @@ -17,8 +17,8 @@ package dev.patrickgold.florisboard.lib.compose import androidx.compose.foundation.clickable -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -32,7 +32,7 @@ fun FlorisHyperlinkText( url: String, modifier: Modifier = Modifier, enabled: Boolean = true, - color: Color = MaterialTheme.colors.primary, + color: Color = MaterialTheme.colorScheme.primary, ) { val context = LocalContext.current diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisScreen.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisScreen.kt index 9ecff689..5716acf5 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisScreen.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisScreen.kt @@ -16,12 +16,15 @@ package dev.patrickgold.florisboard.lib.compose +import android.app.Activity import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.material.Scaffold import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Scaffold +import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.SideEffect import androidx.compose.runtime.getValue @@ -29,8 +32,10 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource -import dev.patrickgold.florisboard.R +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.toArgb +import androidx.compose.ui.input.nestedscroll.nestedScroll +import androidx.compose.ui.platform.LocalContext import dev.patrickgold.florisboard.app.AppPrefs import dev.patrickgold.florisboard.app.LocalNavController import dev.patrickgold.florisboard.app.florisPreferenceModel @@ -112,29 +117,38 @@ private class FlorisScreenScopeImpl : FlorisScreenScope { this.navigationIcon = navigationIcon } + @OptIn(ExperimentalMaterial3Api::class) @Composable fun Render() { + val context = LocalContext.current val previewFieldController = LocalPreviewFieldController.current SideEffect { + val window = (context as Activity).window previewFieldController?.isVisible = previewFieldVisible + window.statusBarColor = Color.Transparent.toArgb() + window.navigationBarColor = Color.Transparent.toArgb() } + val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior() + Scaffold( - topBar = { FlorisAppBar(title, navigationIcon.takeIf { navigationIconVisible }, actions) }, + modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection), + topBar = { FlorisAppBar(title, navigationIcon.takeIf { navigationIconVisible }, actions, scrollBehavior) }, bottomBar = bottomBar, floatingActionButton = fab, ) { innerPadding -> - val modifier = if (scrollable) { + val scrollModifier = if (scrollable) { Modifier.florisVerticalScroll() } else { Modifier - } + } PreferenceLayout( florisPreferenceModel(), - modifier = modifier + modifier = Modifier .padding(innerPadding) - .fillMaxWidth(), + .fillMaxWidth() + .then(scrollModifier), iconSpaceReserved = iconSpaceReserved, content = content, ) diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisStepLayout.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisStepLayout.kt index 6b0acae4..507635e3 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisStepLayout.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisStepLayout.kt @@ -35,19 +35,17 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape -import androidx.compose.material.Button -import androidx.compose.material.ButtonDefaults -import androidx.compose.material.ContentAlpha -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text -import androidx.compose.material.contentColorFor +import androidx.compose.material3.Button +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.material3.contentColorFor import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState import androidx.compose.runtime.State import androidx.compose.runtime.getValue import androidx.compose.runtime.key import androidx.compose.runtime.mutableIntStateOf -import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.saveable.Saver import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -61,7 +59,6 @@ import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp -import dev.patrickgold.florisboard.app.apptheme.outline private val StepHeaderPaddingVertical = 8.dp private val StepHeaderNumberBoxSize = 40.dp @@ -105,7 +102,7 @@ class FlorisStepLayoutScope( .align(Alignment.CenterHorizontally) .padding(top = 16.dp), colors = ButtonDefaults.buttonColors( - backgroundColor = primaryColor, + containerColor = primaryColor, ), onClick = onClick, ) { @@ -162,7 +159,7 @@ fun FlorisStepLayout( stepState: FlorisStepState, steps: List, modifier: Modifier = Modifier, - primaryColor: Color = MaterialTheme.colors.primary, + primaryColor: Color = MaterialTheme.colorScheme.primary, header: @Composable FlorisStepLayoutScope.() -> Unit = { }, footer: @Composable FlorisStepLayoutScope.() -> Unit = { }, ) { @@ -200,14 +197,14 @@ private fun ColumnScope.Step( val autoStepId by stepState.getCurrentAuto() val backgroundColor = when (ownStepId) { currentStepId -> primaryColor - else -> MaterialTheme.colors.outline + else -> primaryColor.copy(alpha = 0.38f) } val contentVisible = ownStepId == currentStepId StepHeader( modifier = when { ownStepId <= autoStepId -> Modifier .clickable(enabled = !contentVisible) { stepState.setCurrentManual(ownStepId) } - else -> Modifier.alpha(ContentAlpha.disabled) + else -> Modifier.alpha(0.38f) }, backgroundColor = backgroundColor, step = ownStepId, @@ -226,7 +223,7 @@ private fun ColumnScope.Step( enter = fadeIn(animationSpec = animSpec), exit = fadeOut(animationSpec = animSpec), ) { - val onBackground = MaterialTheme.colors.onSurface + val onBackground = MaterialTheme.colorScheme.onSurface Box( modifier = Modifier .padding(start = 56.dp) diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisTextFields.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisTextFields.kt index ecef52c3..9ba31946 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisTextFields.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/FlorisTextFields.kt @@ -26,13 +26,13 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.text.BasicTextField import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions -import androidx.compose.material.ButtonDefaults -import androidx.compose.material.MaterialTheme -import androidx.compose.material.ProvideTextStyle -import androidx.compose.material.Surface -import androidx.compose.material.Text -import androidx.compose.material.TextFieldColors -import androidx.compose.material.TextFieldDefaults +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.OutlinedTextFieldDefaults +import androidx.compose.material3.ProvideTextStyle +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.material3.TextFieldColors import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.getValue @@ -51,7 +51,6 @@ import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.text.style.TextDirection import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp -import dev.patrickgold.florisboard.app.apptheme.outline import dev.patrickgold.florisboard.lib.ValidationResult @Composable @@ -74,7 +73,7 @@ fun FlorisOutlinedTextField( visualTransformation: VisualTransformation = VisualTransformation.None, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, shape: Shape = MaterialTheme.shapes.small, - colors: TextFieldColors = TextFieldDefaults.outlinedTextFieldColors(), + colors: TextFieldColors = OutlinedTextFieldDefaults.colors(), ) { var textFieldValueState by remember { mutableStateOf(TextFieldValue(text = value)) } val textFieldValue = textFieldValueState.copy(text = value) @@ -127,13 +126,17 @@ fun FlorisOutlinedTextField( visualTransformation: VisualTransformation = VisualTransformation.None, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, shape: Shape = MaterialTheme.shapes.small, - colors: TextFieldColors = TextFieldDefaults.outlinedTextFieldColors( - unfocusedBorderColor = MaterialTheme.colors.outline, - disabledBorderColor = MaterialTheme.colors.outline, + colors: TextFieldColors = OutlinedTextFieldDefaults.colors( + unfocusedBorderColor = MaterialTheme.colorScheme.outline, + disabledBorderColor = MaterialTheme.colorScheme.outline, ), ) { val textColor = textStyle.color.takeOrElse { - colors.textColor(enabled).value + if (!enabled) { + colors.disabledTextColor + } else { + colors.unfocusedTextColor + } } val mergedTextStyle = textStyle.copy(color = textColor, textDirection = TextDirection.Content) val isFocused by interactionSource.collectIsFocusedAsState() @@ -152,17 +155,33 @@ fun FlorisOutlinedTextField( singleLine = singleLine, maxLines = maxLines, visualTransformation = visualTransformation, - cursorBrush = SolidColor(colors.cursorColor(isErrorState).value), + cursorBrush = SolidColor( + if (isErrorState) { + colors.errorCursorColor + } else { + colors.cursorColor + } + ), decorationBox = { innerTextField -> Surface( modifier = modifier.fillMaxWidth(), - color = colors.backgroundColor(enabled).value, + color = if (enabled) { + if (isErrorState) { + colors.errorContainerColor + } else if (isFocused) { + colors.focusedContainerColor + } else { + colors.unfocusedContainerColor + } + } else { + colors.disabledContainerColor + }, border = if (isErrorState && enabled) { - BorderStroke(ButtonDefaults.OutlinedBorderSize, MaterialTheme.colors.error) + BorderStroke(ButtonDefaults.outlinedButtonBorder.width, MaterialTheme.colorScheme.error) } else if (isFocused) { - BorderStroke(ButtonDefaults.OutlinedBorderSize, MaterialTheme.colors.primary) + BorderStroke(ButtonDefaults.outlinedButtonBorder.width, MaterialTheme.colorScheme.primary) } else { - ButtonDefaults.outlinedBorder + ButtonDefaults.outlinedButtonBorder }, shape = shape, ) { @@ -181,8 +200,8 @@ fun FlorisOutlinedTextField( if (!placeholder.isNullOrBlank()) { Text( text = placeholder, - style = MaterialTheme.typography.body2, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.56f), + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.56f), ) } } @@ -194,16 +213,16 @@ fun FlorisOutlinedTextField( if (showValidationHint && validationResult?.isValid() == true && validationResult.hasHintMessage()) { Text( text = validationResult.hintMessage(), - style = MaterialTheme.typography.body2, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.56f), + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.56f), ) } if (showValidationError && validationResult?.isInvalid() == true && validationResult.hasErrorMessage()) { Text( text = validationResult.errorMessage(), - style = MaterialTheme.typography.body2, - color = MaterialTheme.colors.error, + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.error, ) } } diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/PreviewKeyboardField.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/PreviewKeyboardField.kt index 7995cfb5..b5bd357f 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/PreviewKeyboardField.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/PreviewKeyboardField.kt @@ -25,14 +25,15 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.text.selection.SelectionContainer -import androidx.compose.material.Icon -import androidx.compose.material.IconButton -import androidx.compose.material.LocalTextStyle -import androidx.compose.material.Text -import androidx.compose.material.TextField -import androidx.compose.material.TextFieldDefaults import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Keyboard +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.LocalTextStyle +import androidx.compose.material3.Text +import androidx.compose.material3.TextField +import androidx.compose.material3.TextFieldDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -50,7 +51,6 @@ import androidx.compose.ui.input.key.key import androidx.compose.ui.input.key.onPreviewKeyEvent import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalFocusManager -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.text.style.TextDirection import androidx.compose.ui.text.style.TextOverflow @@ -77,7 +77,7 @@ class PreviewFieldController { var text by mutableStateOf(TextFieldValue("")) } -@OptIn(ExperimentalComposeUiApi::class) +@OptIn(ExperimentalComposeUiApi::class, ExperimentalMaterial3Api::class) @Composable fun PreviewKeyboardField( controller: PreviewFieldController, @@ -134,7 +134,7 @@ fun PreviewKeyboardField( keyboardOptions = KeyboardOptions(autoCorrect = true), singleLine = true, shape = RectangleShape, - colors = TextFieldDefaults.textFieldColors( + colors = TextFieldDefaults.colors( focusedIndicatorColor = Color.Transparent, unfocusedIndicatorColor = Color.Transparent, disabledIndicatorColor = Color.Transparent, diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/ScrollableModifiers.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/ScrollableModifiers.kt index 44811415..498c4405 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/ScrollableModifiers.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/ScrollableModifiers.kt @@ -28,8 +28,9 @@ import androidx.compose.foundation.lazy.grid.LazyGridItemInfo import androidx.compose.foundation.lazy.grid.LazyGridState import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll -import androidx.compose.material.MaterialTheme +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -44,7 +45,6 @@ import androidx.compose.ui.graphics.takeOrElse import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import kotlinx.coroutines.delay -import java.lang.Math.min private val DefaultScrollbarSize = 4.dp // IgnoreInVeryFastOut (basically) @@ -88,7 +88,7 @@ fun Modifier.florisScrollbar( targetValue = targetAlpha, animationSpec = tween(durationMillis = duration, easing = ScrollbarAnimationEasing), ) - val scrollbarColor = MaterialTheme.colors.onSurface.copy(alpha = 0.28f) + val scrollbarColor = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.28f) LaunchedEffect(Unit) { delay(1850) @@ -144,14 +144,14 @@ fun Modifier.florisScrollbar( targetValue = targetAlpha, animationSpec = tween(durationMillis = duration, easing = ScrollbarAnimationEasing), ) - val scrollbarColor = color.takeOrElse { MaterialTheme.colors.onSurface.copy(alpha = 0.28f) } + val scrollbarColor = color.takeOrElse { MaterialTheme.colorScheme.onSurface.copy(alpha = 0.28f) } LaunchedEffect(Unit) { delay(1850) isInitial = false } - val visibleItemsInfo = state.layoutInfo.visibleItemsInfo + val visibleItemsInfo = remember { derivedStateOf { state.layoutInfo } }.value.visibleItemsInfo val visibleItems = if (visibleItemsInfo.isNotEmpty()) remember { visibleItemsInfo.size } else 0 drawWithContent { drawContent() @@ -199,15 +199,15 @@ fun Modifier.florisScrollbar( targetValue = targetAlpha, animationSpec = tween(durationMillis = duration, easing = ScrollbarAnimationEasing), ) - val scrollbarColor = color.takeOrElse { MaterialTheme.colors.onSurface.copy(alpha = 0.28f) } + val scrollbarColor = color.takeOrElse { MaterialTheme.colorScheme.onSurface.copy(alpha = 0.28f) } LaunchedEffect(Unit) { delay(1850) isInitial = false } - val orientation = state.layoutInfo.orientation - val visibleItemsInfo = state.layoutInfo.visibleItemsInfo + val orientation = remember { derivedStateOf { state.layoutInfo } }.value.orientation + val visibleItemsInfo = remember { derivedStateOf { state.layoutInfo } }.value.visibleItemsInfo val visibleItems = if (visibleItemsInfo.isNotEmpty()) remember { visibleItemsInfo.size } else 0 val last = visibleItemsInfo.lastOrNull() val stacks = if (last != null && orientation == Orientation.Vertical) { @@ -233,13 +233,13 @@ fun Modifier.florisScrollbar( scrollbarWidth = size.toPx() scrollbarOffsetX = this.size.width - scrollbarWidth scrollbarOffsetY = (firstVisibleElementIndex - stacks*percentOffset(first, orientation)) * elementHeight - scrollbarHeight = min(visibleItems * elementHeight, this.size.height - scrollbarOffsetY) + scrollbarHeight = (visibleItems * elementHeight).coerceAtMost(this.size.height - scrollbarOffsetY) } else { val elementWidth = this.size.width / state.layoutInfo.totalItemsCount scrollbarHeight = size.toPx() scrollbarOffsetX = (firstVisibleElementIndex - stacks*percentOffset(first, orientation)) * elementWidth scrollbarOffsetY = this.size.height - scrollbarHeight - scrollbarWidth = min(visibleItems * elementWidth, this.size.height - scrollbarOffsetX) + scrollbarWidth = (visibleItems * elementWidth).coerceAtMost(this.size.height - scrollbarOffsetX) } drawRect( diff --git a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/SystemUi.kt b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/SystemUi.kt index cf2049b3..43ee16e8 100644 --- a/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/SystemUi.kt +++ b/app/src/main/kotlin/dev/patrickgold/florisboard/lib/compose/SystemUi.kt @@ -22,7 +22,6 @@ import android.content.ContextWrapper import android.inputmethodservice.InputMethodService import android.view.View import android.view.Window -import androidx.compose.material.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.SideEffect import androidx.compose.runtime.remember @@ -39,25 +38,6 @@ import dev.patrickgold.florisboard.ime.theme.FlorisImeUi import dev.patrickgold.florisboard.lib.android.AndroidVersion import dev.patrickgold.florisboard.lib.snygg.ui.solidColor -@Composable -fun SystemUiApp() { - val systemUiController = rememberFlorisSystemUiController() - val useDarkIcons = MaterialTheme.colors.isLight - - SideEffect { - systemUiController.setStatusBarColor( - color = Color.Transparent, - darkIcons = useDarkIcons, - ) - if (AndroidVersion.ATLEAST_API26_O) { - systemUiController.setNavigationBarColor( - color = Color.Transparent, - darkIcons = useDarkIcons, - navigationBarContrastEnforced = false, - ) - } - } -} @Composable fun SystemUiIme() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 70198607..3c868b1e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -434,6 +434,7 @@ Light Dark AMOLED Dark + Use Material You Settings language Show app icon in launcher Always enabled on Android 10+ due to restrictions of the system diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e1ceccf7..7032d94b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -24,7 +24,7 @@ ksp = "1.9.22-1.0.17" mannodermaus-android-junit5 = "1.10.0.0" mikepenz-aboutlibraries = "10.10.0" patrickgold-compose-tooltip = "0.1.0" -patrickgold-jetpref = "0.1.0-rc02" +patrickgold-jetpref = "0.2.0-beta01" xmlutil = "0.86.3" # Testing @@ -62,7 +62,7 @@ cache4k = { module = "io.github.reactivecircus.cache4k:cache4k", version.ref = " kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" } kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization-json" } mikepenz-aboutlibraries-core = { module = "com.mikepenz:aboutlibraries-core", version.ref = "mikepenz-aboutlibraries" } -mikepenz-aboutlibraries-compose = { module = "com.mikepenz:aboutlibraries-compose", version.ref = "mikepenz-aboutlibraries" } +mikepenz-aboutlibraries-compose = { module = "com.mikepenz:aboutlibraries-compose-m3", version.ref = "mikepenz-aboutlibraries" } patrickgold-compose-tooltip = { module = "dev.patrickgold.compose.tooltip:tooltip", version.ref = "patrickgold-compose-tooltip" } patrickgold-jetpref-datastore-model = { module = "dev.patrickgold.jetpref:jetpref-datastore-model", version.ref = "patrickgold-jetpref" } patrickgold-jetpref-datastore-ui = { module = "dev.patrickgold.jetpref:jetpref-datastore-ui", version.ref = "patrickgold-jetpref" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 1191d00c..806cb080 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -29,7 +29,7 @@ dependencyResolutionManagement { google() mavenCentral() // Uncomment the following if testing snapshots from Maven Central - // maven("https://s01.oss.sonatype.org/content/repositories/snapshots") + //maven("https://s01.oss.sonatype.org/content/repositories/snapshots") } }