Skip to content

Correctly support Arrangement.spacedBy in ScrollbarAdapters for lazy lists/grids#380

Merged
Alexander Maryanovsky (m-sasha) merged 1 commit into
jb-mainfrom
bugfix/scrollbar-with-arrangement-spacedby
Feb 2, 2023
Merged

Correctly support Arrangement.spacedBy in ScrollbarAdapters for lazy lists/grids#380
Alexander Maryanovsky (m-sasha) merged 1 commit into
jb-mainfrom
bugfix/scrollbar-with-arrangement-spacedby

Conversation

@m-sasha

Copy link
Copy Markdown

Proposed Changes

  • Add mainAxisItemSpacing property to LazyListLayoutInfo, LazyGridLayoutInfo and LazyStaggeredGridLayoutInfo, per discussion with Andrey Kulikov from Google.
  • Use the new mainAxisItemSpacing property to fix the line size approximation in LazyListScrollbarAdapter and LazyGridScrollbarAdapter

Testing

Test: manually and with a new unit test

Issues Fixed

Fixes: JetBrains/compose-multiplatform#2644

override val viewportEndOffset: Int = 0
override val beforeContentPadding: Int = 0
override val afterContentPadding: Int = 0
override val mainAxisItemSpacing: Int = 0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to wait for https://android-review.googlesource.com/c/platform/frameworks/support/+/2397134 to merge, and then cherry-pick it straight into jb-main

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. The cherry-pick is part of this PR, so you can review it too.
Once approved, I will merge --ff-only this branch into jb-main, to avoid squashing the two commits.

@igordmn Igor Demin (igordmn) Jan 28, 2023

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's push the cherry-pick straight into jb-main.

The alternative process is as you described. It is better because we review everything that adds to the main branch, but worse because:

  1. we have to enable merging of PR's. If we do that, someone can use it, and don't bother about commits in the PR. It will spoil the git history.
  2. the review of a cherry-pick and a fix together is harder than just fixes.
  3. the 2. can be fixed by squashing the fix into a single commit, but it requires force-push, that is also not good for review.

@igordmn Igor Demin (igordmn) Jan 28, 2023

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the other hand, we also lose ability to run CI (we'll configure it in the future) on the cherry-pick.

And one more issue. When it will be merged, the code is become common. And when users tried to use it, they encounter noSuchMethod on Android. I don't know good way to solve it. We have 2 options:

  1. wait for the Jetpack release, and point to it in our sources. But if it will be 1.5, we can't merge it right now
  2. make public API internal, fix conflicts later (we should add comments near internal to describe how to solve conflicts)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll adjust the cherry-picked commit to make the new properties internal for now.

Base automatically changed from feature/scrollbar-adapter-for-lazygrid to jb-main January 24, 2023 15:15
@m-sasha Alexander Maryanovsky (m-sasha) force-pushed the bugfix/scrollbar-with-arrangement-spacedby branch 3 times, most recently from 36db25f to f7efc4e Compare January 28, 2023 19:31
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.

Scrollbar works incorrectly with lazy list that uses Arrangement.spacedBy

2 participants