OC-2971: Grant action is working in other views: Details, Videos, MP3 Player and Images

This commit is contained in:
masensio 2014-02-18 09:45:20 +01:00
parent 6cf78042b0
commit a6aec931a7
3 changed files with 33 additions and 5 deletions

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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);