X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/b368a4b853e7dff2e5c53166dde75b107df85656..49f593ecd148ef5e5bd64dcb2d8bcc7e394e6ef2:/src/com/owncloud/android/ui/activity/ShareActivity.java diff --git a/src/com/owncloud/android/ui/activity/ShareActivity.java b/src/com/owncloud/android/ui/activity/ShareActivity.java index 047e62d2..72790471 100644 --- a/src/com/owncloud/android/ui/activity/ShareActivity.java +++ b/src/com/owncloud/android/ui/activity/ShareActivity.java @@ -32,6 +32,7 @@ import android.support.v4.app.FragmentTransaction; import com.owncloud.android.R; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.operations.CreateShareViaLinkOperation; +import com.owncloud.android.operations.GetSharesForFileOperation; import com.owncloud.android.providers.UsersAndGroupsSearchProvider; import com.owncloud.android.lib.common.operations.RemoteOperation; @@ -101,8 +102,10 @@ public class ShareActivity extends FileActivity } else if (UsersAndGroupsSearchProvider.ACTION_SHARE_WITH.equals(intent.getAction())) { Uri data = intent.getData(); + String dataString = intent.getDataString(); + String shareWith = dataString.substring(dataString.lastIndexOf('/') + 1); doShareWith( - data.getLastPathSegment(), + shareWith, UsersAndGroupsSearchProvider.DATA_GROUP.equals(data.getAuthority()) ); @@ -160,23 +163,28 @@ public class ShareActivity extends FileActivity public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) { super.onRemoteOperationFinish(operation, result); - if (result.isSuccess()) { - Log_OC.d(TAG, "Refreshing view on successful operation"); + if (result.isSuccess() || + (operation instanceof GetSharesForFileOperation && + result.getCode() == RemoteOperationResult.ResultCode.SHARE_NOT_FOUND + ) + ) { + Log_OC.d(TAG, "Refreshing view on successful operation or finished refresh"); refreshSharesFromStorageManager(); + } - if (operation instanceof CreateShareViaLinkOperation) { - // Send link to the app - String link = ((OCShare) (result.getData().get(0))).getShareLink(); - Log_OC.d(TAG, "Share link = " + link); - - Intent intentToShareLink = new Intent(Intent.ACTION_SEND); - intentToShareLink.putExtra(Intent.EXTRA_TEXT, link); - intentToShareLink.setType(HTTP.PLAIN_TEXT_TYPE); - String[] packagesToExclude = new String[]{getPackageName()}; - DialogFragment chooserDialog = ShareLinkToDialog.newInstance(intentToShareLink, packagesToExclude); - chooserDialog.show(getSupportFragmentManager(), FTAG_CHOOSER_DIALOG); - } + if (operation instanceof CreateShareViaLinkOperation && result.isSuccess()) { + // Send link to the app + String link = ((OCShare) (result.getData().get(0))).getShareLink(); + Log_OC.d(TAG, "Share link = " + link); + + Intent intentToShareLink = new Intent(Intent.ACTION_SEND); + intentToShareLink.putExtra(Intent.EXTRA_TEXT, link); + intentToShareLink.setType(HTTP.PLAIN_TEXT_TYPE); + String[] packagesToExclude = new String[]{getPackageName()}; + DialogFragment chooserDialog = ShareLinkToDialog.newInstance(intentToShareLink, packagesToExclude); + chooserDialog.show(getSupportFragmentManager(), FTAG_CHOOSER_DIALOG); } + } @@ -188,6 +196,7 @@ public class ShareActivity extends FileActivity ShareFileFragment shareFileFragment = getShareFileFragment(); if (shareFileFragment != null && shareFileFragment.isAdded()) { // only if added to the view hierarchy!! + shareFileFragment.refreshCapabilitiesFromDB(); shareFileFragment.refreshUsersOrGroupsListFromDB(); shareFileFragment.refreshPublicShareFromDB(); }