reimplement copy and move at folder and thumbnail views

This commit is contained in:
tibbi 2017-04-01 18:29:39 +02:00
parent bc54d58dbe
commit ed59c51b99
3 changed files with 21 additions and 7 deletions

View file

@ -32,7 +32,7 @@ android {
}
dependencies {
compile 'com.simplemobiletools:commons:2.14.9'
compile 'com.simplemobiletools:commons:2.15.0'
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1'
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'

View file

@ -224,7 +224,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
actMode?.finish()
}
private fun displayCopyDialog() {
private fun copyMoveTo(isCopyOperation: Boolean) {
val files = ArrayList<File>()
val positions = multiSelector.selectedPositions
if (positions.isEmpty())
@ -234,14 +234,21 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
val dir = File(dirs[it].path)
files.addAll(dir.listFiles().filter { it.isFile && it.isImageVideoGif() })
}
activity.copyMoveFilesTo(files, isCopyOperation) {
if (!isCopyOperation) {
listener?.refreshItems()
}
actMode?.finish()
}
}
private fun copyTo() {
copyMoveTo(true)
}
private fun moveTo() {
copyMoveTo(false)
}
fun selectAll() {

View file

@ -137,18 +137,25 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
}
}
private fun displayCopyDialog() {
private fun copyMoveTo(isCopyOperation: Boolean) {
val files = ArrayList<File>()
val positions = multiSelector.selectedPositions
positions.forEach { files.add(File(media[it].path)) }
activity.copyMoveFilesTo(files, isCopyOperation) {
if (!isCopyOperation) {
listener?.refreshItems()
}
actMode?.finish()
}
}
private fun copyTo() {
copyMoveTo(true)
}
private fun moveTo() {
copyMoveTo(false)
}
fun selectAll() {