refresh the directories view after copying
This commit is contained in:
parent
c176959305
commit
beba22b764
|
@ -592,7 +592,7 @@ public class MainActivity extends SimpleActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void copySucceeded(@NotNull File destinationDir) {
|
public void copySucceeded(@NotNull File destinationDir) {
|
||||||
|
getDirectories();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.os.AsyncTask
|
||||||
import android.support.v4.util.Pair
|
import android.support.v4.util.Pair
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.simplemobiletools.gallery.Utils
|
import com.simplemobiletools.gallery.Utils
|
||||||
|
import com.simplemobiletools.gallery.extensions.scanFile
|
||||||
import java.io.*
|
import java.io.*
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
|
|
||||||
|
@ -87,6 +88,8 @@ class CopyTask(listener: CopyTask.CopyDoneListener, val context: Context) : Asyn
|
||||||
out = FileOutputStream(destination)
|
out = FileOutputStream(destination)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val paths = arrayOf(destination.absolutePath)
|
||||||
|
context.scanFile(paths)
|
||||||
copyStream(inputStream, out)
|
copyStream(inputStream, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ import com.simplemobiletools.gallery.Utils
|
||||||
import com.simplemobiletools.gallery.asynctasks.CopyTask
|
import com.simplemobiletools.gallery.asynctasks.CopyTask
|
||||||
import com.simplemobiletools.gallery.extensions.scanFile
|
import com.simplemobiletools.gallery.extensions.scanFile
|
||||||
import com.simplemobiletools.gallery.extensions.toast
|
import com.simplemobiletools.gallery.extensions.toast
|
||||||
import com.simplemobiletools.gallery.extensions.value
|
|
||||||
import kotlinx.android.synthetic.main.copy_item.view.*
|
import kotlinx.android.synthetic.main.copy_item.view.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -21,10 +20,10 @@ class CopyDialog(val activity: Activity, val files: List<File>, val copyListener
|
||||||
init {
|
init {
|
||||||
val context = activity
|
val context = activity
|
||||||
val view = LayoutInflater.from(context).inflate(R.layout.copy_item, null)
|
val view = LayoutInflater.from(context).inflate(R.layout.copy_item, null)
|
||||||
val path = files[0].parent.trimEnd('/')
|
val sourcePath = files[0].parent.trimEnd('/')
|
||||||
var destinationPath = ""
|
var destinationPath = ""
|
||||||
|
|
||||||
view.source.text = context.humanizePath(path)
|
view.source.text = context.humanizePath(sourcePath)
|
||||||
|
|
||||||
view.destination.setOnClickListener {
|
view.destination.setOnClickListener {
|
||||||
PickAlbumDialog(activity, object : PickAlbumDialog.OnPickAlbumListener {
|
PickAlbumDialog(activity, object : PickAlbumDialog.OnPickAlbumListener {
|
||||||
|
@ -78,7 +77,7 @@ class CopyDialog(val activity: Activity, val files: List<File>, val copyListener
|
||||||
CopyTask(copyListener, context).execute(pair)
|
CopyTask(copyListener, context).execute(pair)
|
||||||
dismiss()
|
dismiss()
|
||||||
} else {
|
} else {
|
||||||
if (Utils.isPathOnSD(context, view.source.value) && Utils.isPathOnSD(context, destinationPath)) {
|
if (Utils.isPathOnSD(context, sourcePath) && Utils.isPathOnSD(context, destinationPath)) {
|
||||||
val paths = ArrayList<String>()
|
val paths = ArrayList<String>()
|
||||||
for (f in files) {
|
for (f in files) {
|
||||||
val destination = File(destinationDir, f.name)
|
val destination = File(destinationDir, f.name)
|
||||||
|
|
Loading…
Reference in New Issue