Closed hegocre closed 3 years ago
@adeekshith You are welcome!
I also noticed that some devices neee none, some need one and others need both patches to work correctly.
The problem I see here is that existing users will need to set their language again. Maybe changing PreferencesManager.java to remove the r before creating the locale would be lesw intrusive, but would require you to keep adding the r to new locales.
If you prefer it that way I can change this on my pull request before merging.
Cheers!
The problem I see here is that existing users will need to set their language again.
Oh I was thinking we were saving the key (lang_code_ca_rES
) and not the value (ca-ES
). I am wrong then. Thanks for catching.
Maybe changing PreferencesManager.java to remove the r before creating the locale would be lesw intrusive, but would require you to keep adding the r to new locales.
That should do but how about this solution:
PreferencesManager::getSelectedLanguageStr()
method to remove r
before returning (ca-rES
to ca-ES
).r
version to the non-r version in the shared preferences PreferencesManager::init()
method (init() method executed when the PreferencesManager object is created). Advantage with this method is, we can remove the migration code after a few months without affecting anyone.Awesome! Your fix (186f302) looks good @hegocre Will test it in a while and merge 😃
Thank you!!
You're welcome!
Amazing work with this app!
Fix for locale changing issues, possible fix #270, tested on Android Emulator API 21 (previously not working, now it does), as well as API 29 and 30 on physical devices, both working.
When creating locales, region code must be a 2 alpha character string as explained here, I imagine the r added on resource folder is an abbreviation for region and should not be used when creating Locales in code.
Also, a bug on AndroidX compat library causes the locale to be overridden to default on API versions 21 to 25 because of DayNight compatibility, so applyOverrideConfiguration must be called with the new context created.