Different style for history.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-01-07 09:13:51 +01:00
parent b73ddbf4cc
commit 26a44dcc18

View File

@@ -5,17 +5,21 @@ import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.items
import androidx.compose.material3.Card import androidx.compose.material3.Card
import androidx.compose.material3.CardElevation
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.State import androidx.compose.runtime.State
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
@@ -66,13 +70,37 @@ class HistoryFragment : Fragment() {
val format = val format =
DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, Locale.getDefault()) DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, Locale.getDefault())
Card() { Card(
Text(text = game.nameA + " - " + game.nameB, style = MaterialTheme.typography.bodyLarge) modifier = Modifier
.fillMaxWidth()
.padding(all = 4.dp),
) {
Column(
Modifier
.padding(all = 12.dp),
) {
Row() {
Text( Text(
text = game.scoreA.toString() + ":" + game.scoreB, text = game.nameA,
style = MaterialTheme.typography.bodyMedium style = MaterialTheme.typography.headlineSmall)
) Text(
Text(text = format.format(game.modified), style = MaterialTheme.typography.bodySmall) 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<List<GameAndScore>> override val gameAndHistory: State<List<GameAndScore>>
get() { get() {
val tempData = mutableListOf<GameAndScore>() val tempData = mutableListOf<GameAndScore>()
tempData.add(GameAndScore(false, "TeamA1", "TeamB1", Date(), Date(), 1, 10, 50)) tempData.add(GameAndScore(false, "TeamA1sdfdsf", "TeamB1", Date(), Date(), 1, 10, 50))
tempData.add(GameAndScore(true, "TeamA2", "TeamB2", Date(), Date(), 2, 20, 60)) 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, "TeamA3", "TeamB3", Date(), Date(), 3, 30, 70))
tempData.add(GameAndScore(false, "TeamA4", "TeamB4", Date(), Date(), 4, 40, 80)) tempData.add(GameAndScore(false, "TeamA4", "TeamB4", Date(), Date(), 4, 40, 80))
tempData.add(GameAndScore(false, "TeamA5", "TeamB5", Date(), Date(), 5, 50, 90)) tempData.add(GameAndScore(false, "TeamA5", "TeamB5", Date(), Date(), 5, 50, 90))