-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix #6409: Add listener call in ImageAdapter to update UI and upload #6420
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
Fix #6409: Add listener call in ImageAdapter to update UI and upload #6420
Conversation
…and upload button on deselection
@nicolas-raoul If you are free, Can you review my PR : ) |
Thanks! :-) And sorry for the delay. Any idea what is the problem here?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested, it is working great when Show already actioned pictures
is enabled. :-)
Would you mind checking the unit test failure?
} else { | ||
selectOrRemoveImage(holder, position) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this code useful when Show already actioned pictures
(at the top of the activity) is disabled? Parts of this mode have been broken for a few months though, so it is not easy to test. By the way if you find a way to fix that it would be wonderful! ^_^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You’are right that the new code in onThumbnailClicked
is intended to handle the case when "Show already actioned pictures" is disabled, ensuring clicks are only processed for actionable images in actionableImagesMap
. I’ve noticed that this mode has issues (e.g., images not loading or clicks not registering properly). I’ll debug the processThumbnailForActionedImage
and imageLoader.nextActionableImage
logic to identify why actionable images aren’t populating correctly. I’ll add a fix to ensure the disabled switch mode works as expected, allowing users to select only actionable images, and include tests for this scenario.
I’ll update the PR with these fixes and provide details in the comments. Please let me know if there are specific test cases or behaviors for the disabled switch mode you’d like me to prioritize! ^_^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic!
I am a big user of that switch (or at least I was until it got broken in disabled mode), so I will be sure to send feedback quickly for your fixes. :-)
My upload workflow for context: I mark all family/work/blurry/uninteresting pictures as "Not for upload", then upload the rest. With "Show already actioned pictures" disabled, I have a clear view of what I need to upload or mark. It is a great time saver.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"I’ll add a fix to ensure the disabled switch mode works as expected"
Did you get a chance to try this, by any chance? :-) The latest commit still has the issue that if I tap a picture 2 times, it is counted as 2 uploads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"I’ll add a fix to ensure the disabled switch mode works as expected"
Did you get a chance to try this, by any chance? :-) The latest commit still has the issue that if I tap a picture 2 times, it is counted as 2 uploads.
Hey @nicolas-raoul , thank you for flagging the issue again! I’ve addressed the double-tap problem in the latest commit by adding a check in selectOrRemoveImage to prevent duplicate image selections when showAlreadyActionedImages is false. I have tested it and it works for me ,Could you please test it and let me know if it resolves the issue? Thanks!
Hi @nicolas-raoul, Thank you for testing and for the feedback! I'm glad the fix works well when "Show already actioned pictures" is enabled. 😊 Regarding the Unit Test Failure: |
@nicolas-raoul Updated the PR : ) Changes Made
Testing
Fixes #6409 |
uploadingContributionList | ||
) | ||
_isLoadingImages.value = false | ||
// If the position is already visited, that means the image is already present |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR removes a lot of comments here and below, is that intended?
By the way it seems to be working, I will test more tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apologize for the confusion regarding the removed comments in the PR. The removal was unintentional and likely occurred during code cleanup to focus on the core fix for issue #6409. I’ve added the comments back to maintain clarity and documentation as per the original code. The changes still address the deselection issue by ensuring the UI updates correctly via the listener. Please let me know if there’s anything else I should adjust!
…hen showAlreadyActionedImages is off (commons-app#6409)
Changes Made
Testeng
|
✅ Generated APK variants! |
This commit worked great in my tests today! :-) |
Okay 👍 |
Changes made:
imageSelectListener.onSelectedImagesChanged
in the deselection branch ofonThumbnailClicked
inImageAdapter.kt
. This ensures the UI updates correctly when an image is deselected, including:Verification:
VIDEO
COMMONS.TEST.mp4
Fixes #6409