Skip to content

Commit

Permalink
Simplify logic
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <alper_ozturk@proton.me>
  • Loading branch information
alperozturk96 committed Jun 28, 2024
1 parent 28c8ed8 commit 3f89c24
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -807,8 +807,8 @@ private void onCreateShareViaLinkOperationFinish(CreateShareViaLinkOperation ope
sharingFragment.onUpdateShareInformation(result, file);
}

if (fileListFragment instanceof OCFileListFragment && file != null) {
((OCFileListFragment) fileListFragment).updateOCFile(file);
if (fileListFragment instanceof OCFileListFragment ocFileListFragment && file != null) {
ocFileListFragment.updateOCFile(file);
}
} else {
// Detect Failure (403) --> maybe needs password
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1387,14 +1387,14 @@ public void listDirectory(OCFile directory, OCFile file, boolean onlyOnDevice, b
}
}

public void updateOCFile(OCFile file) {
public void updateOCFile(@NonNull OCFile file) {
List<OCFile> mFiles = mAdapter.getFiles();
int index = mFiles.indexOf(file);
if (index == -1) {
if (!mFiles.contains(file)) {
Log_OC.d(TAG, "File cannot be found in adapter's files");
return;
}

int index = mFiles.indexOf(file);
mFiles.set(index, file);
mAdapter.notifyItemChanged(file);
}
Expand Down

0 comments on commit 3f89c24

Please sign in to comment.