mirror of
https://github.com/nextcloud/android.git
synced 2024-12-19 07:22:06 +03:00
SharedListFragment: replace file in adapter when fetching the complete data
This fixes bugs with selection Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
71fb20b524
commit
1a4aaf5224
2 changed files with 25 additions and 0 deletions
|
@ -993,4 +993,27 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
public void notifyItemChanged(@NonNull OCFile file) {
|
||||
notifyItemChanged(getItemPosition(file));
|
||||
}
|
||||
|
||||
public void replaceFileByRemotePath(@NonNull OCFile newFile, boolean notify) {
|
||||
final String remotePath = newFile.getRemotePath();
|
||||
for (OCFile file : mFiles) {
|
||||
if (file.getRemotePath().equals(remotePath)) {
|
||||
final int index = mFiles.indexOf(file);
|
||||
mFiles.set(index, newFile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (OCFile file : mFilesAll) {
|
||||
if (file.getRemotePath().equals(remotePath)) {
|
||||
final int index = mFilesAll.indexOf(file);
|
||||
mFilesAll.set(index, newFile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (notify) {
|
||||
notifyItemChanged(getItemPosition(newFile));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,6 +101,8 @@ class SharedListFragment : OCFileListFragment(), Injectable {
|
|||
isSharedWithSharee = partialFile.isSharedWithSharee
|
||||
sharees = partialFile.sharees
|
||||
}
|
||||
adapter.replaceFileByRemotePath(savedFile, false)
|
||||
savedFile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue