feature/android-14 #48
@@ -24,12 +24,12 @@ versionProperties.load(new FileInputStream(versionPropertiesFile))
|
|||||||
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdk 33
|
compileSdk 34
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "me.zobrist.tichucounter"
|
applicationId "me.zobrist.tichucounter"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 33
|
targetSdkVersion 34
|
||||||
versionCode versionProperties["versionCode"].toInteger()
|
versionCode versionProperties["versionCode"].toInteger()
|
||||||
versionName "${versionMajor}.${versionMinor}.${versionProperties["versionCode"].toInteger()}"
|
versionName "${versionMajor}.${versionMinor}.${versionProperties["versionCode"].toInteger()}"
|
||||||
resourceConfigurations += ['de', 'en']
|
resourceConfigurations += ['de', 'en']
|
||||||
@@ -95,37 +95,37 @@ dependencies {
|
|||||||
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'
|
implementation 'com.google.code.gson:gson:2.9.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
|
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.1'
|
||||||
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
|
implementation 'androidx.navigation:navigation-ui-ktx:2.7.1'
|
||||||
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.6.1'
|
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1'
|
||||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
|
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
|
||||||
implementation 'androidx.fragment:fragment-ktx:1.5.7'
|
implementation 'androidx.fragment:fragment-ktx:1.6.1'
|
||||||
implementation 'androidx.preference:preference-ktx:1.2.0'
|
implementation 'androidx.preference:preference-ktx:1.2.1'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.3.0'
|
implementation 'androidx.recyclerview:recyclerview:1.3.1'
|
||||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
|
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
|
||||||
implementation 'androidx.compose.material:material-icons-extended:1.4.3'
|
implementation 'androidx.compose.material:material-icons-extended:1.5.0'
|
||||||
implementation "com.google.accompanist:accompanist-systemuicontroller:0.27.0"
|
implementation "com.google.accompanist:accompanist-systemuicontroller:0.27.0"
|
||||||
implementation 'androidx.activity:activity-compose:1.7.2'
|
implementation 'androidx.activity:activity-compose:1.7.2'
|
||||||
implementation "androidx.compose.ui:ui:1.4.3"
|
implementation "androidx.compose.ui:ui:1.5.0"
|
||||||
implementation "androidx.compose.ui:ui-tooling-preview:1.4.3"
|
implementation "androidx.compose.ui:ui-tooling-preview:1.5.0"
|
||||||
implementation "androidx.compose.runtime:runtime-livedata:1.4.3"
|
implementation "androidx.compose.runtime:runtime-livedata:1.5.0"
|
||||||
implementation "androidx.navigation:navigation-compose:2.5.3"
|
implementation "androidx.navigation:navigation-compose:2.7.1"
|
||||||
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1"
|
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1"
|
||||||
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.1.5'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||||
implementation "com.google.dagger:hilt-android:2.44"
|
implementation "com.google.dagger:hilt-android:2.44"
|
||||||
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.4.3"
|
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.5.0"
|
||||||
debugImplementation "androidx.compose.ui:ui-tooling:1.4.3"
|
debugImplementation "androidx.compose.ui:ui-tooling:1.5.0"
|
||||||
debugImplementation "androidx.compose.ui:ui-test-manifest:1.4.3"
|
debugImplementation "androidx.compose.ui:ui-test-manifest:1.5.0"
|
||||||
kapt "com.google.dagger:hilt-compiler:2.44"
|
kapt "com.google.dagger:hilt-compiler:2.44"
|
||||||
implementation "androidx.room:room-runtime:2.5.1"
|
implementation "androidx.room:room-runtime:2.5.2"
|
||||||
annotationProcessor "androidx.room:room-compiler:2.5.1"
|
annotationProcessor "androidx.room:room-compiler:2.5.2"
|
||||||
kapt "androidx.room:room-compiler:2.5.1"
|
kapt "androidx.room:room-compiler:2.5.2"
|
||||||
implementation "androidx.room:room-ktx:2.5.1"
|
implementation "androidx.room:room-ktx:2.5.2"
|
||||||
implementation "androidx.multidex:multidex:2.0.1"
|
implementation "androidx.multidex:multidex:2.0.1"
|
||||||
api "androidx.navigation:navigation-fragment-ktx:2.5.3"
|
api "androidx.navigation:navigation-fragment-ktx:2.7.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow references to generated code
|
// Allow references to generated code
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.navigation.NavHostController
|
import androidx.navigation.NavHostController
|
||||||
import androidx.navigation.compose.NavHost
|
import androidx.navigation.compose.NavHost
|
||||||
|
import androidx.navigation.compose.composable
|
||||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||||
import androidx.navigation.compose.rememberNavController
|
import androidx.navigation.compose.rememberNavController
|
||||||
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
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.Theme
|
||||||
import me.zobrist.tichucounter.domain.TopBarAction
|
import me.zobrist.tichucounter.domain.TopBarAction
|
||||||
import me.zobrist.tichucounter.domain.TopBarState
|
import me.zobrist.tichucounter.domain.TopBarState
|
||||||
import me.zobrist.tichucounter.domain.composable
|
|
||||||
import me.zobrist.tichucounter.domain.navigate
|
import me.zobrist.tichucounter.domain.navigate
|
||||||
import me.zobrist.tichucounter.ui.AppTheme
|
import me.zobrist.tichucounter.ui.AppTheme
|
||||||
import me.zobrist.tichucounter.ui.MainViewModel
|
import me.zobrist.tichucounter.ui.MainViewModel
|
||||||
@@ -202,7 +202,7 @@ class MainActivity : AppCompatActivity(), ISettingsChangeListener {
|
|||||||
startDestination = Route.COUNTER.name,
|
startDestination = Route.COUNTER.name,
|
||||||
modifier = Modifier.padding(paddings)
|
modifier = Modifier.padding(paddings)
|
||||||
) {
|
) {
|
||||||
composable(Route.COUNTER) {
|
composable(Route.COUNTER.name) {
|
||||||
|
|
||||||
var expanded by remember { mutableStateOf(false) }
|
var expanded by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
@@ -246,7 +246,7 @@ class MainActivity : AppCompatActivity(), ISettingsChangeListener {
|
|||||||
|
|
||||||
Counter(counterViewModel)
|
Counter(counterViewModel)
|
||||||
}
|
}
|
||||||
composable(Route.HISTORY) {
|
composable(Route.HISTORY.name) {
|
||||||
topBarState =
|
topBarState =
|
||||||
TopBarState(title = stringResource(R.string.menu_history)) { scope.launch { drawerState.open() } }
|
TopBarState(title = stringResource(R.string.menu_history)) { scope.launch { drawerState.open() } }
|
||||||
|
|
||||||
@@ -255,14 +255,14 @@ class MainActivity : AppCompatActivity(), ISettingsChangeListener {
|
|||||||
snackbarHostState
|
snackbarHostState
|
||||||
) { navController.navigate(Route.COUNTER) }
|
) { navController.navigate(Route.COUNTER) }
|
||||||
}
|
}
|
||||||
composable(Route.SETTINGS) {
|
composable(Route.SETTINGS.name) {
|
||||||
topBarState =
|
topBarState =
|
||||||
TopBarState(title = stringResource(R.string.menu_settings)) { scope.launch { drawerState.open() } }
|
TopBarState(title = stringResource(R.string.menu_settings)) { scope.launch { drawerState.open() } }
|
||||||
|
|
||||||
SettingsView(settingsViewModel)
|
SettingsView(settingsViewModel)
|
||||||
}
|
}
|
||||||
|
|
||||||
composable(Route.ABOUT) {
|
composable(Route.ABOUT.name) {
|
||||||
topBarState =
|
topBarState =
|
||||||
TopBarState(title = stringResource(R.string.menu_about)) { scope.launch { drawerState.open() } }
|
TopBarState(title = stringResource(R.string.menu_about)) { scope.launch { drawerState.open() } }
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
package me.zobrist.tichucounter.domain
|
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.NavController
|
||||||
import androidx.navigation.NavDeepLink
|
|
||||||
import androidx.navigation.NavGraphBuilder
|
|
||||||
import androidx.navigation.compose.composable
|
|
||||||
|
|
||||||
fun NavController.navigate(route: Route) {
|
fun NavController.navigate(route: Route) {
|
||||||
this.navigate(route.name) {
|
this.navigate(route.name) {
|
||||||
@@ -23,12 +17,3 @@ fun NavController.navigate(route: Route) {
|
|||||||
restoreState = true
|
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
|
package me.zobrist.tichucounter.ui.counter
|
||||||
|
|
||||||
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.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.focus.FocusRequester
|
import androidx.compose.ui.focus.FocusRequester
|
||||||
@@ -71,10 +72,10 @@ class CounterViewModel @Inject constructor(
|
|||||||
override var roundScoreList by mutableStateOf(emptyList<Round>())
|
override var roundScoreList by mutableStateOf(emptyList<Round>())
|
||||||
private set
|
private set
|
||||||
|
|
||||||
override var totalScoreA by mutableStateOf(0)
|
override var totalScoreA by mutableIntStateOf(0)
|
||||||
private set
|
private set
|
||||||
|
|
||||||
override var totalScoreB by mutableStateOf(0)
|
override var totalScoreB by mutableIntStateOf(0)
|
||||||
private set
|
private set
|
||||||
|
|
||||||
override var teamNameA by mutableStateOf("")
|
override var teamNameA by mutableStateOf("")
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import androidx.compose.material3.Surface
|
|||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextField
|
import androidx.compose.material3.TextField
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
@@ -43,6 +44,7 @@ import androidx.compose.ui.focus.focusRequester
|
|||||||
import androidx.compose.ui.focus.onFocusChanged
|
import androidx.compose.ui.focus.onFocusChanged
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import androidx.compose.ui.platform.LocalConfiguration
|
import androidx.compose.ui.platform.LocalConfiguration
|
||||||
|
import androidx.compose.ui.platform.LocalTextInputService
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -290,6 +292,7 @@ fun CenteredTextField(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Box(contentAlignment = Alignment.Center) {
|
Box(contentAlignment = Alignment.Center) {
|
||||||
|
CompositionLocalProvider(LocalTextInputService provides null) {
|
||||||
TextField(
|
TextField(
|
||||||
value = value,
|
value = value,
|
||||||
onValueChange = { },
|
onValueChange = { },
|
||||||
@@ -311,16 +314,18 @@ fun CenteredTextField(
|
|||||||
onFocusStateChanged(it)
|
onFocusStateChanged(it)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (focused) {
|
if (focused) {
|
||||||
val cursorColor = MaterialTheme.colorScheme.onSurface
|
val cursorColor = MaterialTheme.colorScheme.onSurface
|
||||||
val infiniteTransition = rememberInfiniteTransition()
|
val infiniteTransition = rememberInfiniteTransition(label = "blinkingCursor")
|
||||||
val alpha by infiniteTransition.animateFloat(
|
val alpha by infiniteTransition.animateFloat(
|
||||||
0f,
|
0f,
|
||||||
cursorColor.alpha,
|
cursorColor.alpha,
|
||||||
animationSpec = infiniteRepeatable(
|
animationSpec = infiniteRepeatable(
|
||||||
animation = tween(500),
|
animation = tween(500),
|
||||||
repeatMode = RepeatMode.Reverse
|
repeatMode = RepeatMode.Reverse
|
||||||
)
|
), label = "blinkingCursor"
|
||||||
)
|
)
|
||||||
Row {
|
Row {
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,9 @@ import androidx.compose.foundation.layout.Box
|
|||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.aspectRatio
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
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.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.LazyListState
|
import androidx.compose.foundation.lazy.LazyListState
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
@@ -299,7 +296,7 @@ fun HistoryListItem(
|
|||||||
Row(
|
Row(
|
||||||
Modifier.padding(all = 12.dp)
|
Modifier.padding(all = 12.dp)
|
||||||
) {
|
) {
|
||||||
Box( modifier = modifier.fillMaxSize()) {
|
Box(modifier = modifier.fillMaxSize()) {
|
||||||
Column {
|
Column {
|
||||||
Text(
|
Text(
|
||||||
text = game.game.nameA + " vs " + game.game.nameB,
|
text = game.game.nameA + " vs " + game.game.nameB,
|
||||||
@@ -321,7 +318,8 @@ fun HistoryListItem(
|
|||||||
Badge(
|
Badge(
|
||||||
modifier = Modifier.align(TopEnd),
|
modifier = Modifier.align(TopEnd),
|
||||||
contentColor = MaterialTheme.colorScheme.onPrimary,
|
contentColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
containerColor = MaterialTheme.colorScheme.primary) {
|
containerColor = MaterialTheme.colorScheme.primary
|
||||||
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = R.string.active),
|
text = stringResource(id = R.string.active),
|
||||||
style = MaterialTheme.typography.labelSmall
|
style = MaterialTheme.typography.labelSmall
|
||||||
@@ -338,7 +336,8 @@ fun HistoryListItem(
|
|||||||
private fun HistoryListPreview() {
|
private fun HistoryListPreview() {
|
||||||
val tempData = listOf(
|
val tempData = listOf(
|
||||||
GameWithScores(
|
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(
|
), GameWithScores(
|
||||||
Game(false, "ADTH", "dogfg", Date(), Date()), listOf(Round(2, 20, 60))
|
Game(false, "ADTH", "dogfg", Date(), Date()), listOf(Round(2, 20, 60))
|
||||||
), GameWithScores(
|
), GameWithScores(
|
||||||
|
|||||||
@@ -26,6 +26,6 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
tasks.register('clean', Delete) {
|
||||||
delete rootProject.buildDir
|
delete rootProject.buildDir
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user