From ff23ac8da6564f07476fb1fd69349bccec1bf213 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 5 Nov 2016 20:45:41 +0100 Subject: [PATCH] if paths are on different storage at Move, lets just copy --- .../filemanager/dialogs/CopyDialog.kt | 11 +++++++++-- .../filemanager/extensions/context.kt | 4 +--- app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-pt-rPT/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 8 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/CopyDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/CopyDialog.kt index 58af1e2e..b0426948 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/CopyDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/CopyDialog.kt @@ -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, 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, 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, File>(files, destinationDir) CopyTask(copyListener, mContext).execute(pair) dismiss() @@ -75,6 +77,11 @@ class CopyDialog(val activity: Activity, val files: List, val path: String dismiss() listener.onSuccess() + } else { + context.toast(R.string.copying_no_delete, Toast.LENGTH_LONG) + val pair = Pair, File>(files, destinationDir) + CopyTask(copyListener, mContext).execute(pair) + dismiss() } } }) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/extensions/context.kt index 5c3fd08a..833a50f5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/extensions/context.kt @@ -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) { diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index ec91357f..3c42444e 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -32,6 +32,7 @@ Source and destination cannot be the same Konnte die Datei nicht kopieren Kopiere + Copying, please delete source files manually home OK Abbrechen diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 6081f956..b8914983 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -32,6 +32,7 @@ Source and destination cannot be the same Impossibile copiare i file Copia in corso + Copying, please delete source files manually home OK Annulla diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 2018d526..97d25cf4 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -32,6 +32,7 @@ Source and destination cannot be the same ファイルをコピーできませんでした コピー中 + Copying, please delete source files manually ホーム OK Cancel diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index f926f3f1..6ca134ca 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -32,6 +32,7 @@ Source and destination cannot be the same Não foi possível copiar os ficheiros A copiar + Copying, please delete source files manually início OK Cancelar diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index ed01aa17..74e57b99 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -32,6 +32,7 @@ Source and destination cannot be the same Kunde inte kopiera filen Kopierar + Copying, please delete source files manually home OK Cancel diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6d3170f5..c73ad79c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -32,6 +32,7 @@ Source and destination cannot be the same Could not copy the files Copying + Copying, please delete source files manually home OK Cancel