Improve and cleanup PlayerHelper formatters/localization#12470
Improve and cleanup PlayerHelper formatters/localization#12470Stypox merged 5 commits intoTeamNewPipe:release-0.28.0from
Conversation
and reset them when the language is changed/changing. This way they will be re-initialized on the next call. Also Remove a bunch of outdated/non-thread safe code (STRING_FORMATTER)
141016a to
893a1cb
Compare
|
Actually, wait, it does not work while the player is open, because |
formatters() is called again by the player before the user has a chance to click on the language in the language chooser. So the correct solution would probably be to attach to https://developer.android.com/reference/android/content/Intent#ACTION_LOCALE_CHANGED, but let's keep it simple. I added `PlayerHelper.resetFormat();` in `ContentSettingsFragment.onDestroy()` and it works. It will mean the player formatters will be reset every time the user exits content settings, but whatever.
|
So the correct solution would probably be to attach to https://developer.android.com/reference/android/content/Intent#ACTION_LOCALE_CHANGED, buuuuuuuuut let's keep it simple. I added |
|
What happens if the user changes the system language or the per-app pref while the player is open? That is not covered by the hack. |
|
The old formatting remains in that case, until the app is closed and reopened, but I'd say it's an edge case and it's not worth implementing a more complex solution at the cost of introducing bugs related to broadcast receivers |
What is it?
Description of the changes in your PR
Followup of #12446
Here's an example
Np12470Showcase1.webm
Fixes the following issue(s)
APK testing
The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.
Due diligence