diff --git a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java index e87cfce616..d4d7132848 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -885,11 +885,12 @@ public class FileDisplayActivity extends FileActivity FileUploader.LOCAL_BEHAVIOUR_DELETE); } } - }, new String[]{FileOperationsHelper.createImageFile(getActivity()).getAbsolutePath()}).execute(); + }, new String[] { FileOperationsHelper.createImageFile(getActivity()).getAbsolutePath() }).execute(); } else if (requestCode == REQUEST_CODE__MOVE_OR_COPY_FILES && resultCode == RESULT_OK) { exitSelectionMode(); - final Intent fData = data; - getHandler().postDelayed(() -> requestMoveOrCopyOperation(fData), DELAY_TO_REQUEST_OPERATIONS_LATER); + // TODO check this implementation + // final Intent fData = data; + // getHandler().postDelayed(() -> requestMoveOrCopyOperation(fData), DELAY_TO_REQUEST_OPERATIONS_LATER); } else if (requestCode == PermissionUtil.REQUEST_CODE_MANAGE_ALL_FILES) { syncAndUpdateFolder(true); } else { @@ -996,12 +997,15 @@ public class FileDisplayActivity extends FileActivity } - private void requestMoveOrCopyOperation(Intent data) { + /* + private void requestMoveOrCopyOperation(Intent data) { final OCFile file = data.getParcelableExtra(FolderPickerActivity.EXTRA_FOLDER); final List filePaths = data.getStringArrayListExtra(FolderPickerActivity.EXTRA_FILE_PATHS); assert filePaths != null; getFileOperationsHelper().moveOrCopyFiles(filePaths, file); } + */ + private boolean isSearchOpen() { if (searchView == null) { diff --git a/app/src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.kt b/app/src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.kt index b2154644c4..1c259ac0e0 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.kt +++ b/app/src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.kt @@ -27,7 +27,9 @@ import android.content.Intent import android.content.IntentFilter import android.content.res.Resources import android.os.Bundle +import android.os.Parcel import android.os.Parcelable +import android.util.Log import android.view.ActionMode import android.view.Menu import android.view.MenuItem @@ -44,6 +46,7 @@ import com.owncloud.android.lib.common.utils.Log_OC import com.owncloud.android.lib.resources.files.SearchRemoteOperation import com.owncloud.android.operations.CreateFolderOperation import com.owncloud.android.operations.RefreshFolderOperation +import com.owncloud.android.services.OperationsService import com.owncloud.android.syncadapter.FileSyncAdapter import com.owncloud.android.ui.dialog.CreateFolderDialogFragment import com.owncloud.android.ui.dialog.SortingOrderDialogFragment.OnSortingOrderListener @@ -378,12 +381,13 @@ open class FolderPickerActivity : mCopyBtn = findViewById(R.id.btnCopy) mMoveBtn = findViewById(R.id.btnMove) + // FIXME colorMaterialButtonPrimaryFilled breaks material button style if (mCopyBtn != null) { - viewThemeUtils.material.colorMaterialButtonPrimaryFilled(mCopyBtn!!) + //viewThemeUtils.material.colorMaterialButtonPrimaryFilled(mCopyBtn!!) mCopyBtn!!.setOnClickListener(this) } if (mMoveBtn != null) { - viewThemeUtils.material.colorMaterialButtonPrimaryFilled(mMoveBtn!!) + //viewThemeUtils.material.colorMaterialButtonPrimaryFilled(mMoveBtn!!) mMoveBtn!!.setOnClickListener(this) } if (mCancelBtn != null) { @@ -407,7 +411,16 @@ open class FolderPickerActivity : if (targetFiles != null) { resultData.putParcelableArrayListExtra(EXTRA_FILES, targetFiles) } + mTargetFilePaths.let { + if (it != null) { + if (v == mCopyBtn) { + fileOperationsHelper.moveOrCopyFiles(OperationsService.ACTION_COPY_FILE, it, file) + } else { + fileOperationsHelper.moveOrCopyFiles(OperationsService.ACTION_MOVE_FILE, it, file) + } + } + resultData.putStringArrayListExtra(EXTRA_FILE_PATHS, it) } setResult(RESULT_OK, resultData) diff --git a/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java b/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java index afb8acf794..9539c788ad 100755 --- a/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java +++ b/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java @@ -42,6 +42,7 @@ import android.os.Environment; import android.os.StatFs; import android.provider.MediaStore; import android.text.TextUtils; +import android.util.Log; import android.view.View; import android.webkit.MimeTypeMap; @@ -1007,10 +1008,10 @@ public class FileOperationsHelper { } } - public void moveOrCopyFiles(final List filePaths, final OCFile targetFolder) { + public void moveOrCopyFiles(String action, final List filePaths, final OCFile targetFolder) { for (String path : filePaths) { Intent service = new Intent(fileActivity, OperationsService.class); - //service.setAction(OperationsService.ACTION_MOVE_OR_COPY_FILE); + service.setAction(action); service.putExtra(OperationsService.EXTRA_NEW_PARENT_PATH, targetFolder.getRemotePath()); service.putExtra(OperationsService.EXTRA_REMOTE_PATH, path); service.putExtra(OperationsService.EXTRA_ACCOUNT, fileActivity.getAccount()); @@ -1019,7 +1020,6 @@ public class FileOperationsHelper { fileActivity.showLoadingDialog(fileActivity.getString(R.string.wait_a_moment)); } - public void exportFiles(Collection files, Context context, View view,