Merge pull request #10391 from nextcloud/updateSharIcon

Update share icon when sharing link directly
This commit is contained in:
Álvaro Brey 2022-06-14 21:24:11 +02:00 committed by GitHub
commit 84aa239c9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -87,6 +87,7 @@ import com.owncloud.android.ui.dialog.ShareLinkToDialog;
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
import com.owncloud.android.ui.fragment.FileDetailFragment;
import com.owncloud.android.ui.fragment.FileDetailSharingFragment;
import com.owncloud.android.ui.fragment.OCFileListFragment;
import com.owncloud.android.ui.helpers.FileOperationsHelper;
import com.owncloud.android.utils.ClipboardUtil;
import com.owncloud.android.utils.DisplayUtils;
@ -781,6 +782,7 @@ public abstract class FileActivity extends DrawerActivity
private void onCreateShareViaLinkOperationFinish(CreateShareViaLinkOperation operation,
RemoteOperationResult result) {
FileDetailSharingFragment sharingFragment = getShareFileFragment();
OCFileListFragment fileListFragment = (OCFileListFragment) getSupportFragmentManager().findFragmentByTag(FileDisplayActivity.TAG_LIST_OF_FILES);
if (result.isSuccess()) {
updateFileFromDB();
@ -803,6 +805,10 @@ public abstract class FileActivity extends DrawerActivity
if (sharingFragment != null) {
sharingFragment.onUpdateShareInformation(result, file);
}
if (fileListFragment != null && file != null) {
fileListFragment.updateOCFile(file);
}
} else {
// Detect Failure (403) --> maybe needs password
String password = operation.getPassword();

View file

@ -1322,6 +1322,12 @@ public class OCFileListFragment extends ExtendedListFragment implements
}
}
public void updateOCFile(OCFile file) {
mAdapter.getFiles().remove(file);
mAdapter.getFiles().add(file);
mAdapter.notifyItemChanged(file);
}
private void updateLayout() {
// decide grid vs list view
if (isGridViewPreferred(mFile)) {