Skip to content
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 @@ -371,8 +371,6 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int
public void swapDirectory(final File directory) {
localFileListFragmentInterface.setLoading(true);
currentOffset = 0;
mFiles.clear();
Copy link
Copy Markdown
Collaborator Author

@alperozturk96 alperozturk96 Jan 19, 2026

Choose a reason for hiding this comment

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

updateUIForFirstPage will clear it.

mFilesAll.clear();

singleThreadExecutor.execute(() -> {
// Load first page of folders
Expand All @@ -398,8 +396,10 @@ public void swapDirectory(final File directory) {
@SuppressLint("NotifyDataSetChanged")
private void updateUIForFirstPage(List<File> firstPage) {
new Handler(Looper.getMainLooper()).post(() -> {
mFiles = new ArrayList<>(firstPage);
mFilesAll = new ArrayList<>(firstPage);
mFiles.clear();
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Clear mFiles in updateUIForFirstPage.

mFilesAll.clear();
mFiles.addAll(firstPage);
mFilesAll.addAll(firstPage);
notifyDataSetChanged();
localFileListFragmentInterface.setLoading(false);
});
Expand Down Expand Up @@ -432,15 +432,16 @@ private void loadRemainingEntries(File directory, boolean fetchFolders) {

private void notifyItemRange(List<File> updatedList) {
new Handler(Looper.getMainLooper()).post(() -> {
int from = mFiles.size();
int to = updatedList.size();
int headerOffset = shouldShowHeader() ? 1 : 0;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Add shouldShowHeader into the calculation.

int startPositionInAdapter = mFiles.size() + headerOffset;
int itemCount = updatedList.size();

mFiles.addAll(updatedList);
mFilesAll.addAll(updatedList);

Log_OC.d(TAG, "notifyItemRange, item size: " + mFilesAll.size());

notifyItemRangeInserted(from, to);
notifyItemRangeInserted(startPositionInAdapter, itemCount);
});
}

Expand Down
Loading