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

Modify the offset calculation for adding item after the last item. #648

Open
wants to merge 1 commit into
base: androidx-main
Choose a base branch
from

Conversation

goweii
Copy link

@goweii goweii commented Jan 17, 2024

When the focus is on the last item and an item is added before the focus item. If the previous item of the same row cannot be found, the offset of the adjacent previous item should be used directly. If found, the offset of the item should be added with the size of the item and space as the current offset.

Test: run locally, no crash

Proposed Changes

  • Modify the offset calculation for adding item after the last item.

Testing

Test: Verified through local demo, no crashes. And fixed the issues mentioned below.

Issues Fixed

Fixes: Fixed the issues mentioned below.

When the number of items is less than one line, when the focus is on the last item, if an item is added before the focus, the focus item will be incorrectly placed in the second line, and in reality, there is still space in the first line above it.

When the focus is on the last item and an item is added before the focus item. If the previous item of the same row cannot be found, the offset of the adjacent previous item should be used directly. If found, the offset of the item should be added with the size of the item and space as the current offset.

Test: run locally, no crash
Copy link

google-cla bot commented Jan 17, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@goweii
Copy link
Author

goweii commented Mar 14, 2024

Please review this PR, I look forward to feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant