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

Fix bottom padding for responsive() SLC #1826

Merged
merged 20 commits into from
Nov 22, 2023
Merged

Conversation

yschimke
Copy link
Collaborator

@yschimke yschimke commented Nov 21, 2023

WHAT

Fix bottom padding for SLC.

WHY

Bottom item if larger than a Chip, such as a Card will be obscured.

AutoCenteringParams doesn't allow adjusting the bottom item, and with Anchor = Start will only ensure the start of the final item can get to the center, which is not enough.

HOW

Checklist 📋

  • Add explicit visibility modifier and explicit return types for public declarations
  • Run spotless check
  • Run tests
  • Update metalava's signature text files

@yschimke yschimke requested a review from Kpeved November 21, 2023 10:11
@yschimke yschimke marked this pull request as ready for review November 21, 2023 10:15
@Kpeved

This comment was marked as resolved.

@@ -198,11 +203,12 @@ public object ScalingLazyColumnDefaults {
index = 0,
offsetPx = topScreenOffsetPx,
),
autoCentering = null,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is that fix replaces some issue with AutoCentering behavior?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

AutoCentering API is this

public class AutoCenteringParams(
    // @IntRange(from = 0)
    internal val itemIndex: Int = 1,
    internal val itemOffset: Int = 0,
)

You can ensure that the top is correctly working. However it doesn't ensure that the bottom can be completely scrolled into view.

So better to disable it, and do it manually with enough content padding at the bottom to allow the last item to be unobscured.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Kpeved without this change, the responsive screens hit this issue.

With the change, they can scroll so the last item is mostly not cutoff.

@yschimke yschimke requested a review from ssancho14 November 22, 2023 00:15
@yschimke yschimke marked this pull request as draft November 22, 2023 03:10
@yschimke yschimke changed the title Fix bottom padding for SLC Fix bottom padding for responsive() SLC Nov 22, 2023
yschimke and others added 5 commits November 22, 2023 15:38
# Conflicts:
#	sample/src/test/snapshots/images/com.google.android.horologist.screensizes_MediaPlayerLibraryTest_screenshot[2]_samsunggalaxywatch6large.png
#	sample/src/test/snapshots/images/com.google.android.horologist.screensizes_ScalingLazyColumnDefaultsTest_responsive[2]_samsunggalaxywatch6large.png
@yschimke yschimke marked this pull request as ready for review November 22, 2023 06:23
@yschimke
Copy link
Collaborator Author

cc @garanj

Copy link
Collaborator

@Kpeved Kpeved left a comment

Choose a reason for hiding this comment

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

LGTM

@yschimke yschimke merged commit 1aa843a into google:main Nov 22, 2023
4 checks passed
@yschimke yschimke deleted the fix_slc branch December 18, 2023 09:56
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.

2 participants