Migrate image picker to new Photo Picker (Android 13 compatibility)#499
Migrate image picker to new Photo Picker (Android 13 compatibility)#499z3ntu wants to merge 6 commits intoligi:masterfrom
Conversation
With Android 13 the previous photo picker didn't trigger at all anymore. But we can use the new Photo Picker UI as described in [0] to get a new and better photo picker. Some refactoring is necessary to suport that. [0] https://android-developers.googleblog.com/2023/04/photo-picker-everywhere.html
|
Any updates on this? Being unable to select files from storage kinda breaks the whole app for Android 13 users. |
|
Thanks & sorry for the late review. |
|
It does increase minsdk? At least in git diff there's no change in manifest or is this through some other reason? |
|
I have been using the app compiled from this branch and it seems to work just fine |
|
@z3ntu : https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts.PickVisualMedia @je-sendra what API level? |
|
Right, minSdk is currently 14, and PickVisualMedia is 19+. But not sure anyone really is still using an Android version lower than 4.4 KitKat, but I get what you mean. |
|
Currently sdk level 19 support is at 99.8% of the devices, and Google Play services dropped support for API levels below 21 in August 2023 according to https://apilevels.com/. |
ligi
left a comment
There was a problem hiding this comment.
Sorry for the huge latency in processing it.
I gave it more testing and looks good to me - would really love to have this as part of the next release.
The only problem currently is that the tests are not passing anymore as the intents are different - if this problem is solved this will be merged.
|
I looked around a bit but I don't see an obvious way to test the new onclick behavior. Also not super familiar with the photo picker, even less since it's been more than a year since I made this PR 😅 Would it be okay to drop these 3 tests? |
|
@ligi ping |
With Android 13 the previous photo picker didn't trigger at all anymore. But we can use the new Photo Picker UI as described in [0] to get a new and better photo picker. Some refactoring is necessary to suport that.
[0] https://android-developers.googleblog.com/2023/04/photo-picker-everywhere.html
Fixes #477
NOTE: I haven't tested this extensively, just a bit on an Android 13 virtual device in Android Studio but everything seems to work there. Before merging (or basing something on this) please test this also on older devices, I don't know how much is available there of this photo picker. Maybe it needs some runtime if.
It's also been a while since I properly did some development for Android so some code could be a bit weird.