Skip to content

Commit 7114f33

Browse files
committed
Move or Copy files: Start in the parent folder instead of root
Previous behavior always moved up to the root folder, which meant the user lost the context of their current files. Especially in complicated nested folder structures, this made standard operations overly complicated, like duplicating in the same folder or duplicating/moving to a sibling folder. This is now also in sync with the behavior of the iOS app and the web UI Signed-off-by: Philipp Hasper <[email protected]>
1 parent 3479e47 commit 7114f33

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

app/src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.kt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import androidx.lifecycle.lifecycleScope
2525
import androidx.localbroadcastmanager.content.LocalBroadcastManager
2626
import com.nextcloud.client.account.User
2727
import com.nextcloud.client.di.Injectable
28+
import com.nextcloud.utils.extensions.getParcelableArgument
2829
import com.nextcloud.utils.fileNameValidator.FileNameValidator
2930
import com.owncloud.android.R
3031
import com.owncloud.android.databinding.FilesFolderPickerBinding
@@ -275,8 +276,13 @@ open class FolderPickerActivity :
275276
super.onResume()
276277
Log_OC.e(TAG, "onResume() start")
277278

278-
refreshListOfFilesFragment(false)
279-
file = listOfFilesFragment?.currentFile
279+
val extraFolder = intent.getParcelableArgument(EXTRA_FOLDER.toString(), OCFile::class.java)
280+
if (extraFolder != null) {
281+
file = extraFolder
282+
} else {
283+
file = listOfFilesFragment?.currentFile
284+
}
285+
refreshListOfFilesFragment(file, false)
280286
updateUiElements()
281287

282288
val intentFilter = getSyncIntentFilter()
@@ -351,8 +357,8 @@ open class FolderPickerActivity :
351357
}
352358
}
353359

354-
private fun refreshListOfFilesFragment(fromSearch: Boolean) {
355-
listOfFilesFragment?.listDirectory(false, fromSearch)
360+
private fun refreshListOfFilesFragment(directory: OCFile, fromSearch: Boolean) {
361+
listOfFilesFragment?.listDirectory(directory, false, fromSearch)
356362
}
357363

358364
fun browseToRoot() {

app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,8 @@ private void pickFolderForMoveOrCopy(final Set<OCFile> checkedFiles) {
14371437
paths.add(file.getRemotePath());
14381438
}
14391439
action.putStringArrayListExtra(FolderPickerActivity.EXTRA_FILE_PATHS, paths);
1440+
action.putExtra(FolderPickerActivity.EXTRA_FOLDER, getCurrentFile());
1441+
action.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); // No animation since we stay in the same folder
14401442
action.putExtra(FolderPickerActivity.EXTRA_ACTION, extraAction);
14411443
getActivity().startActivityForResult(action, requestCode);
14421444
}

0 commit comments

Comments
 (0)