Compare commits

...

3 commits

Author SHA1 Message Date
0a78daee8b feat: language preferences (#76)
see https://developer.android.com/guide/topics/resources/app-languages

Reviewed-on: PeterCxy/OpenEUICC#76
Co-authored-by: septs <github@septs.pw>
Co-committed-by: septs <github@septs.pw>
2024-12-01 20:26:14 +01:00
e7f58bbaaf chore: simplify settings intent (#77)
Reviewed-on: PeterCxy/OpenEUICC#77
Co-authored-by: septs <github@septs.pw>
Co-committed-by: septs <github@septs.pw>
2024-12-01 14:57:30 +01:00
562e5922be 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: PeterCxy/OpenEUICC#75
Co-authored-by: septs <github@septs.pw>
Co-committed-by: septs <github@septs.pw>
2024-12-01 14:46:42 +01:00
7 changed files with 63 additions and 20 deletions

View file

@ -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
@ -38,25 +40,28 @@ class SettingsFragment: PreferenceFragmentCompat() {
}.collect()
}
findPreference<Preference>("pref_info_app_version")
?.apply {
summary = requireContext().selfAppVersion
findPreference<Preference>("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<Preference>("pref_info_source_code")
?.setOnPreferenceClickListener {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(it.summary.toString())))
true
}
findPreference<Preference>("pref_info_source_code")?.apply {
intent = Intent(Intent.ACTION_VIEW, Uri.parse(summary.toString()))
}
findPreference<Preference>("pref_advanced_logs")
?.setOnPreferenceClickListener {
startActivity(Intent(requireContext(), LogsActivity::class.java))
true
findPreference<Preference>("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<Preference>("pref_advanced_logs")?.apply {
intent = Intent(requireContext(), LogsActivity::class.java)
}
findPreference<CheckBoxPreference>("pref_notifications_download")
?.bindBooleanFlow(preferenceRepository.notificationDownloadFlow, PreferenceKeys.NOTIFICATION_DOWNLOAD)

View file

@ -146,6 +146,8 @@
<string name="pref_advanced_disable_safeguard_removable_esim_desc">By default, this app prevents you from disabling the active profile on a removable eSIM inserted in the device, because doing so may <i>sometimes</i> render it inaccessible.\nCheck this box to <i>remove</i> this safeguard.</string>
<string name="pref_advanced_verbose_logging">Verbose Logging</string>
<string name="pref_advanced_verbose_logging_desc">Enable verbose logs, which may contain sensitive information. Only share your logs with someone you trust after turning this on.</string>
<string name="pref_language">Language</string>
<string name="pref_language_desc">Select current language</string>
<string name="pref_advanced_logs">Logs</string>
<string name="pref_advanced_logs_desc">View recent debug logs of the application</string>
<string name="pref_developer">Developer Options</string>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
<locale android:name="en-US" />
<locale android:name="ja" />
</locale-config>

View file

@ -36,6 +36,13 @@
app:title="@string/pref_advanced_verbose_logging"
app:summary="@string/pref_advanced_verbose_logging_desc" />
<Preference
app:iconSpaceReserved="false"
app:isPreferenceVisible="false"
app:key="pref_language"
app:summary="@string/pref_language_desc"
app:title="@string/pref_language" />
<Preference
app:key="pref_advanced_logs"
app:iconSpaceReserved="false"

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
android:name="im.angry.openeuicc.UnprivilegedOpenEuiccApplication"
@ -8,7 +9,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">
<activity
android:name="im.angry.openeuicc.ui.UnprivilegedMainActivity"
@ -25,6 +28,14 @@
android:exported="false"
android:label="@string/compatibility_check" />
<service
android:name="androidx.appcompat.app.AppLocalesMetadataHolderService"
android:enabled="false"
android:exported="false">
<meta-data
android:name="autoStoreLocales"
android:value="true" />
</service>
</application>
<queries>

View file

@ -5,7 +5,8 @@
package="im.angry.openeuicc">
<uses-feature
android:name="android.hardware.telephony"
android:required="true" />
android:required="true"
tools:ignore="UnnecessaryRequiredFeature" />
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
@ -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">
<activity
android:name=".ui.PrivilegedMainActivity"
android:exported="true">
@ -49,6 +52,15 @@
<category android:name="android.service.euicc.category.EUICC_UI" />
</intent-filter>
</activity>
<service
android:name="androidx.appcompat.app.AppLocalesMetadataHolderService"
android:enabled="false"
android:exported="false">
<meta-data
android:name="autoStoreLocales"
android:value="true" />
</service>
</application>
</manifest>

View file

@ -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
android.nonFinalResIds=false
android.suppressUnsupportedCompileSdk=35