From: tobiasKaminsky Date: Thu, 29 Oct 2015 17:49:00 +0000 (+0100) Subject: Merge remote-tracking branch 'remotes/upstream/avoidDuplicateFiles' into beta X-Git-Tag: beta-20151122~82 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/cc05129c903b9e6bb7e00af479cb61ce203d3b63?hp=-c Merge remote-tracking branch 'remotes/upstream/avoidDuplicateFiles' into beta --- cc05129c903b9e6bb7e00af479cb61ce203d3b63 diff --combined CHANGELOG.md index 79e012b8,6934155f..870e4f06 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@@ -1,15 -1,42 +1,16 @@@ -## 1.7.2 (July 2015) -- New navigation drawer -- Improved Passcode -- Automatic grid view just for folders full of images -- More characters allowed in file names -- Support for servers in same domain, different path -- Bugs fixed: - + Frequent crashes in folder with several images - + Sync error in servers with huge quota and external storage enable - + Share by link error - + Some other crashes and minor bugs - -## 1.7.1 (April 2015) - -- Share link even with password enforced by server -- Get the app ready for oc 8.1 servers -- Added option to create new folder in uploads from external apps -- Improved management of deleted users -- Bugs fixed - + Fixed crash on Android 2.x devices - + Improvements on uploads - -## 1.7.0 (February 2015) - -- Download full folders -- Grid view for images -- Remote thumbnails (OC Server 8.0+) -- Added number of files and folders at the end of the list -- "Open with" in contextual menu -- Downloads added to Media Provider -- Uploads: - + Local thumbnails in section "Files" - + Multiple selection in "Content from other apps" (Android 4.3+) -- Gallery: - + proper handling of EXIF - + obey sorting in the list of files -- Settings view updated -- Improved subjects in e-mails -- Bugs fixed - +# 2015-10-29 +- PR [#1099](https://github.com/owncloud/android/pull/1099) "Switch list vs grid" merged +- PR [#1100](https://github.com/owncloud/android/pull/1100) "Material FAB with speed dial implementation" merged +- PR [#1209](https://github.com/owncloud/android/pull/1209) "Material buttons - before in #1090" merged +- PR [#1205](https://github.com/owncloud/android/pull/1205) "Switch between online and offline files" merged +- PR [#1195](https://github.com/owncloud/android/pull/1195) "Resize Cache" merged +- PR [#1187](https://github.com/owncloud/android/pull/1187) "Video: Big thumbnails" merged +- PR [#1058](https://github.com/owncloud/android/pull/1058) "add sort to UploadFileActiviy" merged ++- PR [#1168](https://github.com/owncloud/android/pull/1168) "Avoid duplicate files" merged +# 2015-10-26 +- start of branch +- PR [#745](https://github.com/owncloud/android/pull/745) merged +- PR [#1044](https://github.com/owncloud/android/pull/1044) merged: < 8.1: GalleryPlus app needed, >= 8.2 Gallery app needed +- PR [#1111](https://github.com/owncloud/android/pull/1111) merged diff --combined res/layout/upload_files_layout.xml index 121fd64d,f7f802cd..fbf9cee6 --- a/res/layout/upload_files_layout.xml +++ b/res/layout/upload_files_layout.xml @@@ -33,12 -33,60 +33,60 @@@ + + + + + + + + + + + + + + + + + android:orientation="horizontal" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:paddingBottom="16dp"> All files - + On device Settings Logs Close @@@ -73,7 -74,6 +73,7 @@@ seconds ago Nothing in here. Upload something! Loading… + No App found for file type! There are no files in this folder. Tap on a file to display additional information. Size: @@@ -262,11 -262,9 +262,11 @@@ 389 KB 2012/05/18 12:23 PM 12:23:45 - - Upload pictures via WiFi only - Upload videos via WiFi only + + Upload pictures via wifi only + Upload when charging only + Upload videos via wifi only + Upload when charging only /InstantUpload File conflict Which files do you want to keep? If you select both versions, the local file will have a number added to its name. @@@ -278,7 -276,7 +278,7 @@@ This image cannot be shown %1$s could not be copied to %2$s local folder - Upload Path + Upload path Sorry, sharing is not enabled on your server. Please contact your administrator. @@@ -343,7 -341,7 +343,7 @@@ Instant Uploads Security - Upload Video Path + Upload video path Download of %1$s folder could not be completed shared @@@ -366,9 -364,14 +366,18 @@@ %1$d files %1$d files, 1 folder %1$d files, %2$d folders + Switch to grid view + Switch to list view + Common + Cache size + Upload file to server and ... + Behaviour + Copy file + Move file + + do nothing + copy file to OC folder + move file to OC folder + delete origin file diff --combined res/xml/preferences.xml index 842579bb,161bb666..e09de46d --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@@ -3,7 -3,7 +3,7 @@@ ownCloud Android client application Copyright (C) 2012 Bartek Przybylski - Copyright (C) 2015 ownCloud Inc. + Copyright (C) 2012-2013 ownCloud Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 2, @@@ -18,67 -18,42 +18,80 @@@ along with this program. If not, see . --> - + - + + - + + + + - + android:key="instant_uploading" + android:title="@string/prefs_instant_upload" + android:summary="@string/prefs_instant_upload_summary"/> + + + + + + android:dependency="instant_video_uploading" + android:disableDependentsState="true" + android:title="@string/prefs_instant_video_upload_path_title" + android:key="instant_video_upload_path" /> - - + + + + + @@@ -104,6 -73,6 +117,6 @@@ android:title="@string/about_title" android:key="about_app" /> - + diff --combined src/com/owncloud/android/datamodel/FileDataStorageManager.java index f2223d44,b7485897..46a4d854 --- a/src/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/src/com/owncloud/android/datamodel/FileDataStorageManager.java @@@ -148,9 -148,10 +148,9 @@@ public class FileDataStorageManager } - public Vector getFolderContent(OCFile f/*, boolean onlyOnDevice*/) { + public Vector getFolderContent(OCFile f, boolean onlyOnDevice) { if (f != null && f.isFolder() && f.getFileId() != -1) { - // TODO Enable when "On Device" is recovered ? - return getFolderContent(f.getFileId()/*, onlyOnDevice*/); + return getFolderContent(f.getFileId(), onlyOnDevice); } else { return new Vector(); @@@ -158,11 -159,12 +158,11 @@@ } - public Vector getFolderImages(OCFile folder/*, boolean onlyOnDevice*/) { + public Vector getFolderImages(OCFile folder, boolean onlyOnDevice) { Vector ret = new Vector(); if (folder != null) { // TODO better implementation, filtering in the access to database instead of here - // TODO Enable when "On Device" is recovered ? - Vector tmp = getFolderContent(folder/*, onlyOnDevice*/); + Vector tmp = getFolderContent(folder, onlyOnDevice); OCFile current = null; for (int i=0; i files = getFolderContent(folder.getFileId()/*, false*/); + Vector files = getFolderContent(folder.getFileId(), false); if (files != null) { for (OCFile file : files) { if (file.isFolder()) { @@@ -784,7 -787,7 +784,7 @@@ } - private Vector getFolderContent(long parentId/*, boolean onlyOnDevice*/) { + private Vector getFolderContent(long parentId, boolean onlyOnDevice) { Vector ret = new Vector(); @@@ -811,9 -814,10 +811,9 @@@ if (c.moveToFirst()) { do { OCFile child = createFileInstance(c); - // TODO Enable when "On Device" is recovered ? - // if (child.isFolder() || !onlyOnDevice || onlyOnDevice && child.isDown()){ + if (child.isFolder() || !onlyOnDevice || onlyOnDevice && child.isDown()){ ret.add(child); - // } + } } while (c.moveToNext()); } @@@ -1473,7 -1477,8 +1473,7 @@@ + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?"; String [] whereArgs = new String[]{ "", mAccount.name }; - // TODO Enable when "On Device" is recovered ? - Vector files = getFolderContent(folder /*, false*/); + Vector files = getFolderContent(folder, false); for (OCFile file : files) { whereArgs[0] = file.getRemotePath(); @@@ -1525,7 -1530,7 +1525,7 @@@ //} } - public void triggerMediaScan(String path) { + public static void triggerMediaScan(String path) { Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); intent.setData(Uri.fromFile(new File(path))); MainApp.getAppContext().sendBroadcast(intent); diff --combined src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java index 33ad1cc1,f8254ff0..676a12c6 --- a/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java +++ b/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java @@@ -29,15 -29,15 +29,16 @@@ import com.owncloud.android.files.servi import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.utils.FileStorageUtils; - import android.accounts.Account; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.content.IntentFilter; + import android.content.SharedPreferences; import android.database.Cursor; import android.net.ConnectivityManager; import android.net.NetworkInfo.State; +import android.os.BatteryManager; import android.preference.PreferenceManager; import android.provider.MediaStore.Images; import android.provider.MediaStore.Video; @@@ -59,7 -59,7 +60,7 @@@ public class InstantUploadBroadcastRece @Override public void onReceive(Context context, Intent intent) { Log_OC.d(TAG, "Received: " + intent.getAction()); - if (intent.getAction().equals(android.net.ConnectivityManager.CONNECTIVITY_ACTION)) { + if (intent.getAction().equals(android.net.ConnectivityManager.CONNECTIVITY_ACTION) || intent.getAction().equals(Intent.ACTION_POWER_CONNECTED)) { handleConnectivityAction(context, intent); }else if (intent.getAction().equals(NEW_PHOTO_ACTION_UNOFFICIAL)) { handleNewPictureAction(context, intent); @@@ -104,6 -104,7 +105,6 @@@ file_name = c.getString(c.getColumnIndex(Images.Media.DISPLAY_NAME)); mime_type = c.getString(c.getColumnIndex(Images.Media.MIME_TYPE)); c.close(); - Log_OC.d(TAG, file_path + ""); // save always temporally the picture to upload @@@ -111,10 -112,7 +112,10 @@@ db.putFileForLater(file_path, account.name, null); db.close(); - if (!isOnline(context) || (instantPictureUploadViaWiFiOnly(context) && !isConnectedViaWiFi(context))) { + if (!isOnline(context) + || (instantPictureUploadViaWiFiOnly(context) && !isConnectedViaWiFi(context)) + || (instantUploadWhenChargingOnly(context) && !isCharging(context)) + ) { return; } @@@ -125,6 -123,25 +126,25 @@@ 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); } @@@ -158,16 -175,8 +178,16 @@@ mime_type = c.getString(c.getColumnIndex(Video.Media.MIME_TYPE)); c.close(); Log_OC.d(TAG, file_path + ""); + + // save always temporally the picture to upload + DbHandler db = new DbHandler(context); + db.putFileForLater(file_path, account.name, null); + db.close(); - if (!isOnline(context) || (instantVideoUploadViaWiFiOnly(context) && !isConnectedViaWiFi(context))) { + if (!isOnline(context) + || (instantVideoUploadViaWiFiOnly(context) && !isConnectedViaWiFi(context)) + || (instantVideoUploadWhenChargingOnly(context) && !isCharging(context)) + ) { return; } @@@ -178,23 -187,38 +198,42 @@@ 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); } private void handleConnectivityAction(Context context, Intent intent) { - if (!instantPictureUploadEnabled(context)) { + if (!instantPictureUploadEnabled(context) && !instantVideoUploadEnabled(context)) { Log_OC.d(TAG, "Instant upload disabled, don't upload anything"); return; } if (!intent.hasExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY) && isOnline(context) - && (!instantPictureUploadViaWiFiOnly(context) || (instantPictureUploadViaWiFiOnly(context) == isConnectedViaWiFi(context) == true))) { + && (!instantUploadWhenChargingOnly(context) || (instantUploadWhenChargingOnly(context) && isCharging(context))) + && (!instantVideoUploadWhenChargingOnly(context) || (instantVideoUploadWhenChargingOnly(context) && isCharging(context))) + && (!instantPictureUploadViaWiFiOnly(context) || (instantPictureUploadViaWiFiOnly(context) && isConnectedViaWiFi(context))) + && (!instantVideoUploadViaWiFiOnly(context) || (instantVideoUploadViaWiFiOnly(context) && isConnectedViaWiFi(context))) + ) { DbHandler db = new DbHandler(context); Cursor c = db.getAwaitingFiles(); if (c.moveToFirst()) { @@@ -222,6 -246,25 +261,25 @@@ 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 { @@@ -232,6 -275,7 +290,6 @@@ c.close(); db.close(); } - } public static boolean isOnline(Context context) { @@@ -245,18 -289,6 +303,18 @@@ && cm.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI && cm.getActiveNetworkInfo().getState() == State.CONNECTED; } + + public static boolean isCharging(Context context){ + IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); + Intent batteryStatus = context.registerReceiver(null, ifilter); + + int status = 0; + if (batteryStatus != null) { + status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1); + } + return status == BatteryManager.BATTERY_STATUS_CHARGING || + status == BatteryManager.BATTERY_STATUS_FULL; + } public static boolean instantPictureUploadEnabled(Context context) { return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("instant_uploading", false); @@@ -273,10 -305,4 +331,10 @@@ public static boolean instantVideoUploadViaWiFiOnly(Context context) { return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("instant_video_upload_on_wifi", false); } + public static boolean instantUploadWhenChargingOnly(Context context) { + return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("instant_upload_on_charging", false); + } + public static boolean instantVideoUploadWhenChargingOnly(Context context) { + return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("instant_video_upload_on_charging", false); + } } diff --combined src/com/owncloud/android/files/services/FileUploader.java index 669ff135,81aae186..6aca4937 --- a/src/com/owncloud/android/files/services/FileUploader.java +++ b/src/com/owncloud/android/files/services/FileUploader.java @@@ -103,6 -103,7 +103,7 @@@ public class FileUploader extends Servi public static final int LOCAL_BEHAVIOUR_COPY = 0; public static final int LOCAL_BEHAVIOUR_MOVE = 1; public static final int LOCAL_BEHAVIOUR_FORGET = 2; + public static final int LOCAL_BEHAVIOUR_REMOVE = 3; public static final int UPLOAD_SINGLE_FILE = 0; public static final int UPLOAD_MULTIPLE_FILES = 1; @@@ -725,7 -726,6 +726,7 @@@ } file.setNeedsUpdateThumbnail(true); mStorageManager.saveFile(file); + mStorageManager.triggerMediaScan(file.getStoragePath()); } private void updateOCFile(OCFile file, RemoteFile remoteFile) { diff --combined src/com/owncloud/android/ui/activity/UploadFilesActivity.java index 9341dd06,070d7b99..f93af1f3 --- a/src/com/owncloud/android/ui/activity/UploadFilesActivity.java +++ b/src/com/owncloud/android/ui/activity/UploadFilesActivity.java @@@ -21,8 -21,6 +21,8 @@@ package com.owncloud.android.ui.activity; import android.accounts.Account; +import android.app.AlertDialog; +import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.os.AsyncTask; @@@ -31,17 -29,17 +31,19 @@@ import android.os.Environment import android.preference.PreferenceManager; import android.support.v4.app.DialogFragment; import android.support.v7.app.ActionBar; +import android.view.Menu; +import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Button; + import android.widget.RadioButton; import android.widget.TextView; import com.owncloud.android.R; + import com.owncloud.android.files.services.FileUploader; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.ui.dialog.ConfirmationDialogFragment; import com.owncloud.android.ui.dialog.ConfirmationDialogFragment.ConfirmationDialogFragmentListener; @@@ -79,8 -77,10 +81,10 @@@ public class UploadFilesActivity extend private static final String TAG = "UploadFilesActivity"; private static final String WAIT_DIALOG_TAG = "WAIT"; private static final String QUERY_TO_MOVE_DIALOG_TAG = "QUERY_TO_MOVE"; - - + private RadioButton mRadioBtnCopyFiles; + private RadioButton mRadioBtnMoveFiles; + + @Override public void onCreate(Bundle savedInstanceState) { Log_OC.d(TAG, "onCreate() start"); @@@ -118,6 -118,21 +122,21 @@@ mCancelBtn.setOnClickListener(this); mUploadBtn = (Button) findViewById(R.id.upload_files_btn_upload); mUploadBtn.setOnClickListener(this); + + SharedPreferences appPreferences = PreferenceManager + .getDefaultSharedPreferences(getApplicationContext()); + + Integer localBehaviour = appPreferences.getInt("prefs_uploader_behaviour", FileUploader.LOCAL_BEHAVIOUR_COPY); + + mRadioBtnMoveFiles = (RadioButton) findViewById(R.id.upload_radio_move); + if (localBehaviour == FileUploader.LOCAL_BEHAVIOUR_MOVE){ + mRadioBtnMoveFiles.setChecked(true); + } + + mRadioBtnCopyFiles = (RadioButton) findViewById(R.id.upload_radio_copy); + if (localBehaviour == FileUploader.LOCAL_BEHAVIOUR_COPY){ + mRadioBtnCopyFiles.setChecked(true); + } // Action bar setup @@@ -138,13 -153,6 +157,13 @@@ Log_OC.d(TAG, "onCreate() end"); } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.uploader_menu, menu); + return true; + } + @Override public boolean onOptionsItemSelected(MenuItem item) { @@@ -156,34 -164,6 +175,34 @@@ } break; } + case R.id.action_sort: { + SharedPreferences appPreferences = PreferenceManager + .getDefaultSharedPreferences(this); + + // Read sorting order, default to sort by name ascending + Integer sortOrder = appPreferences + .getInt("sortOrder", FileStorageUtils.SORT_NAME); + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle(R.string.actionbar_sort_title) + .setSingleChoiceItems(R.array.actionbar_sortby, sortOrder , + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + switch (which){ + case 0: + mFileListFragment.sortByName(true); + break; + case 1: + mFileListFragment.sortByDate(false); + break; + } + + dialog.dismiss(); + } + }); + builder.create().show(); + break; + } default: retval = super.onOptionsItemSelected(item); } @@@ -383,9 -363,22 +402,22 @@@ // return the list of selected files (success) Intent data = new Intent(); data.putExtra(EXTRA_CHOSEN_FILES, mFileListFragment.getCheckedFilePaths()); - setResult(RESULT_OK, data); + + SharedPreferences.Editor appPreferencesEditor = PreferenceManager + .getDefaultSharedPreferences(getApplicationContext()).edit(); + + + if (mRadioBtnMoveFiles.isChecked()){ + setResult(RESULT_OK_AND_MOVE, data); + appPreferencesEditor.putInt("prefs_uploader_behaviour", + FileUploader.LOCAL_BEHAVIOUR_MOVE); + } else { + setResult(RESULT_OK, data); + appPreferencesEditor.putInt("prefs_uploader_behaviour", + FileUploader.LOCAL_BEHAVIOUR_COPY); + } + appPreferencesEditor.apply(); finish(); - } else { // show a dialog to query the user if wants to move the selected files // to the ownCloud folder instead of copying