Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #5840 Custom select folder display breaks after exiting media preview #5866

Merged
merged 5 commits into from
Oct 20, 2024

Conversation

LachlanMajor
Copy link
Contributor

When in custom select, if the user long presses an image for a media preview, then exits, the folder display is not the same as it was before the preview. Only the first image is shown and all previously selected images are no longer selected.

Fixes #5840

What changes did you make and why?

ImageFragment.kt:

  • notifyDataSetChanged call added after initialisation in handleResult. Now after changes are made, the observers are notified of this change so images are displayed correctly. This fixes the main bug in the issue.
  • All code in the passSelectedImages function was removed because they were unnecessary. It would initialise the data set and set the selected images however both of these were called again nearly immediately after, in handleResult, with no changes so passSelectedImages wasn't needed. Function was kept since it was needed for the class, it is just never used.
  • setSelectedImages was added to handleResult so previously selected images would be set back to selected after exiting the media preview.

CustomSelectorActivity.kt:

  • passSelectedImages call removed in onActivityResult since it is not needed.
  • shouldRefresh removed in onActivityResult since that was only for passSelectedImages
  • View model's selectedImages value set so selectedImages can be retrieved in handleResult

Tests performed (required)

Tested {build variant} on {Samsung s10 SM-G973F} with API level {31}.

Screenshots (for UI changes only)

Movie001.mp4

Note: Please ensure that you have read CONTRIBUTING.md if this is your first pull request.

@misaochan
Copy link
Member

Thanks @LachlanMajor !

@misaochan misaochan merged commit 56d0beb into commons-app:main Oct 20, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom picker shows only first image after entering then leaving fullscreen
2 participants