<RadioButton\r
android:layout_width="wrap_content"\r
android:layout_height="wrap_content"\r
- android:text="copy"\r
- android:id="@+id/mBtnCopy"\r
+ android:text="@string/upload_copy_files"\r
+ android:id="@+id/upload_radio_copy"\r
android:layout_weight="1"\r
- android:checked="true" />\r
+ android:checked="false" />\r
\r
<RadioButton\r
android:layout_width="wrap_content"\r
android:layout_height="wrap_content"\r
- android:text="move"\r
- android:id="@+id/mBtnMove"\r
+ android:text="@string/upload_move_files"\r
+ android:id="@+id/upload_radio_move"\r
android:layout_weight="1"\r
android:checked="false" />\r
</RadioGroup>\r
import android.accounts.Account;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
+import android.preference.PreferenceManager;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.ActionBar;
import android.view.MenuItem;
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;
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");
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
// 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