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();
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();
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;
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