X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/5780aca37f2c8d74058b57be6e7f7b3024c26132..4246701891d4f6e412e98bbba25be1c50b4e3e23:/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 e152dafe..d1ffd8f6 100644 --- a/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java +++ b/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java @@ -128,24 +128,23 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver { i.putExtra(FileUploader.KEY_INSTANT_UPLOAD, true); // instant upload behaviour + i = addInstantUploadBehaviour(i, context); + + context.startService(i); + } + + private Intent addInstantUploadBehaviour(Intent i, Context context){ 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); + return i; } private void handleNewVideoAction(Context context, Intent intent) { @@ -200,22 +199,7 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver { 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"); - } + i = addInstantUploadBehaviour(i, context); context.startService(i); @@ -281,22 +265,7 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver { 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"); - } + i = addInstantUploadBehaviour(i, context); context.startService(i);