From: masensio Date: Fri, 6 Mar 2015 09:19:06 +0000 (+0100) Subject: Merge branch 'develop' into share_password_support X-Git-Tag: oc-android-1.7.1_signed^2~27^2~8 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/82fa95fe43a82a294ef1212980ca9a32a8c50283?hp=-c Merge branch 'develop' into share_password_support --- 82fa95fe43a82a294ef1212980ca9a32a8c50283 diff --combined src/com/owncloud/android/operations/CreateShareOperation.java index e1bc0abb,01059c9e..eb7ae7a9 --- a/src/com/owncloud/android/operations/CreateShareOperation.java +++ b/src/com/owncloud/android/operations/CreateShareOperation.java @@@ -1,5 -1,8 +1,8 @@@ - /* ownCloud Android client application - * Copyright (C) 2014 ownCloud Inc. + /** + * ownCloud Android client application + * + * @author masensio + * Copyright (C) 2015 ownCloud Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@@ -19,9 -22,6 +22,6 @@@ package com.owncloud.android.operations /** * Creates a new share from a given file - * - * @author masensio - * */ import android.content.Context; @@@ -98,8 -98,7 +98,8 @@@ public class CreateShareOperation exten RemoteOperationResult result = ((GetRemoteSharesForFileOperation)operation).execute(client); if (!result.isSuccess() || result.getData().size() <= 0) { - operation = new CreateRemoteShareOperation(mPath, mShareType, mShareWith, mPublicUpload, mPassword, mPermissions); + operation = new CreateRemoteShareOperation(mPath, mShareType, mShareWith, mPublicUpload, + mPassword, mPermissions); result = ((CreateRemoteShareOperation)operation).execute(client); } diff --combined src/com/owncloud/android/services/OperationsService.java index 2c30ae04,a4bc8f6c..525fa418 --- a/src/com/owncloud/android/services/OperationsService.java +++ b/src/com/owncloud/android/services/OperationsService.java @@@ -1,5 -1,7 +1,7 @@@ - /* ownCloud Android client application - * Copyright (C) 2012-2014 ownCloud Inc. + /** + * ownCloud Android client application + * + * Copyright (C) 2015 ownCloud Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@@ -525,8 -527,7 +527,8 @@@ public class OperationsService extends String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH); Intent sendIntent = operationIntent.getParcelableExtra(EXTRA_SEND_INTENT); if (remotePath.length() > 0) { - operation = new CreateShareOperation(OperationsService.this, remotePath, ShareType.PUBLIC_LINK, + operation = new CreateShareOperation(OperationsService.this, remotePath, + ShareType.PUBLIC_LINK, "", false, "", 1, sendIntent); } diff --combined src/com/owncloud/android/ui/activity/FileActivity.java index 34ce5831,e92474b7..4fdadc17 --- a/src/com/owncloud/android/ui/activity/FileActivity.java +++ b/src/com/owncloud/android/ui/activity/FileActivity.java @@@ -1,6 -1,9 +1,9 @@@ - /* ownCloud Android client application + /** + * ownCloud Android client application + * + * @author David A. Velasco * Copyright (C) 2011 Bartek Przybylski - * Copyright (C) 2012-2015 ownCloud Inc. + * Copyright (C) 2015 ownCloud Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@@ -58,16 -61,12 +61,14 @@@ import com.owncloud.android.operations. import com.owncloud.android.operations.UnshareLinkOperation; import com.owncloud.android.services.OperationsService; import com.owncloud.android.services.OperationsService.OperationsServiceBinder; +import com.owncloud.android.ui.dialog.CreateFolderDialogFragment; import com.owncloud.android.ui.dialog.LoadingDialog; +import com.owncloud.android.ui.dialog.SharePasswordDialogFragment; import com.owncloud.android.utils.ErrorMessageAdapter; /** * Activity with common behaviour for activities handling {@link OCFile}s in ownCloud {@link Account}s . - * - * @author David A. Velasco */ public class FileActivity extends SherlockFragmentActivity implements OnRemoteOperationListener, ComponentsGetter { @@@ -81,7 -80,6 +82,7 @@@ private static final String DIALOG_WAIT_TAG = "DIALOG_WAIT"; private static final String KEY_WAITING_FOR_OP_ID = "WAITING_FOR_OP_ID"; + private static final String DIALOG_SHARE_PASSWORD = "DIALOG_SHARE_PASSWORD"; protected static final long DELAY_TO_REQUEST_OPERATION_ON_ACTIVITY_RESULTS = 200; @@@ -363,8 -361,6 +364,6 @@@ * a new ownCloud {@link Account} finished, successfully or not. * * At this moment, only called after the creation of the first account. - * - * @author David A. Velasco */ public class AccountCreationCallback implements AccountManagerCallback { @@@ -490,17 -486,10 +489,17 @@@ Intent sendIntent = operation.getSendIntent(); startActivity(sendIntent); - } else { - Toast t = Toast.makeText(this, ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()), - Toast.LENGTH_LONG); - t.show(); + } else { + // TODO Detect Failure (403) --> needs Password + if (result.getCode() == ResultCode.SHARE_FORBIDDEN) { + SharePasswordDialogFragment dialog = + SharePasswordDialogFragment.newInstance(getFile()); + dialog.show(getSupportFragmentManager(), DIALOG_SHARE_PASSWORD); + } else { + Toast t = Toast.makeText(this, ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()), + Toast.LENGTH_LONG); + t.show(); + } } }