diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7c8c2aa3..716da607 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,13 +1,12 @@ plugins { alias(libs.plugins.android.application) alias(libs.plugins.devtools.ksp) - alias(libs.plugins.kotlin.android) alias(libs.plugins.kotlin.serialization) alias(libs.plugins.kotlin.compose.compiler) } android { - compileSdk = 36 + compileSdk = 37 namespace = "com.github.capntrips.kernelflasher" defaultConfig { @@ -34,85 +33,84 @@ android { vectorDrawables { useSupportLibrary = true } - } + } - buildTypes { - release { - isMinifyEnabled = false - isShrinkResources = false - proguardFiles( - getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" - ) - } + buildTypes { + release { + isMinifyEnabled = true + isShrinkResources = true + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" + ) } + } - sourceSets { - getByName("main") { - jniLibs.srcDirs("src/main/jniLibs") - } + sourceSets { + getByName("main") { + jniLibs.directories += "src/main/jniLibs" } + } - buildFeatures { - buildConfig = true - aidl = true - compose = true - } + buildFeatures { + buildConfig = true + aidl = true + compose = true + } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 - } - - kotlin { - jvmToolchain(21) + compileOptions { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 + } + packaging { + resources { + excludes += setOf("/META-INF/{AL2.0,LGPL2.1}") } - - packaging { - resources { - excludes += setOf("/META-INF/{AL2.0,LGPL2.1}") - } - jniLibs { - useLegacyPackaging = true - } - dex { - useLegacyPackaging = true - } + jniLibs { + useLegacyPackaging = true } - - androidResources { - generateLocaleConfig = true + dex { + useLegacyPackaging = true } + } - ksp { - arg("room.schemaLocation", "$projectDir/schemas") - arg("room.incremental", "true") - } + androidResources { + generateLocaleConfig = true + } +} + +kotlin { + jvmToolchain(21) +} + +ksp { + arg("room.schemaLocation", "$projectDir/schemas") + arg("room.incremental", "true") } - dependencies { - implementation(libs.androidx.activity.compose) - implementation(libs.androidx.appcompat) - implementation(libs.androidx.compose.material) - implementation(libs.androidx.compose.material3) - implementation(libs.androidx.compose.foundation) - implementation(libs.androidx.compose.ui) - implementation(libs.androidx.core.ktx) - implementation(libs.androidx.core.splashscreen) - implementation(libs.androidx.lifecycle.runtime.ktx) - implementation(libs.androidx.lifecycle.viewmodel.compose) - implementation(libs.androidx.navigation.compose) - implementation(libs.androidx.room.runtime) - annotationProcessor(libs.androidx.room.compiler) - ksp(libs.androidx.room.compiler) - implementation(libs.libsu.core) - implementation(libs.libsu.io) - implementation(libs.libsu.nio) - implementation(libs.libsu.service) - implementation(libs.material) - implementation(libs.okhttp) - implementation(libs.kotlinx.serialization.json) - implementation(libs.kotlinx.serialization.json) - implementation(libs.retrofit) - implementation(libs.converter.gson) - } \ No newline at end of file +dependencies { + implementation(libs.androidx.activity.compose) + implementation(libs.androidx.appcompat) + implementation(libs.androidx.compose.material) + implementation(libs.androidx.compose.material3) + implementation(libs.androidx.compose.material.icons.core) + implementation(libs.androidx.compose.foundation) + implementation(libs.androidx.compose.ui) + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.core.splashscreen) + implementation(libs.androidx.lifecycle.runtime.ktx) + implementation(libs.androidx.lifecycle.viewmodel.compose) + implementation(libs.androidx.navigation.compose) + implementation(libs.androidx.room.runtime) + annotationProcessor(libs.androidx.room.compiler) + ksp(libs.androidx.room.compiler) + implementation(libs.libsu.core) + implementation(libs.libsu.io) + implementation(libs.libsu.nio) + implementation(libs.libsu.service) + implementation(libs.material) + implementation(libs.okhttp) + implementation(libs.kotlinx.serialization.json) + implementation(libs.retrofit) + implementation(libs.converter.gson) +} \ No newline at end of file diff --git a/app/src/main/java/com/github/capntrips/kernelflasher/ui/screens/RefreshableScreen.kt b/app/src/main/java/com/github/capntrips/kernelflasher/ui/screens/RefreshableScreen.kt index 2d9af1d0..0c45e8eb 100644 --- a/app/src/main/java/com/github/capntrips/kernelflasher/ui/screens/RefreshableScreen.kt +++ b/app/src/main/java/com/github/capntrips/kernelflasher/ui/screens/RefreshableScreen.kt @@ -19,7 +19,7 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.pullrefresh.PullRefreshIndicator import androidx.compose.material.pullrefresh.pullRefresh import androidx.compose.material.pullrefresh.rememberPullRefreshState @@ -73,7 +73,7 @@ fun RefreshableScreen( modifier = Modifier.padding(16.dp, 8.dp, 0.dp, 8.dp) ) { Icon( - Icons.Filled.ArrowBack, + Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.back), tint = MaterialTheme.colorScheme.onSurface ) diff --git a/app/src/main/java/com/github/capntrips/kernelflasher/ui/screens/backups/BackupsContent.kt b/app/src/main/java/com/github/capntrips/kernelflasher/ui/screens/backups/BackupsContent.kt index f502b7fb..8d886e68 100644 --- a/app/src/main/java/com/github/capntrips/kernelflasher/ui/screens/backups/BackupsContent.kt +++ b/app/src/main/java/com/github/capntrips/kernelflasher/ui/screens/backups/BackupsContent.kt @@ -47,8 +47,7 @@ fun ColumnScope.BackupsContent( DataCard (viewModel.currentBackup!!) { val cardWidth = remember { mutableIntStateOf(0) } val backupId = viewModel.currentBackup!! - val currentBackup = viewModel.backups[backupId] - if(currentBackup == null) return@DataCard + val currentBackup = viewModel.backups[backupId] ?: return@DataCard DataRow(stringResource(R.string.backup_type), currentBackup.type, mutableMaxWidth = cardWidth) DataRow(stringResource(R.string.kernel_version), currentBackup.kernelVersion, mutableMaxWidth = cardWidth, clickable = true) if (currentBackup.type == "raw") { diff --git a/app/src/main/java/com/github/capntrips/kernelflasher/ui/screens/updates/UpdatesViewModel.kt b/app/src/main/java/com/github/capntrips/kernelflasher/ui/screens/updates/UpdatesViewModel.kt index df2a6ef3..1a32974d 100644 --- a/app/src/main/java/com/github/capntrips/kernelflasher/ui/screens/updates/UpdatesViewModel.kt +++ b/app/src/main/java/com/github/capntrips/kernelflasher/ui/screens/updates/UpdatesViewModel.kt @@ -31,6 +31,7 @@ import java.util.Date import java.util.Locale import kotlin.io.path.Path import kotlin.io.path.name +import androidx.core.net.toUri @ExperimentalSerializationApi class UpdatesViewModel( @@ -74,7 +75,7 @@ class UpdatesViewModel( try { block() } catch (e: Exception) { - withContext (Dispatchers.Main) { + withContext(Dispatchers.Main) { Log.e(TAG, e.message, e) navController.navigate("error/${e.message}") { popUpTo("main") @@ -112,7 +113,7 @@ class UpdatesViewModel( client.newCall(request).execute().use { response -> if (!response.isSuccessful) throw IOException("Unexpected response: $response") - val update: Update = Json.decodeFromString(UpdateSerializer, response.body!!.string()) + val update: Update = Json.decodeFromString(UpdateSerializer, response.body.string()) update.updateUri = url update.lastUpdated = Date() val updateId = updateDao.insert(update).toInt() @@ -133,7 +134,7 @@ class UpdatesViewModel( client.newCall(request).execute().use { response -> if (!response.isSuccessful) throw IOException("Unexpected response: $response") - val update: Update = Json.decodeFromString(UpdateSerializer, response.body!!.string()) + val update: Update = Json.decodeFromString(UpdateSerializer, response.body.string()) currentUpdate!!.let { withContext (Dispatchers.Main) { it.kernelName = update.kernelName @@ -161,7 +162,7 @@ class UpdatesViewModel( client.newCall(request).execute().use { response -> if (!response.isSuccessful) throw IOException("Unexpected response: $response") - changelog = response.body!!.string() + changelog = response.body.string() withContext (Dispatchers.Main) { callback.invoke() } @@ -180,7 +181,7 @@ class UpdatesViewModel( fun downloadKernel(context: Context) { launch { - val remoteUri = Uri.parse(currentUpdate!!.kernelLink) + val remoteUri = currentUpdate!!.kernelLink.toUri() val filename = Path(remoteUri.path!!).name val localUri = insertDownload(context, filename) localUri!!.let { uri -> @@ -190,7 +191,7 @@ class UpdatesViewModel( client.newCall(request).execute().use { response -> if (!response.isSuccessful) throw IOException("Unexpected response: $response") - response.body!!.byteStream().use { inputStream -> + response.body.byteStream().use { inputStream -> context.contentResolver.openOutputStream(uri)!!.use { outputStream -> inputStream.copyTo(outputStream) } diff --git a/gradle.properties b/gradle.properties index 506c3664..6929e443 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,5 +21,7 @@ kotlin.code.style=official # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library android.nonTransitiveRClass=true - -android.defaults.buildfeatures.buildconfig=true \ No newline at end of file +android.uniquePackageNames=false +android.dependency.useConstraints=true +android.r8.strictFullModeForKeepRules=false +android.generateSyncIssueWhenLibraryConstraintsAreEnabled=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..baa28d15 --- /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/491f83666ae7f4d6ebb28fee72ebb035/redirect +toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/0d1a1acdc708062093673f65aa9aba4b/redirect +toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/491f83666ae7f4d6ebb28fee72ebb035/redirect +toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/0d1a1acdc708062093673f65aa9aba4b/redirect +toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7083b89563e7ce20943037b8cd2b8cc2/redirect +toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/060bbb778a1f55ea705fdebd2ccfeab9/redirect +toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/491f83666ae7f4d6ebb28fee72ebb035/redirect +toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/0d1a1acdc708062093673f65aa9aba4b/redirect +toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/d09679dc60fe5aa05ef7d03efdefac20/redirect +toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/ed4e3bf2f5e7c5d9aabc4cbd8acd555e/redirect +toolchainVendor=JETBRAINS +toolchainVersion=21 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1f91d686..85648e34 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,22 +1,23 @@ [versions] -kotlin = "2.3.0" +kotlin = "2.4.0" -androidx-activity-compose = "1.12.2" +androidx-activity-compose = "1.13.0" androidx-appcompat = "1.7.1" -androidx-compose = "1.10.0" -androidx-compose-material3 = "1.3.2" -androidx-core-ktx = "1.17.0" +androidx-compose = "1.11.2" +androidx-compose-material3 = "1.4.0" +androidx-compose-material-icons = "1.7.8" +androidx-core-ktx = "1.19.0" androidx-core-splashscreen = "1.2.0" androidx-lifecycle = "2.10.0" -androidx-navigation-compose = "2.9.6" +androidx-navigation-compose = "2.9.8" androidx-room = "2.8.4" kotlinx-serialization-json = "1.9.0" libsu = "6.0.0" -material = "1.13.0" -okhttp = "5.3.2" +material = "1.14.0" +okhttp = "5.4.0" -android-application = "8.13.2" -devtools-ksp = "2.3.4" +android-application = "9.2.1" +devtools-ksp = "2.3.9" retrofit = "3.0.0" [libraries] @@ -24,6 +25,7 @@ androidx-activity-compose = { group = "androidx.activity", name = "activity-comp androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidx-appcompat" } androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation", version.ref = "androidx-compose" } androidx-compose-material = { group = "androidx.compose.material", name = "material", version.ref = "androidx-compose" } +androidx-compose-material-icons-core = { group = "androidx.compose.material", name = "material-icons-core", version.ref = "androidx-compose-material-icons" } androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "androidx-compose-material3" } androidx-compose-ui = { group = "androidx.compose.ui", name="ui", version.ref = "androidx-compose" } androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core-ktx" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7f839b65..cb496d17 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Fri Apr 14 13:36:42 CDT 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle.kts b/settings.gradle.kts index 35028225..07cc780b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -5,6 +5,9 @@ pluginManagement { mavenCentral() } } +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.10.0" +} dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories {