Skip to content

Commit 7f4b026

Browse files
committed
dependency updates + android style updates
1 parent 1b88df9 commit 7f4b026

File tree

10 files changed

+82
-95
lines changed

10 files changed

+82
-95
lines changed

androidApp/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@ dependencies {
4545
implementation(platform(libs.androidx.compose.bom))
4646
implementation(libs.androidx.compose.foundation)
4747
implementation(libs.androidx.compose.foundation.layout)
48-
implementation(libs.androidx.compose.material)
4948
implementation(libs.androidx.compose.runtime)
5049
implementation(libs.androidx.compose.ui)
5150
implementation(libs.androidx.compose.ui.tooling)
5251
implementation(libs.androidx.compose.material3)
53-
implementation(libs.accompanist.insets)
5452
}

androidApp/src/main/AndroidManifest.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
77

88
<application
9-
android:name=".WordMasterApplication"
10-
android:allowBackup="false"
11-
android:supportsRtl="true"
12-
android:usesCleartextTraffic="true"
13-
android:theme="@style/AppTheme">
9+
android:name=".WordMasterApplication"
10+
android:allowBackup="false"
11+
android:supportsRtl="true"
12+
android:usesCleartextTraffic="true"
13+
android:theme="@android:style/Theme.Material.Light.NoActionBar">
1414
<activity android:name=".MainActivity"
1515
android:exported="true"
1616
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden">

androidApp/src/main/java/dev/johnoreilly/wordmaster/androidApp/MainActivity.kt

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,18 @@ import android.annotation.SuppressLint
44
import android.os.Bundle
55
import androidx.activity.ComponentActivity
66
import androidx.activity.compose.setContent
7+
import androidx.activity.enableEdgeToEdge
78
import androidx.compose.foundation.background
89
import androidx.compose.foundation.border
910
import androidx.compose.foundation.layout.*
1011
import androidx.compose.foundation.layout.Arrangement.Absolute.Center
11-
import androidx.compose.material.*
12+
import androidx.compose.material3.Button
13+
import androidx.compose.material3.ExperimentalMaterial3Api
14+
import androidx.compose.material3.Scaffold
15+
import androidx.compose.material3.Text
16+
import androidx.compose.material3.TextField
17+
import androidx.compose.material3.TextFieldDefaults
18+
import androidx.compose.material3.TopAppBar
1219
import androidx.compose.runtime.*
1320
import androidx.compose.ui.Alignment
1421
import androidx.compose.ui.Modifier
@@ -22,24 +29,19 @@ import androidx.compose.ui.text.TextStyle
2229
import androidx.compose.ui.text.style.TextAlign
2330
import androidx.compose.ui.unit.dp
2431
import androidx.compose.ui.unit.sp
25-
import androidx.core.view.WindowCompat.setDecorFitsSystemWindows
26-
import com.google.accompanist.insets.ProvideWindowInsets
27-
import com.google.accompanist.insets.statusBarsPadding
2832
import dev.johnoreilly.wordmaster.shared.LetterStatus
2933
import dev.johnoreilly.wordmaster.shared.WordMasterService
3034
import dev.johnoreilly.wordmaster.androidApp.theme.WordMasterTheme
3135

3236

3337
class MainActivity : ComponentActivity() {
3438
override fun onCreate(savedInstanceState: Bundle?) {
39+
enableEdgeToEdge()
3540
super.onCreate(savedInstanceState)
36-
setDecorFitsSystemWindows(window, false)
3741

3842
setContent {
3943
WordMasterTheme {
40-
ProvideWindowInsets {
41-
MainLayout()
42-
}
44+
MainLayout()
4345
}
4446
}
4547
}
@@ -50,14 +52,14 @@ class MainActivity : ComponentActivity() {
5052
fun MainLayout() {
5153
Scaffold(
5254
topBar = { WordMasterTopAppBar("WordMaster KMP") }
53-
) {
54-
WordMasterView()
55+
) { innerPadding ->
56+
WordMasterView(Modifier.padding(innerPadding))
5557
}
5658
}
5759

5860

5961
@Composable
60-
fun WordMasterView() {
62+
fun WordMasterView(padding: Modifier) {
6163
val context = LocalContext.current
6264

6365
val wordMasterService = remember {
@@ -71,7 +73,7 @@ fun WordMasterView() {
7173
val focusManager = LocalFocusManager.current
7274
val focusRequester = remember { FocusRequester() }
7375

74-
Row(Modifier.fillMaxSize().padding(16.dp), horizontalArrangement = Center) {
76+
Row(padding.fillMaxSize().padding(16.dp), horizontalArrangement = Center) {
7577

7678
Column {
7779
for (guessAttempt in 0 until WordMasterService.MAX_NUMBER_OF_GUESSES) {
@@ -101,12 +103,10 @@ fun WordMasterView() {
101103
},
102104
modifier = modifier,
103105
textStyle = TextStyle(fontSize = 14.sp, textAlign = TextAlign.Center),
104-
colors = TextFieldDefaults.textFieldColors(
105-
textColor = mapLetterStatusToTextColor(boardStatus[guessAttempt][character]),
106-
backgroundColor = mapLetterStatusToBackgroundColor(boardStatus[guessAttempt][character]),
107-
unfocusedIndicatorColor = Color.Transparent,
108-
focusedIndicatorColor = Color.Transparent
109-
)
106+
colors = TextFieldDefaults.colors(
107+
unfocusedTextColor = mapLetterStatusToTextColor(boardStatus[guessAttempt][character]),
108+
unfocusedContainerColor = mapLetterStatusToBackgroundColor(boardStatus[guessAttempt][character]),
109+
),
110110
)
111111

112112
DisposableEffect(Unit) {
@@ -155,14 +155,10 @@ fun mapLetterStatusToTextColor(letterStatus: LetterStatus): Color {
155155
}
156156
}
157157

158+
@OptIn(ExperimentalMaterial3Api::class)
158159
@Composable
159160
private fun WordMasterTopAppBar(title: String) {
160-
Surface(color = MaterialTheme.colors.primary) {
161-
TopAppBar(
162-
title = { Text(title) },
163-
backgroundColor = Color.Transparent,
164-
elevation = 0.dp,
165-
modifier = Modifier.statusBarsPadding()
166-
)
167-
}
161+
TopAppBar(
162+
title = { Text(title) },
163+
)
168164
}

androidApp/src/main/java/dev/johnoreilly/wordmaster/androidApp/theme/Color.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ package dev.johnoreilly.wordmaster.androidApp.theme
22

33
import androidx.compose.ui.graphics.Color
44

5-
val Purple200 = Color(0xFFBB86FC)
6-
val Purple500 = Color(0xFF6200EE)
7-
val Purple700 = Color(0xFF3700B3)
8-
val Teal200 = Color(0xFF03DAC5)
5+
val Purple80 = Color(0xFFD0BCFF)
6+
val PurpleGrey80 = Color(0xFFCCC2DC)
7+
val Pink80 = Color(0xFFEFB8C8)
8+
9+
val Purple40 = Color(0xFF6650a4)
10+
val PurpleGrey40 = Color(0xFF625b71)
11+
val Pink40 = Color(0xFF7D5260)

androidApp/src/main/java/dev/johnoreilly/wordmaster/androidApp/theme/Shape.kt

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,57 @@
11
package dev.johnoreilly.wordmaster.androidApp.theme
22

3+
import android.os.Build
34
import androidx.compose.foundation.isSystemInDarkTheme
4-
import androidx.compose.material.MaterialTheme
5-
import androidx.compose.material.darkColors
6-
import androidx.compose.material.lightColors
5+
import androidx.compose.material3.MaterialTheme
6+
import androidx.compose.material3.darkColorScheme
7+
import androidx.compose.material3.dynamicDarkColorScheme
8+
import androidx.compose.material3.dynamicLightColorScheme
9+
import androidx.compose.material3.lightColorScheme
710
import androidx.compose.runtime.Composable
11+
import androidx.compose.ui.platform.LocalContext
812

9-
private val DarkColorPalette = darkColors(
10-
primary = Purple200,
11-
primaryVariant = Purple700,
12-
secondary = Teal200
13+
private val DarkColorScheme = darkColorScheme(
14+
primary = Purple80,
15+
secondary = PurpleGrey80,
16+
tertiary = Pink80
1317
)
1418

15-
private val LightColorPalette = lightColors(
16-
primary = Purple500,
17-
primaryVariant = Purple700,
18-
secondary = Teal200
19+
private val LightColorScheme = lightColorScheme(
20+
primary = Purple40,
21+
secondary = PurpleGrey40,
22+
tertiary = Pink40
1923

2024
/* Other default colors to override
21-
background = Color.White,
22-
surface = Color.White,
25+
background = Color(0xFFFFFBFE),
26+
surface = Color(0xFFFFFBFE),
2327
onPrimary = Color.White,
24-
onSecondary = Color.Black,
25-
onBackground = Color.Black,
26-
onSurface = Color.Black,
28+
onSecondary = Color.White,
29+
onTertiary = Color.White,
30+
onBackground = Color(0xFF1C1B1F),
31+
onSurface = Color(0xFF1C1B1F),
2732
*/
2833
)
2934

3035
@Composable
3136
fun WordMasterTheme(
3237
darkTheme: Boolean = isSystemInDarkTheme(),
33-
content: @Composable() () -> Unit
38+
// Dynamic color is available on Android 12+
39+
dynamicColor: Boolean = true,
40+
content: @Composable () -> Unit
3441
) {
35-
val colors = if (darkTheme) {
36-
DarkColorPalette
37-
} else {
38-
LightColorPalette
42+
val colorScheme = when {
43+
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
44+
val context = LocalContext.current
45+
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
46+
}
47+
48+
darkTheme -> DarkColorScheme
49+
else -> LightColorScheme
3950
}
4051

4152
MaterialTheme(
42-
colors = colors,
53+
colorScheme = colorScheme,
4354
typography = Typography,
44-
shapes = Shapes,
4555
content = content
4656
)
4757
}
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
package dev.johnoreilly.wordmaster.androidApp.theme
22

3-
import androidx.compose.material.Typography
3+
import androidx.compose.material3.Typography
44
import androidx.compose.ui.text.TextStyle
55
import androidx.compose.ui.text.font.FontFamily
66
import androidx.compose.ui.text.font.FontWeight
77
import androidx.compose.ui.unit.sp
88

99
// Set of Material typography styles to start with
1010
val Typography = Typography(
11-
body1 = TextStyle(
11+
bodyLarge = TextStyle(
1212
fontFamily = FontFamily.Default,
1313
fontWeight = FontWeight.Normal,
14-
fontSize = 16.sp
14+
fontSize = 16.sp,
1515
)
1616
/* Other default text styles to override
17-
button = TextStyle(
17+
titleLarge = TextStyle(
1818
fontFamily = FontFamily.Default,
19-
fontWeight = FontWeight.W500,
20-
fontSize = 14.sp
19+
fontWeight = FontWeight.Normal,
20+
fontSize = 22.sp,
21+
lineHeight = 28.sp,
22+
letterSpacing = 0.sp
2123
),
22-
caption = TextStyle(
24+
labelSmall = TextStyle(
2325
fontFamily = FontFamily.Default,
24-
fontWeight = FontWeight.Normal,
25-
fontSize = 12.sp
26+
fontWeight = FontWeight.Medium,
27+
fontSize = 11.sp,
28+
lineHeight = 16.sp,
29+
letterSpacing = 0.5.sp
2630
)
2731
*/
2832
)

androidApp/src/main/res/values/colors.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

androidApp/src/main/res/values/styles.xml

Lines changed: 0 additions & 7 deletions
This file was deleted.

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ ksp = "2.2.0-2.0.2"
44
kotlinx-coroutines = "1.10.2"
55

66

7-
agp = "8.11.0"
7+
agp = "8.11.1"
88
android-compileSdk = "36"
99
android-minSdk = "24"
1010
android-targetSdk = "36"
1111
androidx-activityCompose = "1.10.1"
12-
androidxComposeBom = "2025.06.01"
12+
androidxComposeBom = "2025.07.00"
1313
compose-plugin = "1.8.2"
1414
accompanist = "0.30.1"
1515
kmp-nativecoroutines = "1.0.0-ALPHA-45"

0 commit comments

Comments
 (0)