Language refresh on A13+ - #24
Conversation
…ttachBaseContext to apply locale to context
There was a problem hiding this comment.
🟡 Changes recommended
The new relaunch logic can crash when the launch intent is null and the current implementation uses abrupt process exit / synchronous disk I/O on the UI thread.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR addresses Issue #18 (“Visual glitch for language on A13+”) by changing how the app applies and refreshes the selected locale, aiming to ensure the language change takes effect reliably on Android 13+.
Changes:
- Persist locale changes synchronously and trigger an app relaunch flow after selecting a language.
- Apply the chosen locale earlier in the activity lifecycle via
attachBaseContext. - Add an additional supported locale entry (
iw).
File summaries
| File | Description |
|---|---|
| app/src/main/java/io/github/vvb2060/keyattestation/util/LocaleManager.kt | Adjusts locale persistence and changes the post-selection behavior to relaunch the app. |
| app/src/main/java/io/github/vvb2060/keyattestation/app/AppActivity.kt | Applies the selected locale in attachBaseContext to ensure correct resources/config on startup. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| val config = Configuration(newBase.resources.configuration) | ||
| config.setLocale(locale) | ||
| super.attachBaseContext(newBase.createConfigurationContext(config)) |
| context.getSharedPreferences("locale_prefs", Context.MODE_PRIVATE) | ||
| .edit().putString("app_locale", code).apply() | ||
| .edit().putString("app_locale", code).commit() |
| val pm = context.packageManager | ||
| val intent = pm.getLaunchIntentForPackage(context.packageName) | ||
| intent?.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK) | ||
| context.startActivity(intent) | ||
| Runtime.getRuntime().exit(0) |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
all the rest copilot reccomended just does no major difference, so ignore, id say safe to merge |
|
At first i see have this changes trigger when detected Android 13+ but after change, what happens? |
So what it does is it closes the app and reopens it for you |
|
I had made my own apk, let me send it or if you want you can build and ill screen record it working |
Screenrecorder-2026-09-11-12-58-08-483_0_COMPRESSED.mp4 |
So it works? I didnt get the video sorry |
Yeah as i see. Change language, blind/black screen for 1 second and is done. That's I'm asking is can this change trigger when detected Android 13+ Or must be generally? |
I had tried in the first commit to make it api related but that didnt work, hence why i made it general, for now, ill make another pr in the future once my brain is back to earth |
Understand. Take your time! I can take a look, but you know better than me. |
2342fb4 to
8e2050d
Compare
Co-authored-by: VisionR1 <25982450+VisionR1@users.noreply.github.com>
725343c to
c2a1991
Compare
|
Ready to be merged |
fixes issue #18