From 81183b6d412883d4f23105a3dbdc0ab04ca7ac27 Mon Sep 17 00:00:00 2001 From: hegocre <15657088+hegocre@users.noreply.github.com> Date: Tue, 7 Apr 2026 19:36:01 +0200 Subject: [PATCH] Update libraries + AGP 9 --- app/build.gradle | 36 ++++++++++--------- .../ui/components/NCPAppLock.kt | 20 ++++++----- .../ui/viewmodels/PasswordsViewModel.kt | 34 +++++++++++------- build.gradle | 7 ++-- gradle.properties | 5 ++- gradle/gradle-daemon-jvm.properties | 13 +++++++ gradle/wrapper/gradle-wrapper.properties | 4 +-- 7 files changed, 74 insertions(+), 45 deletions(-) create mode 100644 gradle/gradle-daemon-jvm.properties diff --git a/app/build.gradle b/app/build.gradle index e5423d3e..4217709b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { id 'com.android.application' - id 'kotlin-android' id 'com.google.devtools.ksp' version "$ksp_version" id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlin_version" id 'org.jetbrains.kotlin.plugin.compose' version "$kotlin_version" @@ -18,22 +17,23 @@ android { namespace = 'com.hegocre.nextcloudpasswords' compileSdk = 36 + def vCode = 38 + def vName = "1.0.12" + defaultConfig { applicationId "com.hegocre.nextcloudpasswords" minSdk 24 targetSdk 36 - versionCode 38 - versionName "1.0.12" + versionCode vCode + versionName vName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary = true } - applicationVariants.configureEach { variant -> - variant.resValue "string", "version_name", variant.versionName - variant.resValue "string", "version_code", variant.versionCode.toString() - } + resValue "string", "version_name", vName + resValue "string", "version_code", vCode.toString() } androidResources { @@ -53,6 +53,7 @@ android { debuggable true applicationIdSuffix ".debug" versionNameSuffix "-DEBUG" + resValue "string", "version_name", "${vName}-DEBUG" } } splits { @@ -65,6 +66,7 @@ android { buildFeatures { compose = true buildConfig = true + resValues = true } packagingOptions { resources { @@ -77,20 +79,20 @@ android { } dependencies { - implementation 'androidx.core:core-ktx:1.17.0' + implementation 'androidx.core:core-ktx:1.18.0' implementation 'dev.spght:encryptedprefs-ktx:1.1.1' - implementation 'androidx.datastore:datastore-preferences:1.2.0' + implementation 'androidx.datastore:datastore-preferences:1.2.1' implementation 'com.squareup.okhttp3:okhttp:5.3.2' implementation 'com.goterl:lazysodium-android:5.2.0@aar' implementation 'net.java.dev.jna:jna:5.18.1@aar' - implementation 'org.commonmark:commonmark:0.27.0' + implementation 'org.commonmark:commonmark:0.28.0' implementation 'io.coil-kt:coil-compose:2.7.0' //Compose dependencies - implementation platform('androidx.compose:compose-bom:2025.12.01') + implementation platform('androidx.compose:compose-bom:2026.03.01') implementation 'androidx.compose.ui:ui' implementation 'androidx.compose.material3:material3' implementation 'androidx.compose.ui:ui-tooling-preview' @@ -98,25 +100,25 @@ dependencies { implementation 'androidx.compose.runtime:runtime-livedata' implementation 'androidx.compose.foundation:foundation' - implementation 'androidx.navigation:navigation-compose:2.9.6' - implementation 'androidx.activity:activity-compose:1.12.2' + implementation 'androidx.navigation:navigation-compose:2.9.7' + implementation 'androidx.activity:activity-compose:1.13.0' implementation 'androidx.biometric:biometric:1.1.0' implementation 'androidx.autofill:autofill:1.3.0' - implementation 'androidx.work:work-runtime-ktx:2.11.0' + implementation 'androidx.work:work-runtime-ktx:2.11.2' //Room dependencies implementation "androidx.room:room-ktx:$room_version" ksp "androidx.room:room-compiler:$room_version" - implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0' + implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.10.0' - implementation 'com.materialkolor:material-kolor:4.0.5' + implementation 'com.materialkolor:material-kolor:4.1.1' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.arch.core:core-testing:2.2.0' - androidTestImplementation platform('androidx.compose:compose-bom:2025.12.01') + androidTestImplementation platform('androidx.compose:compose-bom:2026.03.01') androidTestImplementation 'androidx.test.ext:junit:1.3.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0' androidTestImplementation 'androidx.compose.ui:ui-test-junit4' diff --git a/app/src/main/java/com/hegocre/nextcloudpasswords/ui/components/NCPAppLock.kt b/app/src/main/java/com/hegocre/nextcloudpasswords/ui/components/NCPAppLock.kt index aea82aad..347cf0d6 100644 --- a/app/src/main/java/com/hegocre/nextcloudpasswords/ui/components/NCPAppLock.kt +++ b/app/src/main/java/com/hegocre/nextcloudpasswords/ui/components/NCPAppLock.kt @@ -53,6 +53,7 @@ import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.platform.LocalViewConfiguration +import androidx.compose.ui.platform.LocalWindowInfo import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -122,6 +123,9 @@ fun NextcloudPasswordsAppLock( .canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_STRONG) == BiometricManager.BIOMETRIC_SUCCESS } + val biometricPromptTitle = stringResource(R.string.biometric_prompt_title) + val biometricPromptDescription = stringResource(R.string.biometric_prompt_description) + LaunchedEffect(key1 = inputPassword) { if (onCheckPasscode(inputPassword).await()) { onCorrectPasscode() @@ -139,8 +143,8 @@ fun NextcloudPasswordsAppLock( if (hasBiometricAppLock && canAuthenticateBiometric) { showBiometricPrompt( context = context, - title = context.getString(R.string.biometric_prompt_title), - description = context.getString(R.string.biometric_prompt_description), + title = biometricPromptTitle, + description = biometricPromptDescription, onBiometricUnlock = onCorrectPasscode ) } @@ -202,8 +206,8 @@ fun NextcloudPasswordsAppLock( onBiometricClick = { showBiometricPrompt( context = context, - title = context.getString(R.string.biometric_prompt_title), - description = context.getString(R.string.biometric_prompt_description), + title = biometricPromptTitle, + description = biometricPromptDescription, onBiometricUnlock = onCorrectPasscode ) }, @@ -235,8 +239,8 @@ fun NextcloudPasswordsAppLock( onBiometricClick = { showBiometricPrompt( context = context, - title = context.getString(R.string.biometric_prompt_title), - description = context.getString(R.string.biometric_prompt_description), + title = biometricPromptTitle, + description = biometricPromptDescription, onBiometricUnlock = onCorrectPasscode ) }, @@ -474,11 +478,11 @@ fun KeyboardDigitIndicator( @Composable fun screenHeight(): Float = - LocalConfiguration.current.screenHeightDp.toFloat() + LocalWindowInfo.current.containerDpSize.height.value @Composable fun screenWidth(): Float = - LocalConfiguration.current.screenWidthDp.toFloat() + LocalWindowInfo.current.containerDpSize.width.value @Composable fun buttonSize(): Int { diff --git a/app/src/main/java/com/hegocre/nextcloudpasswords/ui/viewmodels/PasswordsViewModel.kt b/app/src/main/java/com/hegocre/nextcloudpasswords/ui/viewmodels/PasswordsViewModel.kt index 50fc6e85..df3a9e3a 100644 --- a/app/src/main/java/com/hegocre/nextcloudpasswords/ui/viewmodels/PasswordsViewModel.kt +++ b/app/src/main/java/com/hegocre/nextcloudpasswords/ui/viewmodels/PasswordsViewModel.kt @@ -5,14 +5,16 @@ import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.IntentFilter -import android.content.res.ColorStateList import android.os.Build import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.platform.LocalContext +import androidx.core.content.ContextCompat +import androidx.core.graphics.drawable.DrawableCompat import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData @@ -299,13 +301,16 @@ class PasswordsViewModel(application: Application) : AndroidViewModel(applicatio addHeader("OCS-APIRequest", "true") addHeader("Authorization", Credentials.basic(server.username, server.password)) crossfade(true) - val lockDrawable = context.getDrawable(R.drawable.ic_lock)?.apply { - setTintList( - ColorStateList.valueOf( - MaterialTheme.colorScheme.primary.toArgb() - ) - ) + + val tintColor = MaterialTheme.colorScheme.primary.toArgb() + val lockDrawable = remember(context, tintColor) { + ContextCompat.getDrawable(context, R.drawable.ic_lock)?.let { drawable -> + val wrappedDrawable = DrawableCompat.wrap(drawable).mutate() + DrawableCompat.setTint(wrappedDrawable, tintColor) + wrappedDrawable + } } + placeholder(lockDrawable) fallback(lockDrawable) error(lockDrawable) @@ -324,13 +329,16 @@ class PasswordsViewModel(application: Application) : AndroidViewModel(applicatio addHeader("OCS-APIRequest", "true") addHeader("Authorization", Credentials.basic(server.username, server.password)) crossfade(true) - val accountDrawable = context.getDrawable(R.drawable.ic_account_circle)?.apply { - setTintList( - ColorStateList.valueOf( - MaterialTheme.colorScheme.primary.toArgb() - ) - ) + + val tintColor = MaterialTheme.colorScheme.primary.toArgb() + val accountDrawable = remember(context, tintColor) { + ContextCompat.getDrawable(context, R.drawable.ic_account_circle)?.let { drawable -> + val wrappedDrawable = DrawableCompat.wrap(drawable).mutate() + DrawableCompat.setTint(wrappedDrawable, tintColor) + wrappedDrawable + } } + placeholder(accountDrawable) fallback(accountDrawable) error(accountDrawable) diff --git a/build.gradle b/build.gradle index 2659b135..03044d0c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,17 +1,16 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext { - kotlin_version = '2.2.21' + kotlin_version = '2.3.10' room_version = '2.8.4' - ksp_version = '2.3.3' + ksp_version = '2.3.6' } repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.13.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath 'com.android.tools.build:gradle:9.1.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle.properties b/gradle.properties index 44fadca5..0019da66 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,4 +21,7 @@ android.enableJetifier=false kotlin.code.style=official android.nonTransitiveRClass=true android.nonFinalResIds=true -org.gradle.unsafe.configuration-cache=true \ No newline at end of file +org.gradle.unsafe.configuration-cache=true +android.uniquePackageNames=false +android.dependency.useConstraints=false +android.r8.strictFullModeForKeepRules=false \ No newline at end of file diff --git a/gradle/gradle-daemon-jvm.properties b/gradle/gradle-daemon-jvm.properties new file mode 100644 index 00000000..500e9091 --- /dev/null +++ b/gradle/gradle-daemon-jvm.properties @@ -0,0 +1,13 @@ +#This file is generated by updateDaemonJvm +toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/29ee363f71d060405f729a8f1b7f7aef/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/29ee363f71d060405f729a8f1b7f7aef/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/10fc3bf1ee0001078a473afe6e43cfdb/redirect +toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/9c55677aff3966382f3d853c0959bfb2/redirect +toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/29ee363f71d060405f729a8f1b7f7aef/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/ac151d55def6b6a9a159dc4cb4642851/redirect +toolchainVendor=JETBRAINS +toolchainVersion=21 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 36e4933e..41465649 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=20f1b1176237254a6fc204d8434196fa11a4cfb387567519c61556e8710aed78 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip +distributionSha256Sum=b266d5ff6b90eada6dc3b20cb090e3731302e553a27c5d3e4df1f0d76beaff06 +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME