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

Make a session time scrolling sticky #666

Merged
merged 6 commits into from
Oct 2, 2022

Conversation

ryu38
Copy link
Contributor

@ryu38 ryu38 commented Sep 22, 2022

Issue

Overview (Required)

  • Update a scrolling behavior in session list to stick a session time at the top of the list until replaced by a different one.

Links

  • Nothing

Screenshot

Before

session_time_scroll.webm

After

sticky_scroll.webm

}
}
var currentDurationTime: DurationTime? = null
visibleItemsInfo.value.forEachIndexed { visibleItemIndex, visibleItemInfo ->
Copy link
Member

@takahirom takahirom Sep 22, 2022

Choose a reason for hiding this comment

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

Thanks for your great effort!
Probably this cause performance problem.
I think it is tough. But I came up with two approaches to solve this problem.

  1. Use draw behind
    In this way, you can skip the composition and layout phase
        LazyColumn(
            modifier = Modifier.fillMaxSize().drawBehind {
                     ...
            }
  1. Pass sessionsListListState and consume it in the function

This way, you can't skip the recompose, but you can narrow the recompose.

fun TimeLane(sessionsListListState, timetable) {
        val visibleItemsInfo = remember {
            derivedStateOf {
                sessionsListListState.layoutInfo.visibleItemsInfo
            }
        }
}

Copy link
Contributor Author

@ryu38 ryu38 Sep 29, 2022

Choose a reason for hiding this comment

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

I'm sorry for my late response.
Your advice helped me for fixing the code, thank you!
I adopted the second one in my code (I tried to solve this by using drawBehind but I can't ...).

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

@github-actions
Copy link

There are differences in Compose previews:

@takahirom
Copy link
Member

takahirom commented Sep 29, 2022

Can you run ./gradlew spotlessKotlinApply? 🙏

@takahirom
Copy link
Member

Step 'ktlint' found problem in 'src/main/java/io/github/droidkaigi/confsched2022/feature/sessions/TimeLane.kt':
Error on line: 36, column: 1
rule: max-line-length
Exceeded max line length (100)
java.lang.AssertionError: Error on line: 36, column: 1

@github-actions
Copy link

There are differences in Compose previews:

@takahirom
Copy link
Member

takahirom commented Sep 30, 2022

Please run ./gradlew composeLint and fix the issues🙇

@github-actions
Copy link

github-actions bot commented Oct 2, 2022

There are differences in Compose previews:

@github-actions github-actions bot temporarily deployed to deploygate-distribution October 2, 2022 09:25 Inactive
Copy link
Member

@takahirom takahirom left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you for your contribution!

@takahirom takahirom mentioned this pull request Oct 2, 2022
@takahirom takahirom merged commit 745ce21 into DroidKaigi:main Oct 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sticky time scroll in session list
2 participants