diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index c5f49bca92..4bbac63da6 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -119,7 +119,8 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa private static final String KEY_WAITING_TO_PREVIEW = "WAITING_TO_PREVIEW"; private static final String KEY_SYNC_IN_PROGRESS = "SYNC_IN_PROGRESS"; - private static final String KEY_REFRESH_SHARES_IN_PROGRESS = "SHARES_IN_PROGRESS"; + //private static final String KEY_REFRESH_SHARES_IN_PROGRESS = "SHARES_IN_PROGRESS"; + private static final String KEY_WAITING_TO_SEND = "WAITING_TO_SEND"; public static final int DIALOG_SHORT_WAIT = 0; private static final int DIALOG_CHOOSE_UPLOAD_SOURCE = 1; @@ -173,11 +174,13 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa mWaitingToPreview = (OCFile) savedInstanceState.getParcelable(FileDisplayActivity.KEY_WAITING_TO_PREVIEW); mSyncInProgress = savedInstanceState.getBoolean(KEY_SYNC_IN_PROGRESS); //mRefreshSharesInProgress = savedInstanceState.getBoolean(KEY_REFRESH_SHARES_IN_PROGRESS); + mWaitingToSend = (OCFile) savedInstanceState.getParcelable(FileDisplayActivity.KEY_WAITING_TO_SEND); } else { mWaitingToPreview = null; mSyncInProgress = false; //mRefreshSharesInProgress = false; + mWaitingToSend = null; } /// USER INTERFACE @@ -668,6 +671,7 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa outState.putParcelable(FileDisplayActivity.KEY_WAITING_TO_PREVIEW, mWaitingToPreview); outState.putBoolean(FileDisplayActivity.KEY_SYNC_IN_PROGRESS, mSyncInProgress); //outState.putBoolean(FileDisplayActivity.KEY_REFRESH_SHARES_IN_PROGRESS, mRefreshSharesInProgress); + outState.putParcelable(FileDisplayActivity.KEY_WAITING_TO_SEND, mWaitingToSend); Log_OC.d(TAG, "onSaveInstanceState() end"); } @@ -1024,11 +1028,13 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa refreshSecondFragment(intent.getAction(), downloadedRemotePath, intent.getBooleanExtra(FileDownloader.EXTRA_DOWNLOAD_RESULT, false)); } - if (mWaitingToSend != null && mWaitingToSend.isDown()) { - - sendDownloadedFile(); - + if (mWaitingToSend != null) { + mWaitingToSend = getStorageManager().getFileByPath(mWaitingToSend.getRemotePath()); // Update the file to send + if (mWaitingToSend.isDown()) { + sendDownloadedFile(); + } } + removeStickyBroadcast(intent); } diff --git a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java index fb5b6a9284..4d3b0318dc 100644 --- a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -376,6 +376,19 @@ public class FileDetailFragment extends FileFragment implements synchronizeFile(); return true; } + case R.id.action_send_file: { + FileDisplayActivity activity = (FileDisplayActivity) getSherlockActivity(); + // Obtain the file + if (!getFile().isDown()) { // Download the file + //activity.showLoadingDialog(); + Log_OC.d(TAG, getFile().getRemotePath() + " : File must be downloaded"); + activity.startDownloadForSending(getFile()); + + } else { + activity.getFileOperationsHelper().sendDownloadedFile(getFile(), activity); + } + return true; + } default: return false; } diff --git a/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java b/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java index 4c52280e70..1f98649e6b 100644 --- a/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java +++ b/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java @@ -351,6 +351,9 @@ public class PreviewMediaFragment extends FileFragment implements seeDetails(); return true; } + case R.id.action_send_file: { + sendFile(); + } default: return false; @@ -380,6 +383,12 @@ public class PreviewMediaFragment extends FileFragment implements } + private void sendFile() { + stopPreview(false); + FileActivity activity = (FileActivity)((FileFragment.ContainerActivity)getActivity()); + activity.getFileOperationsHelper().sendDownloadedFile(getFile(), activity); + + } private void seeDetails() { stopPreview(false);