diff --git a/app/build.gradle b/app/build.gradle index 59547752c..66366e3b9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -78,7 +78,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:94718a76cb' + implementation 'com.github.SimpleMobileTools:Simple-Commons:5c4094baf8' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.22' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt index 88241ab2e..caf048394 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt @@ -67,7 +67,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList() - private var isChangingOrder = false + private var isDragAndDropping = false private var startReorderDragListener: StartReorderDragListener private var showMediaCount = config.showFolderMediaCount @@ -111,6 +111,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList moveSelectedItemsToTop() + R.id.cab_move_to_bottom -> moveSelectedItemsToBottom() R.id.cab_properties -> showProperties() R.id.cab_rename -> renameDir() R.id.cab_pin -> pinFolders(true) @@ -173,7 +179,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList + val position = dirs.indexOfFirst { it.path.hashCode() == key } + val tempItem = dirs[position] + dirs.removeAt(position) + dirs.add(0, tempItem) + } + + notifyDataSetChanged() + } + + private fun moveSelectedItemsToBottom() { + selectedKeys.forEach { key -> + val position = dirs.indexOfFirst { it.path.hashCode() == key } + val tempItem = dirs[position] + dirs.removeAt(position) + dirs.add(dirs.size, tempItem) + } + + notifyDataSetChanged() + } + private fun showProperties() { if (selectedKeys.size <= 1) { val path = getFirstSelectedItemPath() ?: return @@ -463,8 +491,9 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList if (event.action == MotionEvent.ACTION_DOWN) { diff --git a/app/src/main/res/menu/cab_directories.xml b/app/src/main/res/menu/cab_directories.xml index b1265795e..196107fda 100644 --- a/app/src/main/res/menu/cab_directories.xml +++ b/app/src/main/res/menu/cab_directories.xml @@ -1,6 +1,16 @@ + +