notify the user when the copy fails or succeeds

This commit is contained in:
tibbi 2016-11-10 20:02:06 +01:00
parent dfae308cc7
commit a971b215a5
11 changed files with 22 additions and 7 deletions

View file

@ -18,10 +18,10 @@ import android.util.DisplayMetrics
import android.util.TypedValue import android.util.TypedValue
import android.view.* import android.view.*
import android.webkit.MimeTypeMap import android.webkit.MimeTypeMap
import android.widget.Toast
import com.simplemobiletools.filepicker.extensions.getSDCardPath import com.simplemobiletools.filepicker.extensions.getSDCardPath
import com.simplemobiletools.gallery.dialogs.WritePermissionDialog import com.simplemobiletools.gallery.dialogs.WritePermissionDialog
import com.simplemobiletools.gallery.extensions.scanFile import com.simplemobiletools.gallery.extensions.scanFile
import com.simplemobiletools.gallery.extensions.toast
import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.models.Medium
import java.io.File import java.io.File
@ -32,7 +32,7 @@ class Utils {
} }
fun showToast(context: Context, resId: Int) { fun showToast(context: Context, resId: Int) {
Toast.makeText(context, context.resources.getString(resId), Toast.LENGTH_SHORT).show() context.toast(resId)
} }
fun getActionBarHeight(context: Context, res: Resources): Int { fun getActionBarHeight(context: Context, res: Resources): Int {

View file

@ -595,10 +595,11 @@ public class MainActivity extends SimpleActivity
@Override @Override
public void copySucceeded(@NotNull File destinationDir) { public void copySucceeded(@NotNull File destinationDir) {
getDirectories(); getDirectories();
Utils.Companion.showToast(getApplicationContext(), R.string.copying_success);
} }
@Override @Override
public void copyFailed() { public void copyFailed() {
Utils.Companion.showToast(getApplicationContext(), R.string.copying_failed);
} }
} }

View file

@ -552,11 +552,11 @@ public class MediaActivity extends SimpleActivity
@Override @Override
public void copySucceeded(@NotNull File destinationDir) { public void copySucceeded(@NotNull File destinationDir) {
Utils.Companion.showToast(getApplicationContext(), R.string.copying_success);
} }
@Override @Override
public void copyFailed() { public void copyFailed() {
Utils.Companion.showToast(getApplicationContext(), R.string.copying_failed);
} }
} }

View file

@ -505,11 +505,11 @@ public class ViewPagerActivity extends SimpleActivity
@Override @Override
public void copySucceeded(@NotNull File destinationDir) { public void copySucceeded(@NotNull File destinationDir) {
Utils.Companion.showToast(getApplicationContext(), R.string.copying_success);
} }
@Override @Override
public void copyFailed() { public void copyFailed() {
Utils.Companion.showToast(getApplicationContext(), R.string.copying_failed);
} }
} }

View file

@ -53,6 +53,8 @@
<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="copy_failed">Konnte die Datei nicht kopieren</string> <string name="copy_failed">Konnte die Datei nicht kopieren</string>
<string name="copying">Kopiere</string> <string name="copying">Kopiere</string>
<string name="copying_success">Files copied successfully</string>
<string name="copying_failed">An error occurred during the copy</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>
<plurals name="folders_deleted"> <plurals name="folders_deleted">

View file

@ -53,6 +53,8 @@
<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="copy_failed">Could not copy the files</string> <string name="copy_failed">Could not copy the files</string>
<string name="copying">Copying</string> <string name="copying">Copying</string>
<string name="copying_success">Files copied successfully</string>
<string name="copying_failed">An error occurred during the copy</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>
<plurals name="folders_deleted"> <plurals name="folders_deleted">

View file

@ -53,6 +53,8 @@
<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="copy_failed">Impossibile copiare i file</string> <string name="copy_failed">Impossibile copiare i file</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_failed">An error occurred during the copy</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>
<plurals name="folders_deleted"> <plurals name="folders_deleted">

View file

@ -53,6 +53,8 @@
<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="copy_failed">ファイルをコピーできませんでした</string> <string name="copy_failed">ファイルをコピーできませんでした</string>
<string name="copying">コピー中</string> <string name="copying">コピー中</string>
<string name="copying_success">Files copied successfully</string>
<string name="copying_failed">An error occurred during the copy</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>
<plurals name="folders_deleted"> <plurals name="folders_deleted">

View file

@ -53,6 +53,8 @@
<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="copy_failed">Não foi possível copiar os ficheiros</string> <string name="copy_failed">Não foi possível copiar os ficheiros</string>
<string name="copying">A copiar</string> <string name="copying">A copiar</string>
<string name="copying_success">Files copied successfully</string>
<string name="copying_failed">An error occurred during the copy</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>
<plurals name="folders_deleted"> <plurals name="folders_deleted">

View file

@ -53,6 +53,8 @@
<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="copy_failed">Kunde inte kopiera filen</string> <string name="copy_failed">Kunde inte kopiera filen</string>
<string name="copying">Kopierar</string> <string name="copying">Kopierar</string>
<string name="copying_success">Files copied successfully</string>
<string name="copying_failed">An error occurred during the copy</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>
<plurals name="folders_deleted"> <plurals name="folders_deleted">

View file

@ -53,6 +53,8 @@
<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="copy_failed">Could not copy the files</string> <string name="copy_failed">Could not copy the files</string>
<string name="copying">Copying</string> <string name="copying">Copying</string>
<string name="copying_success">Files copied successfully</string>
<string name="copying_failed">An error occurred during the copy</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>
<plurals name="folders_deleted"> <plurals name="folders_deleted">