if paths are on different storage at Move, lets just copy

This commit is contained in:
tibbi 2016-11-05 20:45:41 +01:00
parent 119db82a16
commit ff23ac8da6
8 changed files with 16 additions and 5 deletions

View File

@ -5,6 +5,7 @@ import android.support.v4.util.Pair
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.WindowManager
import android.widget.Toast
import com.simplemobiletools.filemanager.Config
import com.simplemobiletools.filemanager.R
import com.simplemobiletools.filemanager.Utils
@ -18,13 +19,14 @@ import java.io.File
class CopyDialog(val activity: Activity, val files: List<File>, val path: String, val copyListener: CopyTask.CopyListener, val listener: OnCopyListener) {
val mContext = activity
init {
val view = LayoutInflater.from(mContext).inflate(R.layout.copy_item, null)
view.source.text = "$path/"
view.destination.setOnClickListener {
val config = Config.newInstance(mContext)
FilePickerDialog(activity, path, false, config.showHidden, false, object: FilePickerDialog.OnFilePickerListener {
FilePickerDialog(activity, path, false, config.showHidden, false, object : FilePickerDialog.OnFilePickerListener {
override fun onFail(error: FilePickerDialog.FilePickerResult) {
}
@ -61,7 +63,7 @@ class CopyDialog(val activity: Activity, val files: List<File>, val path: String
}
if (view.dialog_radio_group.checkedRadioButtonId == R.id.dialog_radio_copy) {
Utils.showToast(context, R.string.copying)
context.toast(R.string.copying)
val pair = Pair<List<File>, File>(files, destinationDir)
CopyTask(copyListener, mContext).execute(pair)
dismiss()
@ -75,6 +77,11 @@ class CopyDialog(val activity: Activity, val files: List<File>, val path: String
dismiss()
listener.onSuccess()
} else {
context.toast(R.string.copying_no_delete, Toast.LENGTH_LONG)
val pair = Pair<List<File>, File>(files, destinationDir)
CopyTask(copyListener, mContext).execute(pair)
dismiss()
}
}
})

View File

@ -5,9 +5,7 @@ import android.media.MediaScannerConnection
import android.widget.Toast
import java.io.File
fun Context.toast(id: Int) = Toast.makeText(this, resources.getString(id), Toast.LENGTH_SHORT).show()
fun Context.toast(message: String) = Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
fun Context.toast(id: Int, length: Int = Toast.LENGTH_SHORT) = Toast.makeText(this, resources.getString(id), length).show()
fun Context.rescanItem(item: File) {
if (item.isDirectory) {

View File

@ -32,6 +32,7 @@
<string name="source_and_destination_same">Source and destination cannot be the same</string>
<string name="copy_failed">Konnte die Datei nicht kopieren</string>
<string name="copying">Kopiere</string>
<string name="copying_no_delete">Copying, please delete source files manually</string>
<string name="initial_breadcrumb">home</string>
<string name="ok">OK</string>
<string name="cancel">Abbrechen</string>

View File

@ -32,6 +32,7 @@
<string name="source_and_destination_same">Source and destination cannot be the same</string>
<string name="copy_failed">Impossibile copiare i file</string>
<string name="copying">Copia in corso</string>
<string name="copying_no_delete">Copying, please delete source files manually</string>
<string name="initial_breadcrumb">home</string>
<string name="ok">OK</string>
<string name="cancel">Annulla</string>

View File

@ -32,6 +32,7 @@
<string name="source_and_destination_same">Source and destination cannot be the same</string>
<string name="copy_failed">ファイルをコピーできませんでした</string>
<string name="copying">コピー中</string>
<string name="copying_no_delete">Copying, please delete source files manually</string>
<string name="initial_breadcrumb">ホーム</string>
<string name="ok">OK</string>
<string name="cancel">Cancel</string>

View File

@ -32,6 +32,7 @@
<string name="source_and_destination_same">Source and destination cannot be the same</string>
<string name="copy_failed">Não foi possível copiar os ficheiros</string>
<string name="copying">A copiar</string>
<string name="copying_no_delete">Copying, please delete source files manually</string>
<string name="initial_breadcrumb">início</string>
<string name="ok">OK</string>
<string name="cancel">Cancelar</string>

View File

@ -32,6 +32,7 @@
<string name="source_and_destination_same">Source and destination cannot be the same</string>
<string name="copy_failed">Kunde inte kopiera filen</string>
<string name="copying">Kopierar</string>
<string name="copying_no_delete">Copying, please delete source files manually</string>
<string name="initial_breadcrumb">home</string>
<string name="ok">OK</string>
<string name="cancel">Cancel</string>

View File

@ -32,6 +32,7 @@
<string name="source_and_destination_same">Source and destination cannot be the same</string>
<string name="copy_failed">Could not copy the files</string>
<string name="copying">Copying</string>
<string name="copying_no_delete">Copying, please delete source files manually</string>
<string name="initial_breadcrumb">home</string>
<string name="ok">OK</string>
<string name="cancel">Cancel</string>