+ /**
+ * Show untrusted cert dialog
+ */
+ public void showUntrustedCertDialog(RemoteOperationResult result) {
+ // Show a dialog with the certificate info
+ SslUntrustedCertDialog dialog = SslUntrustedCertDialog.newInstanceForFullSslError((CertificateCombinedException)result.getException());
+ FragmentManager fm = getSupportFragmentManager();
+ FragmentTransaction ft = fm.beginTransaction();
+ dialog.show(ft, DIALOG_UNTRUSTED_CERT);
+ }
+
+ private void requestForDownload(OCFile file) {
+ Account account = getAccount();
+ if (!mDownloaderBinder.isDownloading(account, file)) {
+ Intent i = new Intent(this, FileDownloader.class);
+ i.putExtra(FileDownloader.EXTRA_ACCOUNT, account);
+ i.putExtra(FileDownloader.EXTRA_FILE, file);
+ startService(i);
+ }
+ }
+
+ private void sendDownloadedFile(){
+ getFileOperationsHelper().sendDownloadedFile(mWaitingToSend);
+ mWaitingToSend = null;
+ }
+
+
+ /**
+ * Requests the download of the received {@link OCFile} , updates the UI
+ * to monitor the download progress and prepares the activity to send the file
+ * when the download finishes.
+ *
+ * @param file {@link OCFile} to download and preview.
+ */
+ public void startDownloadForSending(OCFile file) {
+ mWaitingToSend = file;
+ requestForDownload(mWaitingToSend);
+ boolean hasSecondFragment = (getSecondFragment()!= null);
+ updateFragmentsVisibility(hasSecondFragment);
+ }
+
+ /**
+ * Opens the image gallery showing the image {@link OCFile} received as parameter.
+ *
+ * @param file Image {@link OCFile} to show.
+ */
+ public void startImagePreview(OCFile file) {
+ Intent showDetailsIntent = new Intent(this, PreviewImageActivity.class);
+ showDetailsIntent.putExtra(EXTRA_FILE, file);
+ showDetailsIntent.putExtra(EXTRA_ACCOUNT, getAccount());
+ startActivity(showDetailsIntent);