From 37a3e2301868b127bc2464ccd0dca3d5d383122a Mon Sep 17 00:00:00 2001 From: septs Date: Sun, 1 Dec 2024 10:52:45 +0800 Subject: [PATCH 01/10] feat: per-app language preferences --- app-unpriv/build.gradle.kts | 5 +++++ app-unpriv/src/main/res/resources.properties | 1 + app/build.gradle.kts | 5 +++++ app/src/main/res/resources.properties | 1 + 4 files changed, 12 insertions(+) create mode 100644 app-unpriv/src/main/res/resources.properties create mode 100644 app/src/main/res/resources.properties diff --git a/app-unpriv/build.gradle.kts b/app-unpriv/build.gradle.kts index 66a60b4..7d1e234 100644 --- a/app-unpriv/build.gradle.kts +++ b/app-unpriv/build.gradle.kts @@ -32,6 +32,11 @@ android { proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") } } + + androidResources { + generateLocaleConfig = true + } + compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 diff --git a/app-unpriv/src/main/res/resources.properties b/app-unpriv/src/main/res/resources.properties new file mode 100644 index 0000000..467b3ef --- /dev/null +++ b/app-unpriv/src/main/res/resources.properties @@ -0,0 +1 @@ +unqualifiedResLocale=en-US diff --git a/app/build.gradle.kts b/app/build.gradle.kts index b9c2100..89a0062 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -28,6 +28,11 @@ android { proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") } } + + androidResources { + generateLocaleConfig = true + } + compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 diff --git a/app/src/main/res/resources.properties b/app/src/main/res/resources.properties new file mode 100644 index 0000000..467b3ef --- /dev/null +++ b/app/src/main/res/resources.properties @@ -0,0 +1 @@ +unqualifiedResLocale=en-US -- 2.45.3 From f767d60775ff2ee5640c19d72212f0878917081d Mon Sep 17 00:00:00 2001 From: septs Date: Sun, 1 Dec 2024 11:03:43 +0800 Subject: [PATCH 02/10] feat: add android 12- supports --- app-unpriv/src/main/AndroidManifest.xml | 8 ++++++++ app/src/main/AndroidManifest.xml | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/app-unpriv/src/main/AndroidManifest.xml b/app-unpriv/src/main/AndroidManifest.xml index 8760fb9..2ef6d94 100644 --- a/app-unpriv/src/main/AndroidManifest.xml +++ b/app-unpriv/src/main/AndroidManifest.xml @@ -25,6 +25,14 @@ android:exported="false" android:label="@string/compatibility_check" /> + + + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cd30620..651acb8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -49,6 +49,15 @@ + + + + -- 2.45.3 From af40d757b0f7c96909a2c257e0e266597aa38eac Mon Sep 17 00:00:00 2001 From: septs Date: Sun, 1 Dec 2024 11:20:31 +0800 Subject: [PATCH 03/10] feat: add locale settings --- .../java/im/angry/openeuicc/ui/SettingsFragment.kt | 14 ++++++++++++++ app-common/src/main/res/values/strings.xml | 2 ++ app-common/src/main/res/xml/pref_settings.xml | 8 +++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt b/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt index 9c071bd..1e6ed39 100644 --- a/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt +++ b/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt @@ -2,7 +2,9 @@ package im.angry.openeuicc.ui import android.content.Intent import android.net.Uri +import android.os.Build import android.os.Bundle +import android.provider.Settings import android.widget.Toast import androidx.datastore.preferences.core.Preferences import androidx.lifecycle.lifecycleScope @@ -52,6 +54,18 @@ class SettingsFragment: PreferenceFragmentCompat() { true } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + findPreference("pref_language")?.apply { + isVisible = true + setOnPreferenceClickListener { + startActivity(Intent(Settings.ACTION_APP_LOCALE_SETTINGS).apply { + data = Uri.fromParts("package", requireContext().packageName, null) + }) + true + } + } + } + findPreference("pref_advanced_logs") ?.setOnPreferenceClickListener { startActivity(Intent(requireContext(), LogsActivity::class.java)) diff --git a/app-common/src/main/res/values/strings.xml b/app-common/src/main/res/values/strings.xml index 73b1938..5720363 100644 --- a/app-common/src/main/res/values/strings.xml +++ b/app-common/src/main/res/values/strings.xml @@ -148,6 +148,8 @@ Enable verbose logs, which may contain sensitive information. Only share your logs with someone you trust after turning this on. Logs View recent debug logs of the application + Language + Select current lanaguage Developer Options Experimental Download Wizard Enable the experimental new download wizard. Note that it is not fully working yet. diff --git a/app-common/src/main/res/xml/pref_settings.xml b/app-common/src/main/res/xml/pref_settings.xml index 60646bc..f793ccd 100644 --- a/app-common/src/main/res/xml/pref_settings.xml +++ b/app-common/src/main/res/xml/pref_settings.xml @@ -36,12 +36,18 @@ app:title="@string/pref_advanced_verbose_logging" app:summary="@string/pref_advanced_verbose_logging_desc" /> + + - Date: Sun, 1 Dec 2024 11:23:47 +0800 Subject: [PATCH 04/10] chore: reduce diffed --- app-common/src/main/res/xml/pref_settings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app-common/src/main/res/xml/pref_settings.xml b/app-common/src/main/res/xml/pref_settings.xml index f793ccd..107e0b4 100644 --- a/app-common/src/main/res/xml/pref_settings.xml +++ b/app-common/src/main/res/xml/pref_settings.xml @@ -48,6 +48,7 @@ app:iconSpaceReserved="false" app:title="@string/pref_advanced_logs" app:summary="@string/pref_advanced_logs_desc" /> + Date: Sun, 1 Dec 2024 11:44:42 +0800 Subject: [PATCH 05/10] fix: typo --- app-common/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-common/src/main/res/values/strings.xml b/app-common/src/main/res/values/strings.xml index 5720363..09e0699 100644 --- a/app-common/src/main/res/values/strings.xml +++ b/app-common/src/main/res/values/strings.xml @@ -149,7 +149,7 @@ Logs View recent debug logs of the application Language - Select current lanaguage + Select current language Developer Options Experimental Download Wizard Enable the experimental new download wizard. Note that it is not fully working yet. -- 2.45.3 From 5480a2d4dd65e9a804312e31159295f5d36b482c Mon Sep 17 00:00:00 2001 From: septs Date: Sun, 1 Dec 2024 12:06:27 +0800 Subject: [PATCH 06/10] chore: simplify intent --- .../main/java/im/angry/openeuicc/ui/SettingsFragment.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt b/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt index 1e6ed39..7946f21 100644 --- a/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt +++ b/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt @@ -57,11 +57,8 @@ class SettingsFragment: PreferenceFragmentCompat() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { findPreference("pref_language")?.apply { isVisible = true - setOnPreferenceClickListener { - startActivity(Intent(Settings.ACTION_APP_LOCALE_SETTINGS).apply { - data = Uri.fromParts("package", requireContext().packageName, null) - }) - true + intent = Intent(Settings.ACTION_APP_LOCALE_SETTINGS).apply { + data = Uri.fromParts("package", requireContext().packageName, null) } } } -- 2.45.3 From 3e766f28aff9034ae2533e6287f77f217b08cee9 Mon Sep 17 00:00:00 2001 From: septs Date: Sun, 1 Dec 2024 13:04:01 +0800 Subject: [PATCH 07/10] fix: re-sort strings --- app-common/src/main/res/values/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app-common/src/main/res/values/strings.xml b/app-common/src/main/res/values/strings.xml index 09e0699..174b18c 100644 --- a/app-common/src/main/res/values/strings.xml +++ b/app-common/src/main/res/values/strings.xml @@ -146,10 +146,10 @@ By default, this app prevents you from disabling the active profile on a removable eSIM inserted in the device, because doing so may sometimes render it inaccessible.\nCheck this box to remove this safeguard. Verbose Logging Enable verbose logs, which may contain sensitive information. Only share your logs with someone you trust after turning this on. - Logs - View recent debug logs of the application Language Select current language + Logs + View recent debug logs of the application Developer Options Experimental Download Wizard Enable the experimental new download wizard. Note that it is not fully working yet. -- 2.45.3 From d41aca1027fb2c20aa9202200f89212101ab8d41 Mon Sep 17 00:00:00 2001 From: septs Date: Sun, 1 Dec 2024 14:06:36 +0800 Subject: [PATCH 08/10] chore: simplify intent --- .../java/im/angry/openeuicc/ui/SettingsFragment.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt b/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt index 7946f21..ea1ece3 100644 --- a/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt +++ b/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt @@ -54,12 +54,11 @@ class SettingsFragment: PreferenceFragmentCompat() { true } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - findPreference("pref_language")?.apply { - isVisible = true - intent = Intent(Settings.ACTION_APP_LOCALE_SETTINGS).apply { - data = Uri.fromParts("package", requireContext().packageName, null) - } + findPreference("pref_language")?.apply { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) return@apply + isVisible = true + intent = Intent(Settings.ACTION_APP_LOCALE_SETTINGS).apply { + data = Uri.fromParts("package", requireContext().packageName, null) } } -- 2.45.3 From 408a97f4c857065ebb025816c49d055e9d3598ea Mon Sep 17 00:00:00 2001 From: septs Date: Sun, 1 Dec 2024 21:49:14 +0800 Subject: [PATCH 09/10] chore: remove generateLocaleConfig --- app-common/src/main/res/xml/locale_config.xml | 5 +++++ app-unpriv/build.gradle.kts | 5 ----- app-unpriv/src/main/AndroidManifest.xml | 7 +++++-- app/build.gradle.kts | 5 ----- app/src/main/AndroidManifest.xml | 7 +++++-- 5 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 app-common/src/main/res/xml/locale_config.xml diff --git a/app-common/src/main/res/xml/locale_config.xml b/app-common/src/main/res/xml/locale_config.xml new file mode 100644 index 0000000..dd9d189 --- /dev/null +++ b/app-common/src/main/res/xml/locale_config.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app-unpriv/build.gradle.kts b/app-unpriv/build.gradle.kts index 7d1e234..66a60b4 100644 --- a/app-unpriv/build.gradle.kts +++ b/app-unpriv/build.gradle.kts @@ -32,11 +32,6 @@ android { proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") } } - - androidResources { - generateLocaleConfig = true - } - compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 diff --git a/app-unpriv/src/main/AndroidManifest.xml b/app-unpriv/src/main/AndroidManifest.xml index 2ef6d94..ce985cd 100644 --- a/app-unpriv/src/main/AndroidManifest.xml +++ b/app-unpriv/src/main/AndroidManifest.xml @@ -1,5 +1,6 @@ - + + android:localeConfig="@xml/locale_config" + android:theme="@style/Theme.OpenEUICC" + tools:targetApi="tiramisu"> + android:required="true" + tools:ignore="UnnecessaryRequiredFeature" /> @@ -19,7 +20,9 @@ android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" - android:theme="@style/Theme.OpenEUICC"> + android:localeConfig="@xml/locale_config" + android:theme="@style/Theme.OpenEUICC" + tools:targetApi="tiramisu"> -- 2.45.3 From 011e7314b6221b6bae7cbdce4a50ca610f217c65 Mon Sep 17 00:00:00 2001 From: septs Date: Sun, 1 Dec 2024 21:52:05 +0800 Subject: [PATCH 10/10] chore: remove generateLocaleConfig --- app-unpriv/src/main/res/resources.properties | 1 - app/src/main/res/resources.properties | 1 - 2 files changed, 2 deletions(-) delete mode 100644 app-unpriv/src/main/res/resources.properties delete mode 100644 app/src/main/res/resources.properties diff --git a/app-unpriv/src/main/res/resources.properties b/app-unpriv/src/main/res/resources.properties deleted file mode 100644 index 467b3ef..0000000 --- a/app-unpriv/src/main/res/resources.properties +++ /dev/null @@ -1 +0,0 @@ -unqualifiedResLocale=en-US diff --git a/app/src/main/res/resources.properties b/app/src/main/res/resources.properties deleted file mode 100644 index 467b3ef..0000000 --- a/app/src/main/res/resources.properties +++ /dev/null @@ -1 +0,0 @@ -unqualifiedResLocale=en-US -- 2.45.3