fix: Unpin button in Sleep Image Picker now actually unpins#24
Open
HenriqueMorato wants to merge 1 commit into
Open
fix: Unpin button in Sleep Image Picker now actually unpins#24HenriqueMorato wants to merge 1 commit into
HenriqueMorato wants to merge 1 commit into
Conversation
- List mode binds Up/Down explicitly via onPressAndContinuous so Left is no longer consumed by ButtonNavigator's "previous" action - Was a button-down vs button-up race: onPrevious (Up+Left, button-down) moved the cursor before wasReleased(Left) read selectorIndex, so Unpin pinned the row above instead of clearing the pin - Slideshow mode untouched — Left = previous image remains correct
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix the Unpin button in the Sleep Image Picker — pressing Left on a pinned image was moving thecursor up and pinning the row above, instead of clearing the pin.
src/activities/tools/SleepImagePickerActivity.cpp— in list mode, bind Up/Down explicitly viaonPressAndContinuous({Up})/({Down})instead ofonNext/onPrevious, so Left/Right are no longer consumed byButtonNavigator's "previous/next" actions.Additional Context
Root cause is a button-down vs button-up race:
buttonNavigator.onPrevious(...)binds the callback to{Up, Left}on button-down (ButtonNavigator::getPreviousButtons()), and on Left it movesselectorIndexup.wasReleased(Left)handler then readsselectorIndexon button-up to decide Pin vs Unpin viaisCurrentImageSelection(selectorIndex).So pressing Left on a pinned row first moved the selector to the row above, then the release handler saw it was no longer on the pinned row and took the else branch — pinning that new row. The original pin was never cleared.
Slideshow mode is untouched (Left = previous image is the right semantic there).
Tested on-device — pin/unpin now works correctly, Up/Down navigation still works, slideshow Left/Right still navigates images.
AI Usage
While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it
helps set the right context for reviewers.
Did you use AI tools to help write this code? YES