diff --git a/src/KenjinxAndroid/app/build.gradle b/src/KenjinxAndroid/app/build.gradle index 364a43e22..577d2c9a0 100644 --- a/src/KenjinxAndroid/app/build.gradle +++ b/src/KenjinxAndroid/app/build.gradle @@ -1,6 +1,6 @@ plugins { id 'com.android.application' - id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.kotlin.plugin.compose' } android { @@ -37,13 +37,8 @@ android { buildTypes { release { - postprocessing { - removeUnusedCode false - removeUnusedResources true - obfuscate false - optimizeCode true - proguardFiles 'proguard-rules.pro' - } + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' signingConfig signingConfigs.debug debuggable false jniDebuggable false @@ -53,18 +48,11 @@ android { sourceCompatibility JavaVersion.VERSION_21 targetCompatibility JavaVersion.VERSION_21 } - kotlinOptions { - jvmTarget = '21' - freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn", "-Xallow-jvm-ir-dependencies"] - } buildFeatures { compose true prefab true buildConfig true } - composeOptions { - kotlinCompilerExtensionVersion '1.5.15' - } packagingOptions { jniLibs { keepDebugSymbols += '**/libkenjinx.so' @@ -77,7 +65,7 @@ android { externalNativeBuild { cmake { path file('src/main/cpp/CMakeLists.txt') - version '3.22.1' + version '4.2.1' } } @@ -94,7 +82,7 @@ tasks.named("preBuild") { dependencies { runtimeOnly project(":libkenjinx") - implementation 'androidx.activity:activity-compose:1.10.1' + implementation 'androidx.activity:activity-compose:1.12.2' implementation 'androidx.appcompat:appcompat:1.7.1' implementation 'androidx.compose.material3:material3' implementation 'androidx.compose.material:material-icons-extended:1.7.8' @@ -103,28 +91,28 @@ dependencies { implementation 'androidx.compose.ui:ui-tooling-preview' implementation 'androidx.constraintlayout:constraintlayout:2.2.1' implementation 'androidx.core:core-ktx:1.17.0' - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.9.1' - implementation 'androidx.navigation:navigation-compose:2.9.3' + implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.10.0' + implementation 'androidx.navigation:navigation-compose:2.9.6' implementation 'androidx.preference:preference-ktx:1.2.1' implementation 'br.com.devsrsouza.compose.icons:css-gg:1.1.1' - implementation 'com.anggrayudi:storage:1.5.6' + implementation 'com.anggrayudi:storage:2.2.0' implementation 'com.github.swordfish90:radialgamepad:2.0.0' implementation 'com.google.android.material:material:1.13.0' - implementation 'com.google.code.gson:gson:2.13.1' + implementation 'com.google.code.gson:gson:2.13.2' implementation 'com.halilibo.compose-richtext:richtext-commonmark:0.20.0' implementation 'com.halilibo.compose-richtext:richtext-ui-material3:0.20.0' implementation 'com.halilibo.compose-richtext:richtext-ui:0.20.0' implementation 'io.coil-kt:coil-compose:2.7.0' - implementation 'net.java.dev.jna:jna:5.17.0@aar' + implementation 'net.java.dev.jna:jna:5.18.1@aar' implementation 'net.lingala.zip4j:zip4j:2.11.5' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0' - implementation platform('androidx.compose:compose-bom:2024.08.00') + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2' + implementation platform('androidx.compose:compose-bom:2026.01.00') implementation platform('org.jetbrains.kotlin:kotlin-bom:1.9.25') androidTestImplementation 'androidx.compose.ui:ui-test-junit4' androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0' androidTestImplementation 'androidx.test.ext:junit:1.3.0' - androidTestImplementation platform('androidx.compose:compose-bom:2024.08.00') + androidTestImplementation platform('androidx.compose:compose-bom:2026.01.00') testImplementation 'junit:junit:4.13.2' debugImplementation 'androidx.compose.ui:ui-test-manifest' debugImplementation 'androidx.compose.ui:ui-tooling' diff --git a/src/KenjinxAndroid/app/proguard-rules.pro b/src/KenjinxAndroid/app/proguard-rules.pro index 2ad627c63..b975a0402 100644 --- a/src/KenjinxAndroid/app/proguard-rules.pro +++ b/src/KenjinxAndroid/app/proguard-rules.pro @@ -13,6 +13,7 @@ -repackageclasses '' -keepattributes Exceptions,InnerClasses,Signature,*Annotation* -dontpreverify +-keep class ** { *; } -keep public class * extends android.app.Activity -keep public class * extends android.app.Application -keep public class * extends android.app.Service diff --git a/src/KenjinxAndroid/app/src/main/java/org/kenjinx/android/viewmodels/HomeViewModel.kt b/src/KenjinxAndroid/app/src/main/java/org/kenjinx/android/viewmodels/HomeViewModel.kt index ce4232ec5..1bfa476d9 100644 --- a/src/KenjinxAndroid/app/src/main/java/org/kenjinx/android/viewmodels/HomeViewModel.kt +++ b/src/KenjinxAndroid/app/src/main/java/org/kenjinx/android/viewmodels/HomeViewModel.kt @@ -82,11 +82,23 @@ class HomeViewModel( thread { try { - for (file in folder.search(true, DocumentFileType.FILE)) { - if (file.extension == "xci" || file.extension == "nsp" || file.extension == "nro") - activity.let { - loadedCache.add(GameModel(file, it)) + val validExtensions = setOf("xci", "nsp", "nro") + val queue = mutableListOf(folder) + + while (queue.isNotEmpty()) { + val current = queue.removeAt(0) + current.listFiles().forEach { file -> + when { + file.isFile && file.extension?.lowercase() in validExtensions -> { + val game = GameModel(file, activity) + + if(!game.isUnknown()) { + loadedCache.add(game) + } + } + file.isDirectory -> queue.add(file) } + } } loadedCache.sortWith { itemA, itemB -> diff --git a/src/KenjinxAndroid/app/src/main/java/org/kenjinx/android/viewmodels/SettingsViewModel.kt b/src/KenjinxAndroid/app/src/main/java/org/kenjinx/android/viewmodels/SettingsViewModel.kt index dbdc52623..1584ec6f8 100644 --- a/src/KenjinxAndroid/app/src/main/java/org/kenjinx/android/viewmodels/SettingsViewModel.kt +++ b/src/KenjinxAndroid/app/src/main/java/org/kenjinx/android/viewmodels/SettingsViewModel.kt @@ -4,9 +4,7 @@ import android.content.SharedPreferences import androidx.compose.runtime.MutableState import androidx.documentfile.provider.DocumentFile import androidx.preference.PreferenceManager -import com.anggrayudi.storage.callback.FileCallback import com.anggrayudi.storage.file.FileFullPath -import com.anggrayudi.storage.file.copyFileTo import com.anggrayudi.storage.file.extension import com.anggrayudi.storage.file.getAbsolutePath import com.anggrayudi.storage.file.openInputStream @@ -286,16 +284,18 @@ class SettingsViewModel(val activity: MainActivity) { installState.value = KeyInstallState.Install thread { Thread.sleep(1000) - this.copyFileTo( - activity, - outputFolder, - callback = object : FileCallback() { - override fun onCompleted(result: Any) { - KenjinxNative.deviceReloadFilesystem() - installState.value = KeyInstallState.Done + try { + this.openInputStream(activity)?.use { input -> + outputFile.outputStream().use { output -> + input.copyTo(output) } } - ) + + KenjinxNative.deviceReloadFilesystem() + installState.value = KeyInstallState.Done + } catch (e: Exception) { + installState.value = KeyInstallState.Cancelled + } } } } diff --git a/src/KenjinxAndroid/build.gradle b/src/KenjinxAndroid/build.gradle index 25d37a657..4890b9303 100644 --- a/src/KenjinxAndroid/build.gradle +++ b/src/KenjinxAndroid/build.gradle @@ -1,6 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id 'com.android.application' version '8.13.2' apply false - id 'com.android.library' version '8.13.2' apply false - id 'org.jetbrains.kotlin.android' version '1.9.25' apply false + id 'com.android.application' version '9.0.0' apply false + id 'com.android.library' version '9.0.0' apply false + id 'org.jetbrains.kotlin.android' version '2.3.0' apply false + id 'org.jetbrains.kotlin.plugin.compose' version '2.3.0' apply false } diff --git a/src/KenjinxAndroid/gradle/wrapper/gradle-wrapper.properties b/src/KenjinxAndroid/gradle/wrapper/gradle-wrapper.properties index 5a7b575e9..014f53a51 100644 --- a/src/KenjinxAndroid/gradle/wrapper/gradle-wrapper.properties +++ b/src/KenjinxAndroid/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Fri Jun 30 08:45:05 UTC 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists