From 26a44dcc18a5854f7237522d1304dc36d14b9a33 Mon Sep 17 00:00:00 2001 From: Fabian Zobrist Date: Sat, 7 Jan 2023 09:13:51 +0100 Subject: [PATCH] Different style for history. --- .../ui/history/HistoryFragment.kt | 46 +++++++++++++++---- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryFragment.kt b/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryFragment.kt index bbb9a59..1acebae 100644 --- a/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryFragment.kt +++ b/app/src/main/java/me/zobrist/tichucounter/ui/history/HistoryFragment.kt @@ -5,17 +5,21 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material3.Card +import androidx.compose.material3.CardElevation import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.State import androidx.compose.runtime.mutableStateOf +import androidx.compose.ui.Modifier import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import dagger.hilt.android.AndroidEntryPoint @@ -66,13 +70,37 @@ class HistoryFragment : Fragment() { val format = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, Locale.getDefault()) - Card() { - Text(text = game.nameA + " - " + game.nameB, style = MaterialTheme.typography.bodyLarge) - Text( - text = game.scoreA.toString() + ":" + game.scoreB, - style = MaterialTheme.typography.bodyMedium - ) - Text(text = format.format(game.modified), style = MaterialTheme.typography.bodySmall) + Card( + modifier = Modifier + .fillMaxWidth() + .padding(all = 4.dp), + ) { + Column( + Modifier + .padding(all = 12.dp), + ) { + Row() { + Text( + text = game.nameA, + style = MaterialTheme.typography.headlineSmall) + Text( + text = game.scoreA.toString(), + style = MaterialTheme.typography.headlineSmall) + } + Row() { + Text( + text = game.nameB, + style = MaterialTheme.typography.headlineSmall) + Text( + text = game.scoreB.toString(), + style = MaterialTheme.typography.headlineSmall) + } + Row() { + Text( + text = format.format(game.modified), + style = MaterialTheme.typography.labelSmall) + } + } } } @@ -81,8 +109,8 @@ class HistoryFragment : Fragment() { override val gameAndHistory: State> get() { val tempData = mutableListOf() - tempData.add(GameAndScore(false, "TeamA1", "TeamB1", Date(), Date(), 1, 10, 50)) - tempData.add(GameAndScore(true, "TeamA2", "TeamB2", Date(), Date(), 2, 20, 60)) + tempData.add(GameAndScore(false, "TeamA1sdfdsf", "TeamB1", Date(), Date(), 1, 10, 50)) + tempData.add(GameAndScore(true, "TeamA2", "TeamB2sdfsdf", Date(), Date(), 2, 20, 60)) tempData.add(GameAndScore(false, "TeamA3", "TeamB3", Date(), Date(), 3, 30, 70)) tempData.add(GameAndScore(false, "TeamA4", "TeamB4", Date(), Date(), 4, 40, 80)) tempData.add(GameAndScore(false, "TeamA5", "TeamB5", Date(), Date(), 5, 50, 90))