Update to Sdk34
This commit is contained in:
@@ -36,6 +36,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||
@@ -51,7 +52,6 @@ import me.zobrist.tichucounter.domain.SettingsAdapter
|
||||
import me.zobrist.tichucounter.domain.Theme
|
||||
import me.zobrist.tichucounter.domain.TopBarAction
|
||||
import me.zobrist.tichucounter.domain.TopBarState
|
||||
import me.zobrist.tichucounter.domain.composable
|
||||
import me.zobrist.tichucounter.domain.navigate
|
||||
import me.zobrist.tichucounter.ui.AppTheme
|
||||
import me.zobrist.tichucounter.ui.MainViewModel
|
||||
@@ -202,7 +202,7 @@ class MainActivity : AppCompatActivity(), ISettingsChangeListener {
|
||||
startDestination = Route.COUNTER.name,
|
||||
modifier = Modifier.padding(paddings)
|
||||
) {
|
||||
composable(Route.COUNTER) {
|
||||
composable(Route.COUNTER.name) {
|
||||
|
||||
var expanded by remember { mutableStateOf(false) }
|
||||
|
||||
@@ -246,7 +246,7 @@ class MainActivity : AppCompatActivity(), ISettingsChangeListener {
|
||||
|
||||
Counter(counterViewModel)
|
||||
}
|
||||
composable(Route.HISTORY) {
|
||||
composable(Route.HISTORY.name) {
|
||||
topBarState =
|
||||
TopBarState(title = stringResource(R.string.menu_history)) { scope.launch { drawerState.open() } }
|
||||
|
||||
@@ -255,14 +255,14 @@ class MainActivity : AppCompatActivity(), ISettingsChangeListener {
|
||||
snackbarHostState
|
||||
) { navController.navigate(Route.COUNTER) }
|
||||
}
|
||||
composable(Route.SETTINGS) {
|
||||
composable(Route.SETTINGS.name) {
|
||||
topBarState =
|
||||
TopBarState(title = stringResource(R.string.menu_settings)) { scope.launch { drawerState.open() } }
|
||||
|
||||
SettingsView(settingsViewModel)
|
||||
}
|
||||
|
||||
composable(Route.ABOUT) {
|
||||
composable(Route.ABOUT.name) {
|
||||
topBarState =
|
||||
TopBarState(title = stringResource(R.string.menu_about)) { scope.launch { drawerState.open() } }
|
||||
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
package me.zobrist.tichucounter.domain
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.navigation.NamedNavArgument
|
||||
import androidx.navigation.NavBackStackEntry
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.NavDeepLink
|
||||
import androidx.navigation.NavGraphBuilder
|
||||
import androidx.navigation.compose.composable
|
||||
|
||||
fun NavController.navigate(route: Route) {
|
||||
this.navigate(route.name) {
|
||||
@@ -23,12 +17,3 @@ fun NavController.navigate(route: Route) {
|
||||
restoreState = true
|
||||
}
|
||||
}
|
||||
|
||||
fun NavGraphBuilder.composable(
|
||||
route: Route,
|
||||
arguments: List<NamedNavArgument> = emptyList(),
|
||||
deepLinks: List<NavDeepLink> = emptyList(),
|
||||
content: @Composable (NavBackStackEntry) -> Unit
|
||||
) {
|
||||
this.composable(route.name, arguments, deepLinks, content)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package me.zobrist.tichucounter.ui.counter
|
||||
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
@@ -71,10 +72,10 @@ class CounterViewModel @Inject constructor(
|
||||
override var roundScoreList by mutableStateOf(emptyList<Round>())
|
||||
private set
|
||||
|
||||
override var totalScoreA by mutableStateOf(0)
|
||||
override var totalScoreA by mutableIntStateOf(0)
|
||||
private set
|
||||
|
||||
override var totalScoreB by mutableStateOf(0)
|
||||
override var totalScoreB by mutableIntStateOf(0)
|
||||
private set
|
||||
|
||||
override var teamNameA by mutableStateOf("")
|
||||
|
||||
@@ -10,12 +10,9 @@ import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.requiredWidth
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.LazyListState
|
||||
import androidx.compose.foundation.lazy.items
|
||||
@@ -299,7 +296,7 @@ fun HistoryListItem(
|
||||
Row(
|
||||
Modifier.padding(all = 12.dp)
|
||||
) {
|
||||
Box( modifier = modifier.fillMaxSize()) {
|
||||
Box(modifier = modifier.fillMaxSize()) {
|
||||
Column {
|
||||
Text(
|
||||
text = game.game.nameA + " vs " + game.game.nameB,
|
||||
@@ -321,7 +318,8 @@ fun HistoryListItem(
|
||||
Badge(
|
||||
modifier = Modifier.align(TopEnd),
|
||||
contentColor = MaterialTheme.colorScheme.onPrimary,
|
||||
containerColor = MaterialTheme.colorScheme.primary) {
|
||||
containerColor = MaterialTheme.colorScheme.primary
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.active),
|
||||
style = MaterialTheme.typography.labelSmall
|
||||
@@ -338,7 +336,8 @@ fun HistoryListItem(
|
||||
private fun HistoryListPreview() {
|
||||
val tempData = listOf(
|
||||
GameWithScores(
|
||||
Game(true, "abcsdf sdaf asdf sdf ", "defsadf asdf sadf ", Date(), Date()), listOf(Round(1, 550, 500))
|
||||
Game(true, "abcsdf sdaf asdf sdf ", "defsadf asdf sadf ", Date(), Date()),
|
||||
listOf(Round(1, 550, 500))
|
||||
), GameWithScores(
|
||||
Game(false, "ADTH", "dogfg", Date(), Date()), listOf(Round(2, 20, 60))
|
||||
), GameWithScores(
|
||||
|
||||
Reference in New Issue
Block a user