update the copy/move process a bit

This commit is contained in:
tibbi 2016-11-12 17:49:23 +01:00
parent 44465393f5
commit 868a76f137
8 changed files with 11 additions and 15 deletions

View File

@ -5,7 +5,6 @@ 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.filemanager.Config import com.simplemobiletools.filemanager.Config
import com.simplemobiletools.filemanager.fragments.ItemsFragment
import com.simplemobiletools.filepicker.extensions.getFileDocument import com.simplemobiletools.filepicker.extensions.getFileDocument
import com.simplemobiletools.filepicker.extensions.needsStupidWritePermissions import com.simplemobiletools.filepicker.extensions.needsStupidWritePermissions
import com.simplemobiletools.filepicker.extensions.scanFile import com.simplemobiletools.filepicker.extensions.scanFile
@ -134,14 +133,14 @@ class CopyTask(listener: CopyTask.CopyListener, val context: Context, val delete
val listener = mListener?.get() ?: return val listener = mListener?.get() ?: return
if (success) { if (success) {
listener.copySucceeded(if (deleteAfterCopy) ItemsFragment.ACTION_MOVE else ItemsFragment.ACTION_COPY) listener.copySucceeded(deleteAfterCopy)
} else { } else {
listener.copyFailed() listener.copyFailed()
} }
} }
interface CopyListener { interface CopyListener {
fun copySucceeded(action: Int) fun copySucceeded(deleted: Boolean)
fun copyFailed() fun copyFailed()
} }

View File

@ -68,9 +68,6 @@ public class ItemsFragment extends android.support.v4.app.Fragment
private boolean mShowHidden; private boolean mShowHidden;
private int mSelectedItemsCnt; private int mSelectedItemsCnt;
public static int ACTION_COPY = 1;
public static int ACTION_MOVE = 2;
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -485,14 +482,14 @@ public class ItemsFragment extends android.support.v4.app.Fragment
} }
@Override @Override
public void copySucceeded(int action) { public void copySucceeded(boolean deleted) {
fillItems(); fillItems();
Utils.Companion.showToast(getContext(), action == ACTION_COPY ? R.string.copying_success : R.string.moving_success); Utils.Companion.showToast(getContext(), deleted ? R.string.moving_success : R.string.copying_success);
} }
@Override @Override
public void copyFailed() { public void copyFailed() {
Utils.Companion.showToast(getContext(), R.string.copying_failed); Utils.Companion.showToast(getContext(), R.string.copy_move_failed);
} }
public interface ItemInteractionListener { public interface ItemInteractionListener {

View File

@ -32,7 +32,7 @@
<string name="source_and_destination_same">Source and destination cannot be the same</string> <string name="source_and_destination_same">Source and destination cannot be the same</string>
<string name="copying">Kopiere</string> <string name="copying">Kopiere</string>
<string name="copying_success">Files copied successfully</string> <string name="copying_success">Files copied successfully</string>
<string name="copying_failed">Konnte die Datei nicht kopieren</string> <string name="copy_move_failed">Konnte die Datei nicht kopieren</string>
<string name="moving">Moving</string> <string name="moving">Moving</string>
<string name="moving_success">Files moved successfully</string> <string name="moving_success">Files moved successfully</string>
<string name="already_exists">A file with that name already exists</string> <string name="already_exists">A file with that name already exists</string>

View File

@ -32,7 +32,7 @@
<string name="source_and_destination_same">Source and destination cannot be the same</string> <string name="source_and_destination_same">Source and destination cannot be the same</string>
<string name="copying">Copia in corso</string> <string name="copying">Copia in corso</string>
<string name="copying_success">Files copied successfully</string> <string name="copying_success">Files copied successfully</string>
<string name="copying_failed">Impossibile copiare i file</string> <string name="copy_move_failed">Impossibile copiare i file</string>
<string name="moving">Moving</string> <string name="moving">Moving</string>
<string name="moving_success">Files moved successfully</string> <string name="moving_success">Files moved successfully</string>
<string name="already_exists">A file with that name already exists</string> <string name="already_exists">A file with that name already exists</string>

View File

@ -32,7 +32,7 @@
<string name="source_and_destination_same">Source and destination cannot be the same</string> <string name="source_and_destination_same">Source and destination cannot be the same</string>
<string name="copying">コピー中</string> <string name="copying">コピー中</string>
<string name="copying_success">Files copied successfully</string> <string name="copying_success">Files copied successfully</string>
<string name="copying_failed">ファイルをコピーできませんでした</string> <string name="copy_move_failed">ファイルをコピーできませんでした</string>
<string name="moving">Moving</string> <string name="moving">Moving</string>
<string name="moving_success">Files moved successfully</string> <string name="moving_success">Files moved successfully</string>
<string name="already_exists">A file with that name already exists</string> <string name="already_exists">A file with that name already exists</string>

View File

@ -32,7 +32,7 @@
<string name="source_and_destination_same">A origem e o destino não podem ser iguais</string> <string name="source_and_destination_same">A origem e o destino não podem ser iguais</string>
<string name="copying">A copiar</string> <string name="copying">A copiar</string>
<string name="copying_success">Ficheiros copiados com sucesso</string> <string name="copying_success">Ficheiros copiados com sucesso</string>
<string name="copying_failed">Não foi possível copiar os ficheiros</string> <string name="copy_move_failed">Não foi possível copiar os ficheiros</string>
<string name="moving">A mover</string> <string name="moving">A mover</string>
<string name="moving_success">Ficheiros movidos com sucesso</string> <string name="moving_success">Ficheiros movidos com sucesso</string>
<string name="already_exists">Já existe um ficheiro com este nome</string> <string name="already_exists">Já existe um ficheiro com este nome</string>

View File

@ -32,7 +32,7 @@
<string name="source_and_destination_same">Source and destination cannot be the same</string> <string name="source_and_destination_same">Source and destination cannot be the same</string>
<string name="copying">Kopierar</string> <string name="copying">Kopierar</string>
<string name="copying_success">Files copied successfully</string> <string name="copying_success">Files copied successfully</string>
<string name="copying_failed">Kunde inte kopiera filen</string> <string name="copy_move_failed">Kunde inte kopiera filen</string>
<string name="moving">Moving</string> <string name="moving">Moving</string>
<string name="moving_success">Files moved successfully</string> <string name="moving_success">Files moved successfully</string>
<string name="already_exists">A file with that name already exists</string> <string name="already_exists">A file with that name already exists</string>

View File

@ -32,7 +32,7 @@
<string name="source_and_destination_same">Source and destination cannot be the same</string> <string name="source_and_destination_same">Source and destination cannot be the same</string>
<string name="copying">Copying</string> <string name="copying">Copying</string>
<string name="copying_success">Files copied successfully</string> <string name="copying_success">Files copied successfully</string>
<string name="copying_failed">An error occurred</string> <string name="copy_move_failed">An error occurred</string>
<string name="moving">Moving</string> <string name="moving">Moving</string>
<string name="moving_success">Files moved successfully</string> <string name="moving_success">Files moved successfully</string>
<string name="already_exists">A file with that name already exists</string> <string name="already_exists">A file with that name already exists</string>