master #57

Merged
fabian merged 3 commits from master into develop 2024-08-26 23:38:44 +02:00
11 changed files with 55 additions and 53 deletions
Showing only changes of commit fdf8c5c7df - Show all commits

View File

@@ -99,30 +99,30 @@ dependencies {
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7' implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7'
implementation 'androidx.navigation:navigation-ui-ktx:2.7.7' implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.8.1' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.8.4'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.1' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.4'
implementation 'androidx.fragment:fragment-ktx:1.7.1' implementation 'androidx.fragment:fragment-ktx:1.8.2'
implementation 'androidx.preference:preference-ktx:1.2.1' implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.recyclerview:recyclerview:1.3.2' implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.1' implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.4'
implementation 'androidx.compose.material:material-icons-extended:1.6.7' implementation 'androidx.compose.material:material-icons-extended:1.6.8'
implementation "com.google.accompanist:accompanist-systemuicontroller:0.27.0" implementation "com.google.accompanist:accompanist-systemuicontroller:0.27.0"
implementation 'androidx.activity:activity-compose:1.9.0' implementation 'androidx.activity:activity-compose:1.9.1'
implementation "androidx.compose.ui:ui:1.6.7" implementation "androidx.compose.ui:ui:1.6.8"
implementation "androidx.compose.ui:ui-tooling-preview:1.6.7" implementation "androidx.compose.ui:ui-tooling-preview:1.6.8"
implementation "androidx.compose.runtime:runtime-livedata:1.6.7" implementation "androidx.compose.runtime:runtime-livedata:1.6.8"
implementation "androidx.navigation:navigation-compose:2.7.7" implementation "androidx.navigation:navigation-compose:2.7.7"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.8.1" implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.8.4"
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
implementation "com.google.dagger:hilt-android:2.51.1" implementation "com.google.dagger:hilt-android:2.51.1"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.6.7" androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.6.8"
debugImplementation "androidx.compose.ui:ui-tooling:1.6.7" debugImplementation "androidx.compose.ui:ui-tooling:1.6.8"
debugImplementation "androidx.compose.ui:ui-test-manifest:1.6.7" debugImplementation "androidx.compose.ui:ui-test-manifest:1.6.8"
kapt "com.google.dagger:hilt-compiler:2.51.1" kapt "com.google.dagger:hilt-compiler:2.51.1"
implementation "androidx.room:room-runtime:2.6.1"
annotationProcessor "androidx.room:room-compiler:2.6.1" annotationProcessor "androidx.room:room-compiler:2.6.1"
implementation "androidx.room:room-runtime:2.6.1"
ksp "androidx.room:room-compiler:2.6.1" ksp "androidx.room:room-compiler:2.6.1"
implementation "androidx.room:room-ktx:2.6.1" implementation "androidx.room:room-ktx:2.6.1"
implementation "androidx.multidex:multidex:2.0.1" implementation "androidx.multidex:multidex:2.0.1"

View File

@@ -8,14 +8,14 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.app.AppCompatDelegate
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.List
import androidx.compose.material.icons.automirrored.outlined.Redo
import androidx.compose.material.icons.automirrored.outlined.Undo
import androidx.compose.material.icons.outlined.Calculate import androidx.compose.material.icons.outlined.Calculate
import androidx.compose.material.icons.outlined.Info import androidx.compose.material.icons.outlined.Info
import androidx.compose.material.icons.outlined.Keyboard 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.MoreVert
import androidx.compose.material.icons.outlined.Redo
import androidx.compose.material.icons.outlined.Settings import androidx.compose.material.icons.outlined.Settings
import androidx.compose.material.icons.outlined.Undo
import androidx.compose.material3.DrawerState import androidx.compose.material3.DrawerState
import androidx.compose.material3.DrawerValue import androidx.compose.material3.DrawerValue
import androidx.compose.material3.FloatingActionButton import androidx.compose.material3.FloatingActionButton
@@ -166,7 +166,11 @@ class MainActivity : AppCompatActivity() {
Icons.Outlined.Calculate, Icons.Outlined.Calculate,
stringResource(R.string.menu_counter) stringResource(R.string.menu_counter)
), ),
DrawerItem(Route.HISTORY, Icons.Outlined.List, stringResource(R.string.menu_history)), DrawerItem(
Route.HISTORY,
Icons.AutoMirrored.Outlined.List,
stringResource(R.string.menu_history)
),
DrawerItem( DrawerItem(
Route.SETTINGS, Route.SETTINGS,
Icons.Outlined.Settings, Icons.Outlined.Settings,
@@ -217,7 +221,7 @@ class MainActivity : AppCompatActivity() {
) { ) {
var topBarState by remember { mutableStateOf(TopBarState()) } var topBarState by remember { mutableStateOf(TopBarState()) }
var snackbarHostState by remember { mutableStateOf(SnackbarHostState()) } val snackbarHostState by remember { mutableStateOf(SnackbarHostState()) }
Scaffold( Scaffold(
snackbarHost = { SnackbarHost(snackbarHostState) }, snackbarHost = { SnackbarHost(snackbarHostState) },
@@ -236,7 +240,7 @@ class MainActivity : AppCompatActivity() {
startDestination = Route.COUNTER.name, startDestination = Route.COUNTER.name,
modifier = Modifier.padding(paddings) modifier = Modifier.padding(paddings)
) { ) {
this.composable(Route.COUNTER.name.toString()) { this.composable(Route.COUNTER.name) {
var expanded by remember { mutableStateOf(false) } var expanded by remember { mutableStateOf(false) }
@@ -244,11 +248,11 @@ class MainActivity : AppCompatActivity() {
title = stringResource(R.string.app_name), title = stringResource(R.string.app_name),
actions = (listOf( actions = (listOf(
TopBarAction( TopBarAction(
Icons.Outlined.Undo, Icons.AutoMirrored.Outlined.Undo,
mainViewModel.isUndoActionActive, mainViewModel.isUndoActionActive,
{ mainViewModel.undoLastRound() }), { mainViewModel.undoLastRound() }),
TopBarAction( TopBarAction(
Icons.Outlined.Redo, Icons.AutoMirrored.Outlined.Redo,
mainViewModel.isRedoActionActive, mainViewModel.isRedoActionActive,
{ mainViewModel.redoLastRound() }), { mainViewModel.redoLastRound() }),
TopBarAction( TopBarAction(

View File

@@ -47,7 +47,6 @@ class ReviewService @Inject constructor(@ActivityContext private val appContext:
val reviewInfo = task.result val reviewInfo = task.result
manager.launchReviewFlow(appContext as Activity, reviewInfo) manager.launchReviewFlow(appContext as Activity, reviewInfo)
} else {
} }
} }
} }

View File

@@ -22,8 +22,7 @@ class GameRepository @Inject constructor(
private val roundDao: RoundDao private val roundDao: RoundDao
) { ) {
var activeGame: Game = Game(true, "TeamA", "TeamB", Date(), Date()) private var activeGame: Game = Game(true, "TeamA", "TeamB", Date(), Date())
private set
private val newGameFlow = MutableStateFlow(Game()) private val newGameFlow = MutableStateFlow(Game())

View File

@@ -11,6 +11,7 @@ import androidx.compose.material3.TextField
import androidx.compose.material3.TextFieldColors import androidx.compose.material3.TextFieldColors
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
@@ -26,7 +27,7 @@ import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.ImeAction
@OptIn(ExperimentalMaterial3Api::class, ExperimentalComposeUiApi::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
fun TypeaheadTextField( fun TypeaheadTextField(
value: String, value: String,
@@ -46,7 +47,7 @@ fun TypeaheadTextField(
onExpandedChange = {} onExpandedChange = {}
) { ) {
var dropDownWidth by remember { mutableStateOf(0) } var dropDownWidth by remember { mutableIntStateOf(0) }
TextField( TextField(
value = value, value = value,

View File

@@ -12,6 +12,7 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TextButton import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
@@ -28,7 +29,7 @@ import me.zobrist.tichucounter.ui.AppTheme
@Composable @Composable
fun Counter(viewModel: ICounterViewModel = PreviewViewModel()) { fun Counter(viewModel: ICounterViewModel = PreviewViewModel()) {
var orientation by remember { mutableStateOf(Configuration.ORIENTATION_PORTRAIT) } var orientation by remember { mutableIntStateOf(Configuration.ORIENTATION_PORTRAIT) }
orientation = LocalConfiguration.current.orientation orientation = LocalConfiguration.current.orientation
if (viewModel.showVictoryDialog) { if (viewModel.showVictoryDialog) {
@@ -122,7 +123,7 @@ fun CounterViewPreview() {
} }
} }
@Preview() @Preview
@Composable @Composable
fun GameVictoryDialog( fun GameVictoryDialog(
pointsA: Int = 2000, pointsA: Int = 2000,

View File

@@ -19,12 +19,12 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentWidth import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Backspace import androidx.compose.material.icons.automirrored.outlined.Backspace
import androidx.compose.material.icons.outlined.Check import androidx.compose.material.icons.outlined.Check
import androidx.compose.material.icons.outlined.KeyboardHide import androidx.compose.material.icons.outlined.KeyboardHide
import androidx.compose.material.icons.outlined.SwapHoriz import androidx.compose.material.icons.outlined.SwapHoriz
import androidx.compose.material3.Divider
import androidx.compose.material3.ElevatedButton import androidx.compose.material3.ElevatedButton
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalTextStyle import androidx.compose.material3.LocalTextStyle
@@ -198,7 +198,7 @@ fun KeyboardView(
deleteButtonPressedState(deletePressed) deleteButtonPressedState(deletePressed)
KeyboardIconButton( KeyboardIconButton(
icon = Icons.Outlined.Backspace, icon = Icons.AutoMirrored.Outlined.Backspace,
interactionSource = interactionSource interactionSource = interactionSource
) {} ) {}
} }
@@ -330,7 +330,7 @@ fun CenteredTextField(
Row { Row {
Text(text = value, color = cursorColor.copy(alpha = 0f)) Text(text = value, color = cursorColor.copy(alpha = 0f))
Divider( HorizontalDivider(
modifier = Modifier modifier = Modifier
.padding(start = 3.dp, top = 15.dp, bottom = 15.dp) .padding(start = 3.dp, top = 15.dp, bottom = 15.dp)
.width(1.dp) .width(1.dp)

View File

@@ -48,7 +48,6 @@ import androidx.compose.ui.Alignment.Companion.CenterVertically
import androidx.compose.ui.Alignment.Companion.TopEnd import androidx.compose.ui.Alignment.Companion.TopEnd
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.scale import androidx.compose.ui.draw.scale
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
@@ -242,8 +241,7 @@ fun DismissibleHistoryListItem(
@Composable @Composable
fun ItemBackground( fun ItemBackground(
dismissBoxValue: SwipeToDismissBoxValue dismissBoxValue: SwipeToDismissBoxValue
) ) {
{
val backgroundColor by animateColorAsState( val backgroundColor by animateColorAsState(
when (dismissBoxValue) { when (dismissBoxValue) {
SwipeToDismissBoxValue.EndToStart -> MaterialTheme.colorScheme.error SwipeToDismissBoxValue.EndToStart -> MaterialTheme.colorScheme.error
@@ -276,10 +274,12 @@ fun ItemBackground(
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.align(Alignment.CenterStart) modifier = Modifier.align(Alignment.CenterStart)
) { ) {
Icon(Icons.Outlined.RestartAlt, Icon(
Icons.Outlined.RestartAlt,
contentDescription = null, contentDescription = null,
tint = textColor, tint = textColor,
modifier = Modifier.scale(scale),) modifier = Modifier.scale(scale),
)
Text(text = stringResource(id = R.string.continue_play), color = textColor) Text(text = stringResource(id = R.string.continue_play), color = textColor)
} }
Column( Column(
@@ -288,10 +288,12 @@ fun ItemBackground(
modifier = Modifier.align(Alignment.CenterEnd) modifier = Modifier.align(Alignment.CenterEnd)
) { ) {
Icon(Icons.Outlined.Delete, Icon(
Icons.Outlined.Delete,
contentDescription = null, contentDescription = null,
tint = textColor, tint = textColor,
modifier = Modifier.scale(scale),) modifier = Modifier.scale(scale),
)
Text(text = stringResource(id = R.string.delete), color = textColor) Text(text = stringResource(id = R.string.delete), color = textColor)
} }
} }

View File

@@ -3,10 +3,10 @@ package me.zobrist.tichucounter.ui.layout
import android.content.res.Configuration import android.content.res.Configuration
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.List
import androidx.compose.material.icons.outlined.Calculate import androidx.compose.material.icons.outlined.Calculate
import androidx.compose.material.icons.outlined.List
import androidx.compose.material.icons.outlined.Settings import androidx.compose.material.icons.outlined.Settings
import androidx.compose.material3.Divider import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalDrawerSheet import androidx.compose.material3.ModalDrawerSheet
@@ -38,7 +38,7 @@ fun DrawerContent(
text = stringResource(R.string.app_name), text = stringResource(R.string.app_name),
style = MaterialTheme.typography.headlineSmall style = MaterialTheme.typography.headlineSmall
) )
Divider(modifier = Modifier.padding(10.dp)) HorizontalDivider(modifier = Modifier.padding(10.dp))
drawerItems.forEach { screen -> drawerItems.forEach { screen ->
NavigationDrawerItem( NavigationDrawerItem(
@@ -58,7 +58,7 @@ fun DrawerContent(
fun DrawerContentPreview() { fun DrawerContentPreview() {
val counter = DrawerItem(Route.COUNTER, Icons.Outlined.Calculate, "Counter") val counter = DrawerItem(Route.COUNTER, Icons.Outlined.Calculate, "Counter")
val history = DrawerItem(Route.HISTORY, Icons.Outlined.List, "History") val history = DrawerItem(Route.HISTORY, Icons.AutoMirrored.Outlined.List, "History")
val settings = DrawerItem(Route.SETTINGS, Icons.Outlined.Settings, "Settings") val settings = DrawerItem(Route.SETTINGS, Icons.Outlined.Settings, "Settings")
AppTheme { AppTheme {
Surface { Surface {

View File

@@ -6,7 +6,7 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:8.4.1' classpath 'com.android.tools.build:gradle:8.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
@@ -26,7 +26,3 @@ allprojects {
mavenCentral() mavenCentral()
} }
} }
tasks.register('clean', Delete) {
delete rootProject.buildDir
}

View File

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip