From 562e5922bea75dcf7e22454404032f9192d8ea1c Mon Sep 17 00:00:00 2001 From: septs Date: Sun, 1 Dec 2024 14:46:42 +0100 Subject: [PATCH 1/3] chore: suppress gradle warning (#75) We recommend using a newer Android Gradle plugin to use `compileSdk = 35` This Android Gradle plugin (8.1.2) was tested up to `compileSdk = 34`. You are strongly encouraged to update your project to use a newer Android Gradle plugin that has been tested with `compileSdk = 35`. If you are already using the latest version of the Android Gradle plugin, you may need to wait until a newer version with support for `compileSdk = 35` is available. To suppress this warning, add/update ``` android.suppressUnsupportedCompileSdk=35 ``` to this project's gradle.properties. Reviewed-on: https://gitea.angry.im/PeterCxy/OpenEUICC/pulls/75 Co-authored-by: septs Co-committed-by: septs --- gradle.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 022338b..239cc44 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,4 +22,5 @@ kotlin.code.style=official # thereby reducing the size of the R class for that library android.nonTransitiveRClass=true android.defaults.buildfeatures.buildconfig=true -android.nonFinalResIds=false \ No newline at end of file +android.nonFinalResIds=false +android.suppressUnsupportedCompileSdk=35 From e7f58bbaaf41b02187501f537b8be322a87265ce Mon Sep 17 00:00:00 2001 From: septs Date: Sun, 1 Dec 2024 14:57:30 +0100 Subject: [PATCH 2/3] chore: simplify settings intent (#77) Reviewed-on: https://gitea.angry.im/PeterCxy/OpenEUICC/pulls/77 Co-authored-by: septs Co-committed-by: septs --- .../im/angry/openeuicc/ui/SettingsFragment.kt | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 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 9c071bd..d2ae9d6 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 @@ -38,25 +38,20 @@ class SettingsFragment: PreferenceFragmentCompat() { }.collect() } - findPreference("pref_info_app_version") - ?.apply { - summary = requireContext().selfAppVersion + findPreference("pref_info_app_version")?.apply { + summary = requireContext().selfAppVersion - // Enable developer options when this is clicked for 7 times - setOnPreferenceClickListener(this@SettingsFragment::onAppVersionClicked) - } + // Enable developer options when this is clicked for 7 times + setOnPreferenceClickListener(::onAppVersionClicked) + } - findPreference("pref_info_source_code") - ?.setOnPreferenceClickListener { - startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(it.summary.toString()))) - true - } + findPreference("pref_info_source_code")?.apply { + intent = Intent(Intent.ACTION_VIEW, Uri.parse(summary.toString())) + } - findPreference("pref_advanced_logs") - ?.setOnPreferenceClickListener { - startActivity(Intent(requireContext(), LogsActivity::class.java)) - true - } + findPreference("pref_advanced_logs")?.apply { + intent = Intent(requireContext(), LogsActivity::class.java) + } findPreference("pref_notifications_download") ?.bindBooleanFlow(preferenceRepository.notificationDownloadFlow, PreferenceKeys.NOTIFICATION_DOWNLOAD) From 0a78daee8bc9bf217c746a58d38c178110aa0ae0 Mon Sep 17 00:00:00 2001 From: septs Date: Sun, 1 Dec 2024 20:26:14 +0100 Subject: [PATCH 3/3] feat: language preferences (#76) see https://developer.android.com/guide/topics/resources/app-languages Reviewed-on: https://gitea.angry.im/PeterCxy/OpenEUICC/pulls/76 Co-authored-by: septs Co-committed-by: septs --- .../im/angry/openeuicc/ui/SettingsFragment.kt | 10 ++++++++++ app-common/src/main/res/values/strings.xml | 2 ++ app-common/src/main/res/xml/locale_config.xml | 5 +++++ app-common/src/main/res/xml/pref_settings.xml | 7 +++++++ app-unpriv/src/main/AndroidManifest.xml | 15 +++++++++++++-- app/src/main/AndroidManifest.xml | 16 ++++++++++++++-- 6 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 app-common/src/main/res/xml/locale_config.xml 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 d2ae9d6..f10f134 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 @@ -49,6 +51,14 @@ class SettingsFragment: PreferenceFragmentCompat() { intent = Intent(Intent.ACTION_VIEW, Uri.parse(summary.toString())) } + 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) + } + } + findPreference("pref_advanced_logs")?.apply { intent = 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..174b18c 100644 --- a/app-common/src/main/res/values/strings.xml +++ b/app-common/src/main/res/values/strings.xml @@ -146,6 +146,8 @@ 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. + Language + Select current language Logs View recent debug logs of the application Developer Options 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-common/src/main/res/xml/pref_settings.xml b/app-common/src/main/res/xml/pref_settings.xml index 60646bc..107e0b4 100644 --- a/app-common/src/main/res/xml/pref_settings.xml +++ b/app-common/src/main/res/xml/pref_settings.xml @@ -36,6 +36,13 @@ app:title="@string/pref_advanced_verbose_logging" app:summary="@string/pref_advanced_verbose_logging_desc" /> + + - + + android:localeConfig="@xml/locale_config" + android:theme="@style/Theme.OpenEUICC" + tools:targetApi="tiramisu"> + + + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cd30620..cae19d3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -5,7 +5,8 @@ package="im.angry.openeuicc"> + 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"> @@ -49,6 +52,15 @@ + + + +