X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/4b8a5a9c9243dd4a68c6bc71a03f0a365524f281..e61641b39df804db56197d36530dbddd145a91c9:/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java diff --git a/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java b/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java index 0fd09384..f8254ff0 100644 --- a/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java +++ b/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java @@ -128,23 +128,18 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver { SharedPreferences appPreferences = PreferenceManager.getDefaultSharedPreferences(context); String behaviour = appPreferences.getString("prefs_instant_behaviour", "NOTHING"); - switch (behaviour){ - case "NOTHING": - Log_OC.d(TAG, "upload file and do nothing"); - i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_FORGET); - break; - case "COPY": - i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_COPY); - Log_OC.d(TAG, "upload file and copy file to oc folder"); - break; - case "MOVE": - i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_MOVE); - Log_OC.d(TAG, "upload file and move file to oc folder"); - break; - case "DELETE": - i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_REMOVE); - Log_OC.d(TAG, "upload file and delete file in original place"); - break; + if (behaviour.equalsIgnoreCase("NOTHING")) { + Log_OC.d(TAG, "upload file and do nothing"); + i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_FORGET); + } else if (behaviour.equalsIgnoreCase("COPY")) { + i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_COPY); + Log_OC.d(TAG, "upload file and copy file to oc folder"); + } else if (behaviour.equalsIgnoreCase("MOVE")) { + i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_MOVE); + Log_OC.d(TAG, "upload file and move file to oc folder"); + } else if (behaviour.equalsIgnoreCase("DELETE")){ + i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_REMOVE); + Log_OC.d(TAG, "upload file and delete file in original place"); } context.startService(i); @@ -192,6 +187,25 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver { i.putExtra(FileUploader.KEY_UPLOAD_TYPE, FileUploader.UPLOAD_SINGLE_FILE); i.putExtra(FileUploader.KEY_MIME_TYPE, mime_type); i.putExtra(FileUploader.KEY_INSTANT_UPLOAD, true); + + // instant upload behaviour + SharedPreferences appPreferences = PreferenceManager.getDefaultSharedPreferences(context); + String behaviour = appPreferences.getString("prefs_instant_behaviour", "NOTHING"); + + if (behaviour.equalsIgnoreCase("NOTHING")) { + Log_OC.d(TAG, "upload file and do nothing"); + i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_FORGET); + } else if (behaviour.equalsIgnoreCase("COPY")) { + i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_COPY); + Log_OC.d(TAG, "upload file and copy file to oc folder"); + } else if (behaviour.equalsIgnoreCase("MOVE")) { + i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_MOVE); + Log_OC.d(TAG, "upload file and move file to oc folder"); + } else if (behaviour.equalsIgnoreCase("DELETE")){ + i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_REMOVE); + Log_OC.d(TAG, "upload file and delete file in original place"); + } + context.startService(i); } @@ -232,6 +246,25 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver { i.putExtra(FileUploader.KEY_REMOTE_FILE, FileStorageUtils.getInstantUploadFilePath(context, f.getName())); i.putExtra(FileUploader.KEY_UPLOAD_TYPE, FileUploader.UPLOAD_SINGLE_FILE); i.putExtra(FileUploader.KEY_INSTANT_UPLOAD, true); + + // instant upload behaviour + SharedPreferences appPreferences = PreferenceManager.getDefaultSharedPreferences(context); + String behaviour = appPreferences.getString("prefs_instant_behaviour", "NOTHING"); + + if (behaviour.equalsIgnoreCase("NOTHING")) { + Log_OC.d(TAG, "upload file and do nothing"); + i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_FORGET); + } else if (behaviour.equalsIgnoreCase("COPY")) { + i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_COPY); + Log_OC.d(TAG, "upload file and copy file to oc folder"); + } else if (behaviour.equalsIgnoreCase("MOVE")) { + i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_MOVE); + Log_OC.d(TAG, "upload file and move file to oc folder"); + } else if (behaviour.equalsIgnoreCase("DELETE")){ + i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_REMOVE); + Log_OC.d(TAG, "upload file and delete file in original place"); + } + context.startService(i); } else {