Skip to content
Open
Show file tree
Hide file tree
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 @@ -2375,8 +2375,20 @@ class FileDisplayActivity :
}

val file = storageManager.getFileById(renamedFile.parentId)
if (file != null && file == getCurrentDir()) {
fileListFragment?.adapter?.updateFile(renamedFile)
val isCurrentDirParentDirOfGivenFile = (file != null && file == currentDir)

// checking current dir against renamed file's parent will always fail when user is in Shared/Favorites root.
// thus check is current dir is root or not as well
if (currentDir?.isRootDirectory == true || isCurrentDirParentDirOfGivenFile) {
val fragment = fileListFragment

// OCFileSearchTask may still run during rename, so use a single refresh path to avoid
// flicker/inconsistent filenames.
if (fragment?.isSearchFragment == true) {
fragment.cancelAndRetriggerSearch()
} else {
fragment?.adapter?.updateFile(renamedFile)
}
}

refreshGalleryFragmentIfNeeded()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2122,6 +2122,16 @@ public boolean isSearchFragment() {
return searchFragment;
}

public void cancelAndRetriggerSearch() {
if (searchTask != null) {
searchTask.cancel();
searchTask = null;
}
if (searchEvent != null) {
handleSearchEvent(searchEvent);
}
}

/**
* De-/select all elements in the current list view.
*
Expand Down
Loading