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 scroll down performance #78

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ class AllAppsFragment(
shouldIntercept =
distance > 0 && binding.allAppsGrid.computeVerticalScrollOffset() == 0
if (shouldIntercept) {
activity?.hideKeyboard()
// Hiding is expensive, only do it if focused
if (binding.searchBar.hasFocus()) {
activity?.hideKeyboard()
}
activity?.startHandlingTouches(touchDownY)
touchDownY = -1
}
Expand Down Expand Up @@ -221,7 +224,8 @@ class AllAppsFragment(
binding.allAppsFastscroller.setPadding(leftListPadding, 0, rightListPadding, 0)
binding.allAppsGrid.addOnScrollListener(object : OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
if (dy > 0 && binding.allAppsGrid.computeVerticalScrollOffset() > 0) {
// Hiding is expensive, only do it if focused
if (binding.searchBar.hasFocus() && dy > 0 && binding.allAppsGrid.computeVerticalScrollOffset() > 0) {
activity?.hideKeyboard()
}
}
Expand Down
Loading