OCFileListFragment: Only scroll to top if directory changed (#4058)
OCFileListFragment: Only scroll to top if directory changed
This commit is contained in:
1 file changed
+5
-1
@@ -1190,6 +1190,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||
onlyOnDevice,
|
||||
mLimitToMimeType
|
||||
);
|
||||
|
||||
OCFile previousDirectory = mFile;
|
||||
mFile = directory;
|
||||
|
||||
updateLayout();
|
||||
@@ -1197,7 +1199,9 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||
mAdapter.setHighlightedItem(file);
|
||||
int position = mAdapter.getItemPosition(file);
|
||||
if (position == -1) {
|
||||
getRecyclerView().scrollToPosition(0);
|
||||
if (previousDirectory == null || !previousDirectory.equals(directory)) {
|
||||
getRecyclerView().scrollToPosition(0);
|
||||
}
|
||||
} else {
|
||||
getRecyclerView().scrollToPosition(position);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user