From 07219bffb42ce61c9f7f434601fb60d6a50f0071 Mon Sep 17 00:00:00 2001 From: Fabian Zobrist Date: Sat, 19 Aug 2023 16:05:41 +0200 Subject: [PATCH 1/6] Update dependencies. --- app/build.gradle | 7 +++---- build.gradle | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 663caf8..d5be58c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,7 +24,7 @@ versionProperties.load(new FileInputStream(versionPropertiesFile)) android { - compileSdkVersion 33 + compileSdk 33 defaultConfig { applicationId "me.zobrist.tichucounter" @@ -63,12 +63,11 @@ android { } buildFeatures { - viewBinding = true compose = true } composeOptions { - kotlinCompilerExtensionVersion = "1.4.7" + kotlinCompilerExtensionVersion = "1.4.8" } compileOptions { @@ -91,7 +90,7 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation 'androidx.core:core-ktx:1.10.1' implementation 'androidx.appcompat:appcompat:1.6.1' - implementation "androidx.compose.material3:material3:1.1.0" + implementation "androidx.compose.material3:material3:1.1.1" implementation 'com.google.android.play:core-ktx:1.8.1' implementation 'com.google.android.play:core-ktx:1.8.1' implementation 'com.google.code.gson:gson:2.9.0' diff --git a/build.gradle b/build.gradle index 24af24d..dc84979 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,12 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = "1.8.21" + ext.kotlin_version = "1.8.22" repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.0.2' + classpath 'com.android.tools.build:gradle:8.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong -- 2.49.1 From ec3b51051a8ecf44a4dc62339bd58f059e00a719 Mon Sep 17 00:00:00 2001 From: Fabian Zobrist Date: Sat, 19 Aug 2023 17:50:41 +0200 Subject: [PATCH 2/6] Add swipe to open and delete to history items. --- .../me/zobrist/tichucounter/MainActivity.kt | 43 ++++- .../tichucounter/ui/counter/KeyboardView.kt | 31 +++- .../tichucounter/ui/counter/TeamNamesView.kt | 9 +- .../tichucounter/ui/history/HistoryView.kt | 175 ++++++++++-------- .../tichucounter/ui/layout/DrawerContent.kt | 22 ++- app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 7 files changed, 185 insertions(+), 97 deletions(-) diff --git a/app/src/main/java/me/zobrist/tichucounter/MainActivity.kt b/app/src/main/java/me/zobrist/tichucounter/MainActivity.kt index 0aacbf2..fdb1e87 100644 --- a/app/src/main/java/me/zobrist/tichucounter/MainActivity.kt +++ b/app/src/main/java/me/zobrist/tichucounter/MainActivity.kt @@ -6,12 +6,30 @@ import androidx.activity.compose.setContent import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatDelegate -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.layout.padding import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.* -import androidx.compose.material.icons.outlined.* -import androidx.compose.material3.* -import androidx.compose.runtime.* +import androidx.compose.material.icons.outlined.Calculate +import androidx.compose.material.icons.outlined.Info +import androidx.compose.material.icons.outlined.Keyboard +import androidx.compose.material.icons.outlined.List +import androidx.compose.material.icons.outlined.MoreVert +import androidx.compose.material.icons.outlined.Redo +import androidx.compose.material.icons.outlined.Settings +import androidx.compose.material.icons.outlined.Undo +import androidx.compose.material3.DrawerState +import androidx.compose.material3.DrawerValue +import androidx.compose.material3.FloatingActionButton +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.ModalNavigationDrawer +import androidx.compose.material3.Scaffold +import androidx.compose.material3.rememberDrawerState +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.navigation.NavHostController @@ -22,12 +40,23 @@ import com.google.accompanist.systemuicontroller.rememberSystemUiController import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch -import me.zobrist.tichucounter.domain.* +import me.zobrist.tichucounter.domain.DrawerItem +import me.zobrist.tichucounter.domain.ISettingsChangeListener +import me.zobrist.tichucounter.domain.KeepScreenOn +import me.zobrist.tichucounter.domain.Language +import me.zobrist.tichucounter.domain.Route +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 import me.zobrist.tichucounter.ui.about.AboutView import me.zobrist.tichucounter.ui.composables.DropDownMenu -import me.zobrist.tichucounter.ui.counter.* +import me.zobrist.tichucounter.ui.counter.Counter +import me.zobrist.tichucounter.ui.counter.CounterViewModel import me.zobrist.tichucounter.ui.history.HistoryList import me.zobrist.tichucounter.ui.history.HistoryViewModel import me.zobrist.tichucounter.ui.layout.DrawerContent diff --git a/app/src/main/java/me/zobrist/tichucounter/ui/counter/KeyboardView.kt b/app/src/main/java/me/zobrist/tichucounter/ui/counter/KeyboardView.kt index 3ab3407..32fd620 100644 --- a/app/src/main/java/me/zobrist/tichucounter/ui/counter/KeyboardView.kt +++ b/app/src/main/java/me/zobrist/tichucounter/ui/counter/KeyboardView.kt @@ -1,17 +1,40 @@ package me.zobrist.tichucounter.ui.counter import android.content.res.Configuration -import androidx.compose.animation.core.* +import androidx.compose.animation.core.RepeatMode +import androidx.compose.animation.core.animateFloat +import androidx.compose.animation.core.infiniteRepeatable +import androidx.compose.animation.core.rememberInfiniteTransition +import androidx.compose.animation.core.tween import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.interaction.collectIsPressedAsState -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.IntrinsicSize +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.layout.wrapContentWidth import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Backspace import androidx.compose.material.icons.outlined.Check import androidx.compose.material.icons.outlined.KeyboardHide import androidx.compose.material.icons.outlined.SwapHoriz -import androidx.compose.material3.* -import androidx.compose.runtime.* +import androidx.compose.material3.Divider +import androidx.compose.material3.ElevatedButton +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.LocalTextStyle +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.material3.TextField +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester diff --git a/app/src/main/java/me/zobrist/tichucounter/ui/counter/TeamNamesView.kt b/app/src/main/java/me/zobrist/tichucounter/ui/counter/TeamNamesView.kt index 9527c73..2e911a9 100644 --- a/app/src/main/java/me/zobrist/tichucounter/ui/counter/TeamNamesView.kt +++ b/app/src/main/java/me/zobrist/tichucounter/ui/counter/TeamNamesView.kt @@ -1,9 +1,12 @@ package me.zobrist.tichucounter.ui.counter import android.content.res.Configuration -import androidx.compose.foundation.layout.* -import androidx.compose.material3.* -import androidx.compose.runtime.* +import androidx.compose.foundation.layout.Row +import androidx.compose.material3.LocalTextStyle +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.TextFieldDefaults +import androidx.compose.material3.surfaceColorAtElevation +import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview diff --git a/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryView.kt b/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryView.kt index fa6eabe..e0d40b6 100644 --- a/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryView.kt +++ b/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryView.kt @@ -1,34 +1,45 @@ package me.zobrist.tichucounter.ui.history -import androidx.compose.foundation.clickable +import androidx.compose.animation.animateColorAsState +import androidx.compose.animation.core.animateFloatAsState +import androidx.compose.foundation.background +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.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.width -import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.Delete import androidx.compose.material.icons.outlined.DeleteForever -import androidx.compose.material.icons.outlined.MoreVert +import androidx.compose.material.icons.outlined.RestartAlt import androidx.compose.material3.AlertDialog import androidx.compose.material3.Button import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults +import androidx.compose.material3.DismissDirection +import androidx.compose.material3.DismissValue +import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.SwipeToDismiss import androidx.compose.material3.Text import androidx.compose.material3.TextButton +import androidx.compose.material3.rememberDismissState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment.Companion.CenterVertically import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.scale +import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview @@ -38,7 +49,6 @@ import me.zobrist.tichucounter.data.GameWithScores import me.zobrist.tichucounter.data.entity.Game import me.zobrist.tichucounter.data.entity.Round import me.zobrist.tichucounter.domain.getTotalPoints -import me.zobrist.tichucounter.ui.composables.DropDownMenu import java.text.DateFormat import java.util.Date import java.util.Locale @@ -46,8 +56,7 @@ import java.util.Locale @Composable fun HistoryList( - viewModel: HistoryViewModel, - navigateToCalculator: () -> Unit + viewModel: HistoryViewModel, navigateToCalculator: () -> Unit ) { var showDeleteDialog by remember { mutableStateOf(false) } @@ -78,14 +87,12 @@ fun DeleteConfirmDialog(show: Boolean = true, onExecuted: (Boolean) -> Unit = {} AlertDialog( onDismissRequest = { onExecuted(false) }, dismissButton = { - TextButton({ onExecuted(false) }) - { + TextButton({ onExecuted(false) }) { Text(stringResource(R.string.cancel)) } }, confirmButton = { - TextButton({ onExecuted(true) }) - { + TextButton({ onExecuted(true) }) { Text(stringResource(R.string.ok)) } }, @@ -98,8 +105,8 @@ fun DeleteConfirmDialog(show: Boolean = true, onExecuted: (Boolean) -> Unit = {} @Composable fun HistoryList( games: List, - onOpenClicked: (GameId: Long) -> Unit, - onDeleteClicked: (GameId: Long) -> Unit, + onOpenClicked: (gameId: Long) -> Unit, + onDeleteClicked: (gameId: Long) -> Unit, onDeleteAllClicked: () -> Unit ) { @@ -113,7 +120,7 @@ fun HistoryList( ) } items(games.filter { it.game.active }) { - HistoryListItem(it, onOpenClicked, onDeleteClicked) + HistoryListItem(it) } if (games.count() > 1) { @@ -125,13 +132,14 @@ fun HistoryList( ) } - items(games.filter { !it.game.active }) { - HistoryListItem(it, onOpenClicked, onDeleteClicked) + items(items = games.filter { !it.game.active }, key = { + it.hashCode() + }) { + DismissibleHistoryListItem(it, onOpenClicked, onDeleteClicked) } item { - Button( - enabled = games.count() > 1, + Button(enabled = games.count() > 1, modifier = Modifier .padding(start = 4.dp, end = 4.dp, top = 10.dp) .align(CenterVertically) @@ -146,11 +154,70 @@ fun HistoryList( } } +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun DismissibleHistoryListItem( + game: GameWithScores, + onOpenClicked: (gameId: Long) -> Unit, + onDeleteClicked: (gameId: Long) -> Unit +) { + val dismissState = rememberDismissState(confirmValueChange = { + if (it == DismissValue.DismissedToStart) { + onDeleteClicked(game.game.uid) + } + if (it == DismissValue.DismissedToEnd) { + onOpenClicked(game.game.uid) + } + true + }) + + SwipeToDismiss(state = dismissState, background = { + val direction = dismissState.dismissDirection ?: return@SwipeToDismiss + val color by animateColorAsState( + when (dismissState.targetValue) { + DismissValue.DismissedToStart -> Color.Red + else -> MaterialTheme.colorScheme.background + + }, label = "" + ) + val alignment = when (direction) { + DismissDirection.StartToEnd -> Alignment.CenterStart + DismissDirection.EndToStart -> Alignment.CenterEnd + } + val icon = when (direction) { + DismissDirection.StartToEnd -> Icons.Outlined.RestartAlt + DismissDirection.EndToStart -> Icons.Outlined.Delete + } + val text = when (direction) { + DismissDirection.StartToEnd -> stringResource(id = R.string.activate) + DismissDirection.EndToStart -> stringResource(id = R.string.delete) + } + val scale by animateFloatAsState( + if (dismissState.targetValue == DismissValue.Default) 0.75f else 1f, label = "" + ) + + Box( + Modifier + .fillMaxSize() + .background(color) + .padding(horizontal = 20.dp), + contentAlignment = alignment + ) { + Row { + Icon( + icon, contentDescription = null, modifier = Modifier.scale(scale) + ) + Text(text = text) + } + } + }, dismissContent = { + HistoryListItem(game = game) + }) +} + @Composable fun HistoryListItem( - game: GameWithScores, - onOpenClicked: (GameId: Long) -> Unit, - onDeleteClicked: (GameId: Long) -> Unit + game: GameWithScores ) { val format = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, Locale.getDefault()) @@ -168,13 +235,10 @@ fun HistoryListItem( Card( modifier = Modifier .fillMaxWidth() - .padding(all = 4.dp) - .clickable { onOpenClicked(game.game.uid) }, - colors = cardColor + .padding(all = 4.dp), colors = cardColor ) { Row( - Modifier - .padding(all = 12.dp) + Modifier.padding(all = 12.dp) ) { Column(Modifier.weight(4f)) { Text( @@ -193,38 +257,6 @@ fun HistoryListItem( style = MaterialTheme.typography.labelSmall ) } - Column( - Modifier - .wrapContentSize() - .width(40.dp) - ) { - - if (!game.game.active) { - var expanded by remember { mutableStateOf(false) } - - Icon( - modifier = Modifier - .padding(start = 20.dp, bottom = 20.dp) - .clickable { expanded = true }, - imageVector = Icons.Outlined.MoreVert, - contentDescription = null - ) - - - DropDownMenu( - mapOf("delete" to R.string.delete), - "", - expanded, - ) { - expanded = false - it?.let { - when (it) { - "delete" -> onDeleteClicked(game.game.uid) - } - } - } - } - } } } } @@ -234,24 +266,15 @@ fun HistoryListItem( private fun HistoryListPreview() { val tempData = listOf( GameWithScores( - Game(true, "abc", "def", Date(), Date()), - listOf(Round(1, 550, 500)) - ), - GameWithScores( - Game(false, "ADTH", "dogfg", Date(), Date()), - listOf(Round(2, 20, 60)) - ), - GameWithScores( - Game(false, "TeamA3 langer Name", "TeamB3", Date(), Date()), - listOf(Round(3, 30, 70)) - ), - GameWithScores( - Game(false, "TeamA4", "TeamB4", Date(), Date()), - listOf(Round(4, 40, 80)) - ), - GameWithScores( - Game(false, "TeamA5", "TeamB5", Date(), Date()), - listOf(Round(5, 50, 90)) + Game(true, "abc", "def", Date(), Date()), listOf(Round(1, 550, 500)) + ), GameWithScores( + Game(false, "ADTH", "dogfg", Date(), Date()), listOf(Round(2, 20, 60)) + ), GameWithScores( + Game(false, "TeamA3 langer Name", "TeamB3", Date(), Date()), listOf(Round(3, 30, 70)) + ), GameWithScores( + Game(false, "TeamA4", "TeamB4", Date(), Date()), listOf(Round(4, 40, 80)) + ), GameWithScores( + Game(false, "TeamA5", "TeamB5", Date(), Date()), listOf(Round(5, 50, 90)) ) ) HistoryList(tempData, {}, {}) {} diff --git a/app/src/main/java/me/zobrist/tichucounter/ui/layout/DrawerContent.kt b/app/src/main/java/me/zobrist/tichucounter/ui/layout/DrawerContent.kt index 1dd1b55..eaf1f43 100644 --- a/app/src/main/java/me/zobrist/tichucounter/ui/layout/DrawerContent.kt +++ b/app/src/main/java/me/zobrist/tichucounter/ui/layout/DrawerContent.kt @@ -1,20 +1,28 @@ package me.zobrist.tichucounter.ui.layout import android.content.res.Configuration -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.layout.padding import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.* -import androidx.compose.material.icons.outlined.* -import androidx.compose.material3.* -import androidx.compose.runtime.* +import androidx.compose.material.icons.outlined.Calculate +import androidx.compose.material.icons.outlined.List +import androidx.compose.material.icons.outlined.Settings +import androidx.compose.material3.Divider +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.ModalDrawerSheet +import androidx.compose.material3.NavigationDrawerItem +import androidx.compose.material3.NavigationDrawerItemDefaults +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import me.zobrist.tichucounter.R -import me.zobrist.tichucounter.domain.* +import me.zobrist.tichucounter.domain.DrawerItem +import me.zobrist.tichucounter.domain.Route import me.zobrist.tichucounter.ui.AppTheme -import me.zobrist.tichucounter.ui.counter.* @Composable fun DrawerContent( diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index ae3d8f6..bee00f7 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -24,5 +24,6 @@ Counter About Schreib uns + Aktivieren \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 48012ba..65e0d14 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -28,4 +28,5 @@ About Contact us Play Store + Activate \ No newline at end of file -- 2.49.1 From c8098fc90417c1e42406dfa87267b297b51f752f Mon Sep 17 00:00:00 2001 From: Fabian Zobrist Date: Sun, 20 Aug 2023 12:31:20 +0200 Subject: [PATCH 3/6] Increase dismiss threshold. Change translation of continue. --- .../zobrist/tichucounter/ui/history/HistoryView.kt | 13 ++++++++++--- app/src/main/res/values-de/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryView.kt b/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryView.kt index e0d40b6..97ae917 100644 --- a/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryView.kt +++ b/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryView.kt @@ -4,6 +4,7 @@ package me.zobrist.tichucounter.ui.history import androidx.compose.animation.animateColorAsState import androidx.compose.animation.core.animateFloatAsState import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -40,6 +41,7 @@ import androidx.compose.ui.Alignment.Companion.CenterVertically import androidx.compose.ui.Modifier import androidx.compose.ui.draw.scale import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview @@ -161,7 +163,11 @@ fun DismissibleHistoryListItem( onOpenClicked: (gameId: Long) -> Unit, onDeleteClicked: (gameId: Long) -> Unit ) { - val dismissState = rememberDismissState(confirmValueChange = { + + val density = LocalDensity.current + val dismissState = rememberDismissState( + positionalThreshold = { with(density) { 100.dp.toPx() } }, + confirmValueChange = { if (it == DismissValue.DismissedToStart) { onDeleteClicked(game.game.uid) } @@ -189,7 +195,7 @@ fun DismissibleHistoryListItem( DismissDirection.EndToStart -> Icons.Outlined.Delete } val text = when (direction) { - DismissDirection.StartToEnd -> stringResource(id = R.string.activate) + DismissDirection.StartToEnd -> stringResource(id = R.string.continue_play) DismissDirection.EndToStart -> stringResource(id = R.string.delete) } val scale by animateFloatAsState( @@ -203,7 +209,8 @@ fun DismissibleHistoryListItem( .padding(horizontal = 20.dp), contentAlignment = alignment ) { - Row { + Column(verticalArrangement = Arrangement.Center, + horizontalAlignment = Alignment.CenterHorizontally) { Icon( icon, contentDescription = null, modifier = Modifier.scale(scale) ) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index bee00f7..98e1a74 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -24,6 +24,6 @@ Counter About Schreib uns - Aktivieren + Weiterspielen \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 65e0d14..d688695 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -28,5 +28,5 @@ About Contact us Play Store - Activate + Continue \ No newline at end of file -- 2.49.1 From 55a2293b6ca1cf026d63a343d7d8696225d0cebe Mon Sep 17 00:00:00 2001 From: Fabian Zobrist Date: Sun, 20 Aug 2023 22:20:45 +0200 Subject: [PATCH 4/6] Show snackbar with undo option. Don't jump back to calculator on history click. --- .../me/zobrist/tichucounter/MainActivity.kt | 10 +- .../tichucounter/ui/history/HistoryView.kt | 117 +++++++++++++----- .../ui/history/HistoryViewModel.kt | 13 +- app/src/main/res/values-de/strings.xml | 4 + app/src/main/res/values/strings.xml | 4 + 5 files changed, 114 insertions(+), 34 deletions(-) diff --git a/app/src/main/java/me/zobrist/tichucounter/MainActivity.kt b/app/src/main/java/me/zobrist/tichucounter/MainActivity.kt index fdb1e87..cb9e40b 100644 --- a/app/src/main/java/me/zobrist/tichucounter/MainActivity.kt +++ b/app/src/main/java/me/zobrist/tichucounter/MainActivity.kt @@ -23,6 +23,8 @@ import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.ModalNavigationDrawer import androidx.compose.material3.Scaffold +import androidx.compose.material3.SnackbarHost +import androidx.compose.material3.SnackbarHostState import androidx.compose.material3.rememberDrawerState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -180,8 +182,11 @@ class MainActivity : AppCompatActivity(), ISettingsChangeListener { ) { var topBarState by remember { mutableStateOf(TopBarState()) } + var snackbarHostState by remember { mutableStateOf(SnackbarHostState()) } + val scope = rememberCoroutineScope() Scaffold( + snackbarHost = { SnackbarHost(snackbarHostState) }, floatingActionButton = { if (showFab) { FloatingActionButton( @@ -245,7 +250,10 @@ class MainActivity : AppCompatActivity(), ISettingsChangeListener { topBarState = TopBarState(title = stringResource(R.string.menu_history)) { scope.launch { drawerState.open() } } - HistoryList(historyViewModel) { navController.navigate(Route.COUNTER) } + HistoryList( + historyViewModel, + snackbarHostState + ) { navController.navigate(Route.COUNTER) } } composable(Route.SETTINGS) { topBarState = diff --git a/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryView.kt b/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryView.kt index 97ae917..a8e4ddb 100644 --- a/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryView.kt +++ b/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryView.kt @@ -3,6 +3,7 @@ package me.zobrist.tichucounter.ui.history import androidx.compose.animation.animateColorAsState import androidx.compose.animation.core.animateFloatAsState +import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -13,7 +14,9 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Delete import androidx.compose.material.icons.outlined.DeleteForever @@ -27,6 +30,9 @@ import androidx.compose.material3.DismissValue import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.SnackbarDuration +import androidx.compose.material3.SnackbarHostState +import androidx.compose.material3.SnackbarResult import androidx.compose.material3.SwipeToDismiss import androidx.compose.material3.Text import androidx.compose.material3.TextButton @@ -35,6 +41,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment.Companion.CenterVertically @@ -46,6 +53,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import kotlinx.coroutines.launch import me.zobrist.tichucounter.R import me.zobrist.tichucounter.data.GameWithScores import me.zobrist.tichucounter.data.entity.Game @@ -58,11 +66,15 @@ import java.util.Locale @Composable fun HistoryList( - viewModel: HistoryViewModel, navigateToCalculator: () -> Unit + viewModel: HistoryViewModel, + snackbarHostState: SnackbarHostState, + navigateToCalculator: () -> Unit, ) { - + val scope = rememberCoroutineScope() + val lazyListState = rememberLazyListState() var showDeleteDialog by remember { mutableStateOf(false) } + DeleteConfirmDialog(showDeleteDialog) { showDeleteDialog = false if (it) { @@ -70,14 +82,48 @@ fun HistoryList( } } + val deletedMessage = stringResource(id = R.string.delete_success) + val deletedActionLabel = stringResource(id = R.string.undo_question) + + val activatedMessage = stringResource(id = R.string.activated_success) + val activatedActionLabel = stringResource(id = R.string.to_calculator_question) + HistoryList( - viewModel.gameAndHistory, - { - viewModel.activateGame(it) - navigateToCalculator() + games = viewModel.gameAndHistory, + onOpenClicked = { + scope.launch { + viewModel.activateGame(it) + lazyListState.animateScrollToItem(0) + + val result = snackbarHostState.showSnackbar( + message = activatedMessage, + actionLabel = activatedActionLabel, + duration = SnackbarDuration.Short + ) + + if (result == SnackbarResult.ActionPerformed) { + navigateToCalculator() + } + } }, - { viewModel.deleteGame(it) }, - { showDeleteDialog = true }, + onDeleteClicked = { + scope.launch { + viewModel.markToDelete(it) + val result = snackbarHostState.showSnackbar( + message = deletedMessage, + actionLabel = deletedActionLabel, + duration = SnackbarDuration.Short + ) + + if (result == SnackbarResult.Dismissed) { + viewModel.deleteGame(it) + } else { + viewModel.unmarkToDelete(it) + } + } + }, + onDeleteAllClicked = { showDeleteDialog = true }, + lazyListState = lazyListState ) } @@ -104,16 +150,17 @@ fun DeleteConfirmDialog(show: Boolean = true, onExecuted: (Boolean) -> Unit = {} } } +@OptIn(ExperimentalFoundationApi::class) @Composable fun HistoryList( games: List, onOpenClicked: (gameId: Long) -> Unit, onDeleteClicked: (gameId: Long) -> Unit, - onDeleteAllClicked: () -> Unit - + onDeleteAllClicked: () -> Unit, + lazyListState: LazyListState = LazyListState(), ) { Row { - LazyColumn { + LazyColumn(state = lazyListState) { item { Text( modifier = Modifier.padding(start = 10.dp, end = 10.dp), @@ -122,7 +169,7 @@ fun HistoryList( ) } items(games.filter { it.game.active }) { - HistoryListItem(it) + HistoryListItem(it, Modifier.animateItemPlacement()) } if (games.count() > 1) { @@ -137,7 +184,9 @@ fun HistoryList( items(items = games.filter { !it.game.active }, key = { it.hashCode() }) { - DismissibleHistoryListItem(it, onOpenClicked, onDeleteClicked) + DismissibleHistoryListItem( + it, onOpenClicked, onDeleteClicked, Modifier.animateItemPlacement() + ) } item { @@ -145,7 +194,8 @@ fun HistoryList( modifier = Modifier .padding(start = 4.dp, end = 4.dp, top = 10.dp) .align(CenterVertically) - .fillMaxWidth(), + .fillMaxWidth() + .animateItemPlacement(), onClick = { onDeleteAllClicked() }) { Icon(imageVector = Icons.Outlined.DeleteForever, contentDescription = null) Text(text = stringResource(id = R.string.deleteAll)) @@ -161,23 +211,24 @@ fun HistoryList( fun DismissibleHistoryListItem( game: GameWithScores, onOpenClicked: (gameId: Long) -> Unit, - onDeleteClicked: (gameId: Long) -> Unit + onDeleteClicked: (gameId: Long) -> Unit, + modifier: Modifier = Modifier, ) { val density = LocalDensity.current - val dismissState = rememberDismissState( - positionalThreshold = { with(density) { 100.dp.toPx() } }, - confirmValueChange = { - if (it == DismissValue.DismissedToStart) { - onDeleteClicked(game.game.uid) - } - if (it == DismissValue.DismissedToEnd) { - onOpenClicked(game.game.uid) - } - true - }) + val dismissState = + rememberDismissState(positionalThreshold = { with(density) { 100.dp.toPx() } }, + confirmValueChange = { + if (it == DismissValue.DismissedToStart) { + onDeleteClicked(game.game.uid) + } + if (it == DismissValue.DismissedToEnd) { + onOpenClicked(game.game.uid) + } + true + }) - SwipeToDismiss(state = dismissState, background = { + SwipeToDismiss(modifier = modifier, state = dismissState, background = { val direction = dismissState.dismissDirection ?: return@SwipeToDismiss val color by animateColorAsState( when (dismissState.targetValue) { @@ -209,8 +260,10 @@ fun DismissibleHistoryListItem( .padding(horizontal = 20.dp), contentAlignment = alignment ) { - Column(verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally) { + Column( + verticalArrangement = Arrangement.Center, + horizontalAlignment = Alignment.CenterHorizontally + ) { Icon( icon, contentDescription = null, modifier = Modifier.scale(scale) ) @@ -224,7 +277,7 @@ fun DismissibleHistoryListItem( @Composable fun HistoryListItem( - game: GameWithScores + game: GameWithScores, modifier: Modifier = Modifier ) { val format = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, Locale.getDefault()) @@ -240,7 +293,7 @@ fun HistoryListItem( val totalScores = game.getTotalPoints() Card( - modifier = Modifier + modifier = modifier .fillMaxWidth() .padding(all = 4.dp), colors = cardColor ) { @@ -284,5 +337,5 @@ private fun HistoryListPreview() { Game(false, "TeamA5", "TeamB5", Date(), Date()), listOf(Round(5, 50, 90)) ) ) - HistoryList(tempData, {}, {}) {} + HistoryList(tempData, {}, {}, {}) } diff --git a/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryViewModel.kt b/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryViewModel.kt index ed3f587..9507838 100644 --- a/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryViewModel.kt +++ b/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryViewModel.kt @@ -20,16 +20,27 @@ class HistoryViewModel @Inject constructor( var gameAndHistory by mutableStateOf(emptyList()) private set + private var fullList: List = emptyList() + init { viewModelScope.launch { gameRepository.getAllWithRoundFlow().collect { games -> - gameAndHistory = + fullList = games.sortedBy { it.game.modified }.sortedBy { it.game.active }.reversed() + gameAndHistory = fullList } } } + fun markToDelete(gameId: Long) { + gameAndHistory = fullList.filter { it.game.uid != gameId } + } + + fun unmarkToDelete(gameId: Long) { + gameAndHistory = fullList + } + fun deleteGame(gameId: Long) { viewModelScope.launch { gameRepository.deleteGame(gameId) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 98e1a74..d2138cd 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -25,5 +25,9 @@ About Schreib uns Weiterspielen + Spiel gelöscht. + RÜCKGÄNGIG + Spiel aktiviert. + WEITERSPIELEN \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d688695..bf18678 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -29,4 +29,8 @@ Contact us Play Store Continue + Game deleted. + UNDO + Game activated. + CONTINUE PLAYING \ No newline at end of file -- 2.49.1 From 7108af4cf43c31c0c9cf037e18233aca41e88738 Mon Sep 17 00:00:00 2001 From: Fabian Zobrist Date: Sun, 20 Aug 2023 22:22:33 +0200 Subject: [PATCH 5/6] Fix typo. --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bf18678..3d18461 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -17,7 +17,7 @@ Off New Game Delete history - You really want to delete the the history? This action can\'t be undone. + You really want to delete the history? This action can\'t be undone. Cancel OK Delete -- 2.49.1 From 8521247c58d7b53a2580a4f4fd531ddeb3eeb88b Mon Sep 17 00:00:00 2001 From: Fabian Zobrist Date: Fri, 25 Aug 2023 15:59:58 +0200 Subject: [PATCH 6/6] Show all games in list but mark active game with an badge. --- .../tichucounter/ui/history/HistoryView.kt | 220 +++++++++--------- 1 file changed, 116 insertions(+), 104 deletions(-) diff --git a/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryView.kt b/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryView.kt index a8e4ddb..8f2131b 100644 --- a/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryView.kt +++ b/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryView.kt @@ -10,9 +10,12 @@ 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 @@ -22,9 +25,9 @@ import androidx.compose.material.icons.outlined.Delete import androidx.compose.material.icons.outlined.DeleteForever import androidx.compose.material.icons.outlined.RestartAlt import androidx.compose.material3.AlertDialog +import androidx.compose.material3.Badge import androidx.compose.material3.Button import androidx.compose.material3.Card -import androidx.compose.material3.CardDefaults import androidx.compose.material3.DismissDirection import androidx.compose.material3.DismissValue import androidx.compose.material3.ExperimentalMaterial3Api @@ -45,6 +48,7 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment.Companion.CenterVertically +import androidx.compose.ui.Alignment.Companion.TopEnd import androidx.compose.ui.Modifier import androidx.compose.ui.draw.scale import androidx.compose.ui.graphics.Color @@ -161,58 +165,49 @@ fun HistoryList( ) { Row { LazyColumn(state = lazyListState) { - item { - Text( - modifier = Modifier.padding(start = 10.dp, end = 10.dp), - text = stringResource(R.string.active), - style = MaterialTheme.typography.headlineSmall - ) - } - items(games.filter { it.game.active }) { - HistoryListItem(it, Modifier.animateItemPlacement()) - } - - if (games.count() > 1) { - item { - Text( - modifier = Modifier.padding(start = 10.dp, end = 10.dp, top = 10.dp), - text = stringResource(R.string.inactive), - style = MaterialTheme.typography.headlineSmall + items( + items = games, + key = { it.hashCode() }) { + if (it.game.active) { + HistoryListItem( + it, + Modifier.animateItemPlacement() ) - } - - items(items = games.filter { !it.game.active }, key = { - it.hashCode() - }) { + } else { DismissibleHistoryListItem( - it, onOpenClicked, onDeleteClicked, Modifier.animateItemPlacement() + it, + Modifier.animateItemPlacement(), + onOpenClicked, + onDeleteClicked ) } + } - item { - Button(enabled = games.count() > 1, - modifier = Modifier - .padding(start = 4.dp, end = 4.dp, top = 10.dp) - .align(CenterVertically) - .fillMaxWidth() - .animateItemPlacement(), - onClick = { onDeleteAllClicked() }) { - Icon(imageVector = Icons.Outlined.DeleteForever, contentDescription = null) - Text(text = stringResource(id = R.string.deleteAll)) - } + item { + Button(enabled = games.count() > 1, + modifier = Modifier + .padding(start = 4.dp, end = 4.dp, top = 10.dp) + .align(CenterVertically) + .fillMaxWidth() + .animateItemPlacement(), + onClick = { onDeleteAllClicked() }) { + Icon(imageVector = Icons.Outlined.DeleteForever, contentDescription = null) + Text(text = stringResource(id = R.string.deleteAll)) } } } } + + } @OptIn(ExperimentalMaterial3Api::class) @Composable fun DismissibleHistoryListItem( game: GameWithScores, + modifier: Modifier = Modifier, onOpenClicked: (gameId: Long) -> Unit, onDeleteClicked: (gameId: Long) -> Unit, - modifier: Modifier = Modifier, ) { val density = LocalDensity.current @@ -228,53 +223,65 @@ fun DismissibleHistoryListItem( true }) - SwipeToDismiss(modifier = modifier, state = dismissState, background = { - val direction = dismissState.dismissDirection ?: return@SwipeToDismiss - val color by animateColorAsState( - when (dismissState.targetValue) { - DismissValue.DismissedToStart -> Color.Red - else -> MaterialTheme.colorScheme.background + val directions = if (game.game.active) { + setOf() - }, label = "" - ) - val alignment = when (direction) { - DismissDirection.StartToEnd -> Alignment.CenterStart - DismissDirection.EndToStart -> Alignment.CenterEnd - } - val icon = when (direction) { - DismissDirection.StartToEnd -> Icons.Outlined.RestartAlt - DismissDirection.EndToStart -> Icons.Outlined.Delete - } - val text = when (direction) { - DismissDirection.StartToEnd -> stringResource(id = R.string.continue_play) - DismissDirection.EndToStart -> stringResource(id = R.string.delete) - } - val scale by animateFloatAsState( - if (dismissState.targetValue == DismissValue.Default) 0.75f else 1f, label = "" - ) + } else { + setOf(DismissDirection.EndToStart, DismissDirection.StartToEnd) + } - Box( - Modifier - .fillMaxSize() - .background(color) - .padding(horizontal = 20.dp), - contentAlignment = alignment - ) { - Column( - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally - ) { - Icon( - icon, contentDescription = null, modifier = Modifier.scale(scale) - ) - Text(text = text) + SwipeToDismiss( + modifier = modifier, + state = dismissState, + directions = directions, + background = { + val direction = dismissState.dismissDirection ?: return@SwipeToDismiss + val color by animateColorAsState( + when (dismissState.targetValue) { + DismissValue.DismissedToStart -> Color.Red + else -> MaterialTheme.colorScheme.background + + }, label = "" + ) + val alignment = when (direction) { + DismissDirection.StartToEnd -> Alignment.CenterStart + DismissDirection.EndToStart -> Alignment.CenterEnd } - } - }, dismissContent = { - HistoryListItem(game = game) - }) + val icon = when (direction) { + DismissDirection.StartToEnd -> Icons.Outlined.RestartAlt + DismissDirection.EndToStart -> Icons.Outlined.Delete + } + val text = when (direction) { + DismissDirection.StartToEnd -> stringResource(id = R.string.continue_play) + DismissDirection.EndToStart -> stringResource(id = R.string.delete) + } + val scale by animateFloatAsState( + if (dismissState.targetValue == DismissValue.Default) 0.75f else 1f, label = "" + ) + + Box( + Modifier + .fillMaxSize() + .background(color) + .padding(horizontal = 20.dp), + contentAlignment = alignment + ) { + Column( + verticalArrangement = Arrangement.Center, + horizontalAlignment = Alignment.CenterHorizontally + ) { + Icon( + icon, contentDescription = null, modifier = Modifier.scale(scale) + ) + Text(text = text) + } + } + }, dismissContent = { + HistoryListItem(game = game) + }) } +@OptIn(ExperimentalMaterial3Api::class) @Composable fun HistoryListItem( game: GameWithScores, modifier: Modifier = Modifier @@ -282,40 +289,45 @@ fun HistoryListItem( val format = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, Locale.getDefault()) - - val cardColor = if (game.game.active) { - CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.secondaryContainer) - - } else { - CardDefaults.cardColors() - } - val totalScores = game.getTotalPoints() Card( modifier = modifier .fillMaxWidth() - .padding(all = 4.dp), colors = cardColor + .padding(all = 4.dp) ) { Row( Modifier.padding(all = 12.dp) ) { - Column(Modifier.weight(4f)) { - Text( - text = game.game.nameA + " vs " + game.game.nameB, - maxLines = 1, - overflow = TextOverflow.Ellipsis, - style = MaterialTheme.typography.headlineSmall - ) - Text( - text = totalScores.first.toString() + " : " + totalScores.second.toString(), - style = MaterialTheme.typography.bodyLarge - ) - Spacer(modifier = Modifier.padding(5.dp)) - Text( - text = format.format(game.game.modified), - style = MaterialTheme.typography.labelSmall - ) + Box( modifier = modifier.fillMaxSize()) { + Column { + Text( + text = game.game.nameA + " vs " + game.game.nameB, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + style = MaterialTheme.typography.headlineSmall + ) + Text( + text = totalScores.first.toString() + " : " + totalScores.second.toString(), + style = MaterialTheme.typography.bodyLarge + ) + Spacer(modifier = Modifier.padding(5.dp)) + Text( + text = format.format(game.game.modified), + style = MaterialTheme.typography.labelSmall + ) + } + if (game.game.active) { + Badge( + modifier = Modifier.align(TopEnd), + contentColor = MaterialTheme.colorScheme.onPrimary, + containerColor = MaterialTheme.colorScheme.primary) { + Text( + text = stringResource(id = R.string.active), + style = MaterialTheme.typography.labelSmall + ) + } + } } } } @@ -326,7 +338,7 @@ fun HistoryListItem( private fun HistoryListPreview() { val tempData = listOf( GameWithScores( - Game(true, "abc", "def", 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( -- 2.49.1