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

Add padding to SwipeRefresh for PostListings (for #400) #408

Merged
merged 2 commits into from
Jun 4, 2023

Conversation

russjr08
Copy link
Contributor

@russjr08 russjr08 commented Jun 4, 2023

This pull request attempts to partially resolve the issue listed in #400 - I mention partially because from what I can tell, this occurs in two places:

  • Any place where there is a list of posts (the PostListings component)
  • The list of comments on a post (the PostActivity composable)

I was able to fix the first occurrence by just simply passing in the padding from the parent PostListings component (assuming I'm using the correct phrasing here), but for the second occurrence that trick doesn't quite work as I can't really find a place to extract the padding from.

While it would be possible to hardcode a padding value, that seems quite... hacky - and additionally, when I took a look at the screen from the Layout Inspector on two different devices (my Pixel 6a, and a Pixel 3a XL emulator) the top header was two different sizes. I presume this is because of "safe areas" due to some devices (like my 6a) having the camera notch/cut-out whereas some devices don't (such as the 3a XL).

I'm not sure what the elegant way of fixing the second occurrence would be since I still have a long way to go with learning Compose, but I figured I could at least toss my hat in for fixing the first occurrence if that's alright 👍🏼

Passes in the padding from the PostListings component to the
SwipeRefresh component, which prevents the indicator from being hidden
behind the header bar.
@russjr08 russjr08 requested a review from dessalines as a code owner June 4, 2023 19:00
@@ -57,7 +57,8 @@ fun PostListings(
) {
SwipeRefresh(
state = rememberSwipeRefreshState(loading),
onRefresh = onSwipeRefresh
onRefresh = onSwipeRefresh,
indicatorPadding = padding
) {
Copy link
Member

Choose a reason for hiding this comment

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

We've got to get rid of these at some point anyway, because swiperefresh is deprecated.

@dessalines dessalines merged commit 944f0e7 into LemmyNet:main Jun 4, 2023
@russjr08 russjr08 deleted the refresh-indicator-padding branch June 4, 2023 20:51
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