From 9b758dfa70610ff5a3f200dfdf94e0c519b9b621 Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Thu, 4 Apr 2013 17:15:53 +0200 Subject: [PATCH] Recovery of instant uploads in temporary disabled --- .../android/files/services/FileUploader.java | 2 +- .../ui/activity/FileDisplayActivity.java | 20 +++++++++++++++---- .../ui/activity/InstantUploadActivity.java | 1 + 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/com/owncloud/android/files/services/FileUploader.java b/src/com/owncloud/android/files/services/FileUploader.java index 330b793ca3..9d2bbcf20e 100644 --- a/src/com/owncloud/android/files/services/FileUploader.java +++ b/src/com/owncloud/android/files/services/FileUploader.java @@ -801,7 +801,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe // we add only for instant-uploads the InstantUploadActivity and the // db entry Intent detailUploadIntent = null; - if (upload.isInstant()) { + if (upload.isInstant() && InstantUploadActivity.IS_ENABLED) { detailUploadIntent = new Intent(this, InstantUploadActivity.class); detailUploadIntent.putExtra(FileUploader.KEY_ACCOUNT, upload.getAccount()); } else { diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index 17504a8fa7..62937b10b5 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -753,9 +753,21 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements break; } case DIALOG_CHOOSE_UPLOAD_SOURCE: { - final String[] items = { getString(R.string.actionbar_upload_files), - getString(R.string.actionbar_upload_from_apps), - getString(R.string.actionbar_failed_instant_upload) }; + + String[] items = null; + + String[] allTheItems = { getString(R.string.actionbar_upload_files), + getString(R.string.actionbar_upload_from_apps), + getString(R.string.actionbar_failed_instant_upload) }; + + String[] commonItems = { getString(R.string.actionbar_upload_files), + getString(R.string.actionbar_upload_from_apps) }; + + if (InstantUploadActivity.IS_ENABLED) + items = allTheItems; + else + items = commonItems; + builder = new AlertDialog.Builder(this); builder.setTitle(R.string.actionbar_upload); builder.setItems(items, new DialogInterface.OnClickListener() { @@ -775,7 +787,7 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements action = action.setType("*/*").addCategory(Intent.CATEGORY_OPENABLE); startActivityForResult(Intent.createChooser(action, getString(R.string.upload_chooser_title)), ACTION_SELECT_CONTENT_FROM_APPS); - } else if (item == 2) { + } else if (item == 2 && InstantUploadActivity.IS_ENABLED) { Account account = AccountUtils.getCurrentOwnCloudAccount(FileDisplayActivity.this); Intent action = new Intent(FileDisplayActivity.this, InstantUploadActivity.class); action.putExtra(FileUploader.KEY_ACCOUNT, account); diff --git a/src/com/owncloud/android/ui/activity/InstantUploadActivity.java b/src/com/owncloud/android/ui/activity/InstantUploadActivity.java index 7b964a6568..910802f928 100644 --- a/src/com/owncloud/android/ui/activity/InstantUploadActivity.java +++ b/src/com/owncloud/android/ui/activity/InstantUploadActivity.java @@ -75,6 +75,7 @@ public class InstantUploadActivity extends Activity { private static final String LOG_TAG = InstantUploadActivity.class.getSimpleName(); private LinearLayout listView; private static final String retry_chexbox_tag = "retry_chexbox_tag"; + public static final boolean IS_ENABLED = false; private static int MAX_LOAD_IMAGES = 5; private int lastLoadImageIdx = 0;