Update dependencies and Gradle, Minimum SDK bumped to 23
All checks were successful
Build Android / build (push) Successful in 5m7s
All checks were successful
Build Android / build (push) Successful in 5m7s
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application'
|
id 'com.android.application'
|
||||||
id 'kotlin-android'
|
|
||||||
id 'com.google.dagger.hilt.android'
|
id 'com.google.dagger.hilt.android'
|
||||||
id 'kotlin-kapt'
|
|
||||||
id 'com.google.devtools.ksp'
|
id 'com.google.devtools.ksp'
|
||||||
|
id 'org.jetbrains.kotlin.plugin.compose'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a variable called keystorePropertiesFile, and initialize it to your
|
// Create a variable called keystorePropertiesFile, and initialize it to your
|
||||||
@@ -29,7 +28,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "me.zobrist.tichucounter"
|
applicationId "me.zobrist.tichucounter"
|
||||||
minSdkVersion 21
|
minSdkVersion 23
|
||||||
targetSdkVersion 36
|
targetSdkVersion 36
|
||||||
versionCode versionProperties["versionCode"].toInteger()
|
versionCode versionProperties["versionCode"].toInteger()
|
||||||
versionName "${versionMajor}.${versionMinor}.${versionProperties["versionCode"].toInteger()}"
|
versionName "${versionMajor}.${versionMinor}.${versionProperties["versionCode"].toInteger()}"
|
||||||
@@ -47,7 +46,7 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
create("release") {
|
register("release") {
|
||||||
keyAlias = keystoreProperties["keyAlias"]
|
keyAlias = keystoreProperties["keyAlias"]
|
||||||
keyPassword = keystoreProperties["keyPassword"]
|
keyPassword = keystoreProperties["keyPassword"]
|
||||||
storeFile = file(keystoreProperties["storeFile"])
|
storeFile = file(keystoreProperties["storeFile"])
|
||||||
@@ -65,19 +64,14 @@ android {
|
|||||||
|
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
compose = true
|
compose = true
|
||||||
|
buildConfig true
|
||||||
}
|
}
|
||||||
|
|
||||||
composeOptions {
|
|
||||||
kotlinCompilerExtensionVersion = "1.5.14"
|
|
||||||
}
|
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_17
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
targetCompatibility JavaVersion.VERSION_17
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
}
|
}
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = '17'
|
|
||||||
}
|
|
||||||
namespace 'me.zobrist.tichucounter'
|
namespace 'me.zobrist.tichucounter'
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
resources {
|
resources {
|
||||||
@@ -88,48 +82,42 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:2.2.10"
|
||||||
implementation 'androidx.core:core-ktx:1.13.1'
|
implementation 'androidx.core:core-ktx:1.17.0'
|
||||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
implementation 'androidx.appcompat:appcompat:1.7.1'
|
||||||
implementation "androidx.compose.material3:material3:1.2.1"
|
implementation "androidx.compose.material3:material3:1.4.0"
|
||||||
implementation 'com.google.android.play:review:2.0.1'
|
implementation 'com.google.android.play:review:2.0.2'
|
||||||
implementation 'com.google.android.play:review-ktx:2.0.1'
|
implementation 'com.google.android.play:review-ktx:2.0.2'
|
||||||
implementation 'com.google.code.gson:gson:2.10.1'
|
implementation 'com.google.code.gson:gson:2.13.2'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
|
||||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7'
|
implementation 'androidx.navigation:navigation-fragment-ktx:2.9.7'
|
||||||
implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
|
implementation 'androidx.navigation:navigation-ui-ktx:2.9.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.4'
|
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.10.0'
|
||||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.4'
|
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.10.0'
|
||||||
implementation 'androidx.fragment:fragment-ktx:1.8.2'
|
implementation 'androidx.fragment:fragment-ktx:1.8.9'
|
||||||
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.4.0'
|
||||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.4'
|
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.10.0'
|
||||||
implementation 'androidx.compose.material:material-icons-extended:1.6.8'
|
implementation 'androidx.compose.material:material-icons-extended:1.7.8'
|
||||||
implementation "com.google.accompanist:accompanist-systemuicontroller:0.27.0"
|
implementation "com.google.accompanist:accompanist-systemuicontroller:0.36.0"
|
||||||
implementation 'androidx.activity:activity-compose:1.9.1'
|
implementation 'androidx.activity:activity-compose:1.12.3'
|
||||||
implementation "androidx.compose.ui:ui:1.6.8"
|
implementation "androidx.compose.ui:ui:1.10.2"
|
||||||
implementation "androidx.compose.ui:ui-tooling-preview:1.6.8"
|
implementation "androidx.compose.ui:ui-tooling-preview:1.10.2"
|
||||||
implementation "androidx.compose.runtime:runtime-livedata:1.6.8"
|
implementation "androidx.compose.runtime:runtime-livedata:1.10.2"
|
||||||
implementation "androidx.navigation:navigation-compose:2.7.7"
|
implementation "androidx.navigation:navigation-compose:2.9.7"
|
||||||
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.8.4"
|
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.10.0"
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
|
androidTestImplementation 'androidx.test.ext:junit:1.3.0'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'
|
||||||
implementation "com.google.dagger:hilt-android:2.51.1"
|
implementation "com.google.dagger:hilt-android:2.59"
|
||||||
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.6.8"
|
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.10.2"
|
||||||
debugImplementation "androidx.compose.ui:ui-tooling:1.6.8"
|
debugImplementation "androidx.compose.ui:ui-tooling:1.10.2"
|
||||||
debugImplementation "androidx.compose.ui:ui-test-manifest:1.6.8"
|
debugImplementation "androidx.compose.ui:ui-test-manifest:1.10.2"
|
||||||
kapt "com.google.dagger:hilt-compiler:2.51.1"
|
ksp "com.google.dagger:hilt-compiler:2.59"
|
||||||
annotationProcessor "androidx.room:room-compiler:2.6.1"
|
annotationProcessor "androidx.room:room-compiler:2.8.4"
|
||||||
implementation "androidx.room:room-runtime:2.6.1"
|
implementation "androidx.room:room-runtime:2.8.4"
|
||||||
ksp "androidx.room:room-compiler:2.6.1"
|
ksp "androidx.room:room-compiler:2.8.4"
|
||||||
implementation "androidx.room:room-ktx:2.6.1"
|
implementation "androidx.room:room-ktx:2.8.4"
|
||||||
implementation "androidx.multidex:multidex:2.0.1"
|
api "androidx.navigation:navigation-fragment-ktx:2.9.7"
|
||||||
api "androidx.navigation:navigation-fragment-ktx:2.7.7"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allow references to generated code
|
|
||||||
kapt {
|
|
||||||
correctErrorTypes true
|
|
||||||
}
|
}
|
||||||
@@ -10,10 +10,11 @@ import me.zobrist.tichucounter.data.AppDatabase
|
|||||||
import me.zobrist.tichucounter.data.GameDao
|
import me.zobrist.tichucounter.data.GameDao
|
||||||
import me.zobrist.tichucounter.data.RoundDao
|
import me.zobrist.tichucounter.data.RoundDao
|
||||||
import me.zobrist.tichucounter.repository.GameRepository
|
import me.zobrist.tichucounter.repository.GameRepository
|
||||||
import org.junit.After
|
import org.junit.jupiter.api.AfterEach
|
||||||
import org.junit.Assert.*
|
import org.junit.Assert.*
|
||||||
import org.junit.Before
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
import org.junit.jupiter.api.AfterEach
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -30,7 +31,7 @@ class RepositoryInstrumentedTest {
|
|||||||
private lateinit var repository: GameRepository
|
private lateinit var repository: GameRepository
|
||||||
private lateinit var db: AppDatabase
|
private lateinit var db: AppDatabase
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
fun createDb() {
|
fun createDb() {
|
||||||
val context = ApplicationProvider.getApplicationContext<Context>()
|
val context = ApplicationProvider.getApplicationContext<Context>()
|
||||||
db = Room.inMemoryDatabaseBuilder(
|
db = Room.inMemoryDatabaseBuilder(
|
||||||
@@ -42,7 +43,7 @@ class RepositoryInstrumentedTest {
|
|||||||
repository = GameRepository(gameDao, roundDao)
|
repository = GameRepository(gameDao, roundDao)
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterEach
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
fun closeDb() {
|
fun closeDb() {
|
||||||
db.close()
|
db.close()
|
||||||
@@ -59,7 +60,7 @@ class RepositoryInstrumentedTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@org.junit.jupiter.api.Test
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
fun modifyNames() = runTest {
|
fun modifyNames() = runTest {
|
||||||
|
|
||||||
@@ -109,7 +110,7 @@ class RepositoryInstrumentedTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@org.junit.jupiter.api.Test
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
fun setActive() = runTest {
|
fun setActive() = runTest {
|
||||||
|
|
||||||
@@ -138,7 +139,7 @@ class RepositoryInstrumentedTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@org.junit.jupiter.api.Test
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
fun addRoundToActiveGame() = runTest {
|
fun addRoundToActiveGame() = runTest {
|
||||||
|
|
||||||
@@ -211,7 +212,7 @@ class RepositoryInstrumentedTest {
|
|||||||
repository.deleteLastRound()
|
repository.deleteLastRound()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@org.junit.jupiter.api.Test
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
fun deleteInactive() = runTest {
|
fun deleteInactive() = runTest {
|
||||||
|
|
||||||
@@ -239,7 +240,7 @@ class RepositoryInstrumentedTest {
|
|||||||
assertEquals(6, roundDao.getAll().count())
|
assertEquals(6, roundDao.getAll().count())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@org.junit.jupiter.api.Test
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
fun deleteById() = runTest {
|
fun deleteById() = runTest {
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,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.navigate
|
|
||||||
import me.zobrist.tichucounter.repository.GameRepository
|
import me.zobrist.tichucounter.repository.GameRepository
|
||||||
import me.zobrist.tichucounter.ui.AppTheme
|
import me.zobrist.tichucounter.ui.AppTheme
|
||||||
import me.zobrist.tichucounter.ui.MainViewModel
|
import me.zobrist.tichucounter.ui.MainViewModel
|
||||||
@@ -198,7 +197,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
drawerState.close()
|
drawerState.close()
|
||||||
|
|
||||||
}
|
}
|
||||||
navController.navigate(it)
|
navController.navigate(it.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
@@ -292,7 +291,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
HistoryList(
|
HistoryList(
|
||||||
historyViewModel,
|
historyViewModel,
|
||||||
snackbarHostState
|
snackbarHostState
|
||||||
) { navController.navigate(Route.COUNTER) }
|
) { navController.navigate(Route.COUNTER.name) }
|
||||||
}
|
}
|
||||||
composable(Route.SETTINGS.name) {
|
composable(Route.SETTINGS.name) {
|
||||||
topBarState =
|
topBarState =
|
||||||
|
|||||||
@@ -7,27 +7,28 @@ import com.google.android.play.core.review.ReviewManagerFactory
|
|||||||
import dagger.hilt.android.qualifiers.ActivityContext
|
import dagger.hilt.android.qualifiers.ActivityContext
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
import androidx.core.content.edit
|
||||||
|
|
||||||
class ReviewService @Inject constructor(@ActivityContext private val appContext: Context) {
|
class ReviewService @Inject constructor(@ActivityContext private val appContext: Context) {
|
||||||
|
|
||||||
private val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(appContext)
|
private val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(appContext)
|
||||||
|
|
||||||
private val THREE_MONTHS: Long = 7776000000
|
private val threeMonths: Long = 7776000000
|
||||||
|
|
||||||
private var requestCalled: Int
|
private var requestCalled: Int
|
||||||
get() = sharedPreferences.getInt("requestCalled", 0)
|
get() = sharedPreferences.getInt("requestCalled", 0)
|
||||||
set(value) {
|
set(value) {
|
||||||
val editor = sharedPreferences.edit()
|
sharedPreferences.edit {
|
||||||
editor.putInt("requestCalled", value)
|
putInt("requestCalled", value)
|
||||||
editor.apply()
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var nextReviewedDate: Date
|
private var nextReviewedDate: Date
|
||||||
get() = Date(sharedPreferences.getLong("lastReviewedDate", 0))
|
get() = Date(sharedPreferences.getLong("lastReviewedDate", 0))
|
||||||
set(value) {
|
set(value) {
|
||||||
val editor = sharedPreferences.edit()
|
sharedPreferences.edit {
|
||||||
editor.putLong("lastReviewedDate", value.time)
|
putLong("lastReviewedDate", value.time)
|
||||||
editor.apply()
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun request() {
|
fun request() {
|
||||||
@@ -36,7 +37,7 @@ class ReviewService @Inject constructor(@ActivityContext private val appContext:
|
|||||||
if (requestCalled >= 3) {
|
if (requestCalled >= 3) {
|
||||||
if (nextReviewedDate.time < System.currentTimeMillis()) {
|
if (nextReviewedDate.time < System.currentTimeMillis()) {
|
||||||
requestCalled = 0
|
requestCalled = 0
|
||||||
nextReviewedDate = Date(System.currentTimeMillis() + THREE_MONTHS)
|
nextReviewedDate = Date(System.currentTimeMillis() + threeMonths)
|
||||||
|
|
||||||
val manager = ReviewManagerFactory.create(appContext)
|
val manager = ReviewManagerFactory.create(appContext)
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
import androidx.core.content.edit
|
||||||
|
|
||||||
enum class Theme { DEFAULT, DARK, LIGHT }
|
enum class Theme { DEFAULT, DARK, LIGHT }
|
||||||
enum class Language(val value: LocaleListCompat) {
|
enum class Language(val value: LocaleListCompat) {
|
||||||
@@ -93,20 +94,20 @@ class SettingsAdapter @Inject constructor(@ApplicationContext private val contex
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun updatePreference(name: String?, value: String) {
|
private fun updatePreference(name: String?, value: String) {
|
||||||
val editor = sharedPreferences.edit()
|
sharedPreferences.edit {
|
||||||
editor.putString(name, value)
|
putString(name, value)
|
||||||
editor.apply()
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updatePreference(name: String?, value: Boolean) {
|
private fun updatePreference(name: String?, value: Boolean) {
|
||||||
val editor = sharedPreferences.edit()
|
sharedPreferences.edit {
|
||||||
editor.putBoolean(name, value)
|
putBoolean(name, value)
|
||||||
editor.apply()
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updatePreference(name: String?, value: Int) {
|
private fun updatePreference(name: String?, value: Int) {
|
||||||
val editor = sharedPreferences.edit()
|
sharedPreferences.edit {
|
||||||
editor.putInt(name, value)
|
putInt(name, value)
|
||||||
editor.apply()
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,17 +117,15 @@ class GameRepository @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun restoreLastDeletedGame() {
|
suspend fun restoreLastDeletedGame() {
|
||||||
if (deletedGame == null) {
|
|
||||||
return
|
val snapshot = deletedGame ?: return
|
||||||
}
|
|
||||||
val revert = deletedGame!!
|
|
||||||
deletedGame = null
|
deletedGame = null
|
||||||
|
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
gameDao.insert(revert.game)
|
val uid = gameDao.insert(snapshot.game.copy(uid = 0))
|
||||||
|
|
||||||
revert.rounds.forEach {
|
snapshot.rounds.forEach {
|
||||||
roundDao.insert(it)
|
roundDao.insert(Round(uid, it.scoreA, it.scoreB))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package me.zobrist.tichucounter.ui.counter
|
package me.zobrist.tichucounter.ui.counter
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import androidx.compose.animation.core.RepeatMode
|
import androidx.compose.animation.core.RepeatMode
|
||||||
import androidx.compose.animation.core.animateFloat
|
import androidx.compose.animation.core.animateFloat
|
||||||
@@ -343,6 +344,7 @@ fun CenteredTextField(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressLint("RememberInComposition")
|
||||||
@Preview(name = "Light Mode")
|
@Preview(name = "Light Mode")
|
||||||
@Preview(name = "Dark Mode", uiMode = Configuration.UI_MODE_NIGHT_YES, showBackground = true)
|
@Preview(name = "Dark Mode", uiMode = Configuration.UI_MODE_NIGHT_YES, showBackground = true)
|
||||||
@Composable
|
@Composable
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package me.zobrist.tichucounter.ui.history
|
|||||||
|
|
||||||
import androidx.compose.animation.animateColorAsState
|
import androidx.compose.animation.animateColorAsState
|
||||||
import androidx.compose.animation.core.animateFloatAsState
|
import androidx.compose.animation.core.animateFloatAsState
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
@@ -26,7 +25,6 @@ import androidx.compose.material3.AlertDialog
|
|||||||
import androidx.compose.material3.Badge
|
import androidx.compose.material3.Badge
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.Card
|
import androidx.compose.material3.Card
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.SnackbarDuration
|
import androidx.compose.material3.SnackbarDuration
|
||||||
@@ -153,7 +151,6 @@ fun DeleteConfirmDialog(show: Boolean = true, onExecuted: (Boolean) -> Unit = {}
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
|
||||||
@Composable
|
@Composable
|
||||||
fun HistoryList(
|
fun HistoryList(
|
||||||
games: List<GameWithScores>,
|
games: List<GameWithScores>,
|
||||||
@@ -166,18 +163,18 @@ fun HistoryList(
|
|||||||
LazyColumn(state = lazyListState) {
|
LazyColumn(state = lazyListState) {
|
||||||
items(
|
items(
|
||||||
items = games,
|
items = games,
|
||||||
key = { it.hashCode() }) {
|
key = { it.game.uid} ) {
|
||||||
if (it.game.active) {
|
if (it.game.active) {
|
||||||
HistoryListItem(
|
HistoryListItem(
|
||||||
it,
|
it,
|
||||||
Modifier
|
Modifier
|
||||||
.animateItemPlacement()
|
.animateItem()
|
||||||
.padding(2.dp)
|
.padding(2.dp)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
DismissibleHistoryListItem(
|
DismissibleHistoryListItem(
|
||||||
it,
|
it,
|
||||||
Modifier.animateItemPlacement(),
|
Modifier.animateItem(),
|
||||||
onOpenClicked,
|
onOpenClicked,
|
||||||
onDeleteClicked
|
onDeleteClicked
|
||||||
)
|
)
|
||||||
@@ -190,7 +187,7 @@ fun HistoryList(
|
|||||||
.padding(start = 4.dp, end = 4.dp, top = 10.dp)
|
.padding(start = 4.dp, end = 4.dp, top = 10.dp)
|
||||||
.align(CenterVertically)
|
.align(CenterVertically)
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.animateItemPlacement(),
|
.animateItem(),
|
||||||
onClick = { onDeleteAllClicked() }) {
|
onClick = { onDeleteAllClicked() }) {
|
||||||
Icon(imageVector = Icons.Outlined.DeleteForever, contentDescription = null)
|
Icon(imageVector = Icons.Outlined.DeleteForever, contentDescription = null)
|
||||||
Text(text = stringResource(id = R.string.deleteAll))
|
Text(text = stringResource(id = R.string.deleteAll))
|
||||||
@@ -202,7 +199,6 @@ fun HistoryList(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Composable
|
@Composable
|
||||||
fun DismissibleHistoryListItem(
|
fun DismissibleHistoryListItem(
|
||||||
game: GameWithScores,
|
game: GameWithScores,
|
||||||
@@ -212,32 +208,25 @@ fun DismissibleHistoryListItem(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
val density = LocalDensity.current
|
val density = LocalDensity.current
|
||||||
val dismissState =
|
val dismissState = rememberSwipeToDismissBoxState(positionalThreshold = { with(density) { 100.dp.toPx() } })
|
||||||
rememberSwipeToDismissBoxState(positionalThreshold = { with(density) { 100.dp.toPx() } },
|
|
||||||
|
|
||||||
confirmValueChange = {
|
|
||||||
if (it == SwipeToDismissBoxValue.EndToStart) {
|
|
||||||
onDeleteClicked(game.game.uid)
|
|
||||||
}
|
|
||||||
if (it == SwipeToDismissBoxValue.StartToEnd) {
|
|
||||||
onOpenClicked(game.game.uid)
|
|
||||||
}
|
|
||||||
true
|
|
||||||
})
|
|
||||||
|
|
||||||
SwipeToDismissBox(
|
SwipeToDismissBox(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
state = dismissState,
|
state = dismissState,
|
||||||
enableDismissFromEndToStart = true,
|
enableDismissFromEndToStart = true,
|
||||||
enableDismissFromStartToEnd = true,
|
enableDismissFromStartToEnd = true,
|
||||||
backgroundContent = {
|
backgroundContent = { ItemBackground(dismissState.targetValue) },
|
||||||
ItemBackground(dismissState.targetValue)
|
content = { HistoryListItem(game = game, modifier = Modifier.padding(2.dp)) },
|
||||||
}, content = {
|
onDismiss = {
|
||||||
HistoryListItem(game = game, modifier = Modifier.padding(2.dp))
|
when(it)
|
||||||
|
{
|
||||||
|
SwipeToDismissBoxValue.EndToStart -> onDeleteClicked(game.game.uid)
|
||||||
|
SwipeToDismissBoxValue.StartToEnd -> onOpenClicked(game.game.uid)
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ItemBackground(
|
fun ItemBackground(
|
||||||
dismissBoxValue: SwipeToDismissBoxValue
|
dismissBoxValue: SwipeToDismissBoxValue
|
||||||
@@ -248,7 +237,7 @@ fun ItemBackground(
|
|||||||
SwipeToDismissBoxValue.StartToEnd -> MaterialTheme.colorScheme.primary
|
SwipeToDismissBoxValue.StartToEnd -> MaterialTheme.colorScheme.primary
|
||||||
else -> MaterialTheme.colorScheme.background
|
else -> MaterialTheme.colorScheme.background
|
||||||
|
|
||||||
}, label = ""
|
}
|
||||||
)
|
)
|
||||||
val textColor by animateColorAsState(
|
val textColor by animateColorAsState(
|
||||||
when (dismissBoxValue) {
|
when (dismissBoxValue) {
|
||||||
@@ -256,10 +245,10 @@ fun ItemBackground(
|
|||||||
SwipeToDismissBoxValue.StartToEnd -> MaterialTheme.colorScheme.onPrimary
|
SwipeToDismissBoxValue.StartToEnd -> MaterialTheme.colorScheme.onPrimary
|
||||||
else -> MaterialTheme.colorScheme.onBackground
|
else -> MaterialTheme.colorScheme.onBackground
|
||||||
|
|
||||||
}, label = ""
|
}
|
||||||
)
|
)
|
||||||
val scale by animateFloatAsState(
|
val scale by animateFloatAsState(
|
||||||
if (dismissBoxValue == SwipeToDismissBoxValue.Settled) 0.75f else 1f, label = ""
|
if (dismissBoxValue == SwipeToDismissBoxValue.Settled) 0.75f else 1f
|
||||||
)
|
)
|
||||||
|
|
||||||
Box(
|
Box(
|
||||||
@@ -299,7 +288,6 @@ fun ItemBackground(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun BackgroundPreview() {
|
private fun BackgroundPreview() {
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@color/ic_launcher_background" />
|
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
</adaptive-icon>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.4 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 10 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB |
@@ -20,7 +20,6 @@
|
|||||||
<string name="delete">Löschen</string>
|
<string name="delete">Löschen</string>
|
||||||
<string name="deleteAll">Alle löschen</string>
|
<string name="deleteAll">Alle löschen</string>
|
||||||
<string name="active">Aktives Spiel</string>
|
<string name="active">Aktives Spiel</string>
|
||||||
<string name="inactive">Vergangene Spiele</string>
|
|
||||||
<string name="menu_counter">Counter</string>
|
<string name="menu_counter">Counter</string>
|
||||||
<string name="menu_about">About</string>
|
<string name="menu_about">About</string>
|
||||||
<string name="contact_us">Schreib uns</string>
|
<string name="contact_us">Schreib uns</string>
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
<string name="delete">Delete</string>
|
<string name="delete">Delete</string>
|
||||||
<string name="deleteAll">Delete all</string>
|
<string name="deleteAll">Delete all</string>
|
||||||
<string name="active">Current Game</string>
|
<string name="active">Current Game</string>
|
||||||
<string name="inactive">Old Games</string>
|
|
||||||
<string name="menu_counter">Counter</string>
|
<string name="menu_counter">Counter</string>
|
||||||
<string name="menu_about">About</string>
|
<string name="menu_about">About</string>
|
||||||
<string name="contact_us">Contact us</string>
|
<string name="contact_us">Contact us</string>
|
||||||
|
|||||||
12
build.gradle
12
build.gradle
@@ -1,12 +1,11 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = "1.9.24"
|
ext.kotlin_version = '2.2.10'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:8.13.2'
|
classpath 'com.android.tools.build:gradle:9.1.0'
|
||||||
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
|
||||||
@@ -15,9 +14,10 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.google.dagger.hilt.android' version '2.51.1' apply false
|
id 'com.google.dagger.hilt.android' version '2.59' apply false
|
||||||
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
|
id 'org.jetbrains.kotlin.android' version '2.2.10' apply false
|
||||||
id 'com.google.devtools.ksp' version '1.9.24-1.0.20' apply false
|
id 'com.google.devtools.ksp' version '2.3.5' apply false
|
||||||
|
id 'org.jetbrains.kotlin.plugin.compose' version '2.2.10' apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ android.useAndroidX=true
|
|||||||
android.enableJetifier=false
|
android.enableJetifier=false
|
||||||
# Kotlin code style for this project: "official" or "obsolete":
|
# Kotlin code style for this project: "official" or "obsolete":
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
android.defaults.buildfeatures.buildconfig=true
|
|
||||||
android.nonTransitiveRClass=true
|
android.nonTransitiveRClass=true
|
||||||
android.nonFinalResIds=false
|
android.usesSdkInManifest.disallowed=false
|
||||||
|
android.uniquePackageNames=false
|
||||||
|
android.dependency.useConstraints=true
|
||||||
|
android.r8.strictFullModeForKeepRules=false
|
||||||
13
gradle/gradle-daemon-jvm.properties
Normal file
13
gradle/gradle-daemon-jvm.properties
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#This file is generated by updateDaemonJvm
|
||||||
|
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/536afcd1dff540251f85e5d2c80458cf/redirect
|
||||||
|
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/ecd23fd7707c683afbcd6052998cb6a9/redirect
|
||||||
|
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/536afcd1dff540251f85e5d2c80458cf/redirect
|
||||||
|
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/ecd23fd7707c683afbcd6052998cb6a9/redirect
|
||||||
|
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/e99bae143b75f9a10ead10248f02055e/redirect
|
||||||
|
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/04e088f8677de3b384108493cc9481d0/redirect
|
||||||
|
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/536afcd1dff540251f85e5d2c80458cf/redirect
|
||||||
|
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/ecd23fd7707c683afbcd6052998cb6a9/redirect
|
||||||
|
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/248ffb1098f61659502d0c09aa348294/redirect
|
||||||
|
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/056dc25d3b9d168ede8b94d3d2f99942/redirect
|
||||||
|
toolchainVendor=JETBRAINS
|
||||||
|
toolchainVersion=21
|
||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -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.13-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-all.zip
|
||||||
|
|||||||
@@ -1,2 +1,5 @@
|
|||||||
|
plugins {
|
||||||
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
|
||||||
|
}
|
||||||
include ':app'
|
include ':app'
|
||||||
rootProject.name = "Tichu Counter"
|
rootProject.name = "Tichu Counter"
|
||||||
Reference in New Issue
Block a user