Skip to content

Commit 0c4d5d0

Browse files
chagaiBalperozturk96
authored andcommitted
Prevent SwipeRefreshLayout from intercepting while list can still scroll up
This PR fixes an issue where pull-to-refresh could trigger while the files list was not at the top, causing an unexpected refresh and interrupting scrolling. Implementation: - Set a ChildScrollUpCallback on SwipeRefreshLayout to return true when the RecyclerView can still scroll up (canScrollVertically(-1) == true). This prevents SwipeRefreshLayout from intercepting gestures mid-list. Signed-off-by: chagaiB <[email protected]>
1 parent 975150c commit 0c4d5d0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,12 @@ public void onResume() {
280280
@Override
281281
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
282282
super.onViewCreated(view, savedInstanceState);
283+
// Ensure pull-to-refresh only triggers when the list is truly at top
284+
swipeRefreshLayout.setOnChildScrollUpCallback((parent, child) ->{
285+
// If the RecyclerView can scroll up, don't allow SwipeRefreshLayout to intercept (no refresh)
286+
return recyclerView != null && recyclerView.canScrollVertically(-1);
287+
});
288+
283289
setupBackButtonRedirectToAllFiles();
284290
}
285291

0 commit comments

Comments
 (0)