From 538478cac811655b077716383b1598db8de5e4dc Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 11 Mar 2022 22:26:03 -0500 Subject: [PATCH] Add shortcut to change app language in Android 13 --- app/build.gradle.kts | 8 ++++---- .../ui/setting/SettingsGeneralController.kt | 13 +++++++++++++ app/src/main/res/values/strings.xml | 1 + buildSrc/src/main/kotlin/AndroidConfig.kt | 6 ------ 4 files changed, 18 insertions(+), 10 deletions(-) delete mode 100644 buildSrc/src/main/kotlin/AndroidConfig.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index bd067c9468..4ffc0bd04f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -17,13 +17,13 @@ shortcutHelper.setFilePath("./shortcuts.xml") val SUPPORTED_ABIS = setOf("armeabi-v7a", "arm64-v8a", "x86") android { - compileSdk = AndroidConfig.compileSdk - ndkVersion = AndroidConfig.ndk + compileSdkPreview = "Tiramisu" + ndkVersion = "22.1.7171670" defaultConfig { applicationId = "eu.kanade.tachiyomi" - minSdk = AndroidConfig.minSdk - targetSdk = AndroidConfig.targetSdk + minSdk = 23 + targetSdk = 29 versionCode = 76 versionName = "0.13.1" diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt index 3687108723..aa780281c5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.setting import android.content.Intent import android.os.Build import android.provider.Settings +import androidx.core.net.toUri import androidx.preference.PreferenceScreen import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.preference.bindTo @@ -54,5 +55,17 @@ class SettingsGeneralController : SettingsController() { } } } + if (Build.VERSION.CODENAME == "Tiramisu") { + preference { + key = "pref_manage_language" + titleRes = R.string.pref_app_language + onClick { + val intent = Intent(Settings.ACTION_APP_LOCALE_SETTINGS).apply { + data = "package:${context.packageName}".toUri() + } + startActivity(intent) + } + } + } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 608ad5cf14..df28e93d39 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -178,6 +178,7 @@ Start screen Confirm exit Manage notifications + App language Security Require unlock diff --git a/buildSrc/src/main/kotlin/AndroidConfig.kt b/buildSrc/src/main/kotlin/AndroidConfig.kt deleted file mode 100644 index 19fce6f441..0000000000 --- a/buildSrc/src/main/kotlin/AndroidConfig.kt +++ /dev/null @@ -1,6 +0,0 @@ -object AndroidConfig { - const val compileSdk = 31 - const val minSdk = 23 - const val targetSdk = 29 - const val ndk = "22.1.7171670" -}