let the user know if not all files have been copied/moved

This commit is contained in:
tibbi 2016-11-12 21:33:46 +01:00
parent 4f21221698
commit afb722ab24
11 changed files with 41 additions and 12 deletions

View file

@ -332,10 +332,15 @@ public class MainActivity extends SimpleActivity
new CopyDialog(this, files, new CopyMoveTask.CopyMoveListener() {
@Override
public void copySucceeded(boolean deleted) {
if (deleted)
public void copySucceeded(boolean deleted, boolean copiedAll) {
int msgId;
if (deleted) {
getDirectories();
Utils.Companion.showToast(getApplicationContext(), deleted ? R.string.moving_success : R.string.copying_success);
msgId = copiedAll ? R.string.moving_success : R.string.moving_success_partial;
} else {
msgId = copiedAll? R.string.copying_success : R.string.copying_success_partial;
}
Utils.Companion.showToast(getApplicationContext(), msgId);
}
@Override

View file

@ -419,10 +419,15 @@ public class MediaActivity extends SimpleActivity
new CopyDialog(this, files, new CopyMoveTask.CopyMoveListener() {
@Override
public void copySucceeded(boolean deleted) {
if (deleted)
public void copySucceeded(boolean deleted, boolean copiedAll) {
int msgId;
if (deleted) {
refreshDir();
Utils.Companion.showToast(getApplicationContext(), deleted ? R.string.moving_success : R.string.copying_success);
msgId = copiedAll ? R.string.moving_success : R.string.moving_success_partial;
} else {
msgId = copiedAll? R.string.copying_success : R.string.copying_success_partial;
}
Utils.Companion.showToast(getApplicationContext(), msgId);
}
@Override

View file

@ -192,10 +192,15 @@ public class ViewPagerActivity extends SimpleActivity
files.add(file);
new CopyDialog(this, files, new CopyMoveTask.CopyMoveListener() {
@Override
public void copySucceeded(boolean deleted) {
if (deleted)
public void copySucceeded(boolean deleted, boolean copiedAll) {
int msgId;
if (deleted) {
reloadViewPager();
Utils.Companion.showToast(getApplicationContext(), deleted ? R.string.moving_success : R.string.copying_success);
msgId = copiedAll ? R.string.moving_success : R.string.moving_success_partial;
} else {
msgId = copiedAll? R.string.copying_success : R.string.copying_success_partial;
}
Utils.Companion.showToast(getApplicationContext(), msgId);
}
@Override

View file

@ -89,13 +89,13 @@ class CopyDialog(val activity: SimpleActivity, val files: ArrayList<File>, val c
updatedFiles.addAll(files)
for (file in files) {
val destination = File(destinationDir, file.name)
file.renameTo(destination)
updatedFiles.add(destination)
if (file.renameTo(destination))
updatedFiles.add(destination)
}
context.scanFiles(updatedFiles) {}
dismiss()
copyMoveListener.copySucceeded(true)
copyMoveListener.copySucceeded(true, files.size * 2 == updatedFiles.size)
}
}
})

View file

@ -56,6 +56,8 @@
<string name="moving">Moving&#8230;</string>
<string name="moving_success">Files moved successfully</string>
<string name="already_exists">A file with that name already exists</string>
<string name="moving_success_partial">Some files could not be moved</string>
<string name="copying_success_partial">Some files could not be copied</string>
<plurals name="folders_deleted">
<item quantity="one">1 Ordner gelöscht</item>

View file

@ -56,6 +56,8 @@
<string name="moving">Moving&#8230;</string>
<string name="moving_success">Files moved successfully</string>
<string name="already_exists">A file with that name already exists</string>
<string name="moving_success_partial">Some files could not be moved</string>
<string name="copying_success_partial">Some files could not be copied</string>
<plurals name="folders_deleted">
<item quantity="one">1 carpeta eliminada</item>

View file

@ -56,6 +56,8 @@
<string name="moving">Moving&#8230;</string>
<string name="moving_success">Files moved successfully</string>
<string name="already_exists">A file with that name already exists</string>
<string name="moving_success_partial">Some files could not be moved</string>
<string name="copying_success_partial">Some files could not be copied</string>
<plurals name="folders_deleted">
<item quantity="one">1 cartella eliminata</item>

View file

@ -56,6 +56,8 @@
<string name="moving">Moving&#8230;</string>
<string name="moving_success">Files moved successfully</string>
<string name="already_exists">A file with that name already exists</string>
<string name="moving_success_partial">Some files could not be moved</string>
<string name="copying_success_partial">Some files could not be copied</string>
<plurals name="folders_deleted">
<item quantity="one">1 フォルダーを削除しました</item>

View file

@ -56,6 +56,8 @@
<string name="moving">Moving&#8230;</string>
<string name="moving_success">Files moved successfully</string>
<string name="already_exists">Já existe um ficheiro com este nome</string>
<string name="moving_success_partial">Some files could not be moved</string>
<string name="copying_success_partial">Some files could not be copied</string>
<plurals name="folders_deleted">
<item quantity="one">1 pasta apagada</item>

View file

@ -56,6 +56,8 @@
<string name="moving">Moving&#8230;</string>
<string name="moving_success">Files moved successfully</string>
<string name="already_exists">A file with that name already exists</string>
<string name="moving_success_partial">Some files could not be moved</string>
<string name="copying_success_partial">Some files could not be copied</string>
<plurals name="folders_deleted">
<item quantity="one">1 mapp borttagen</item>

View file

@ -56,6 +56,8 @@
<string name="moving">Moving&#8230;</string>
<string name="moving_success">Files moved successfully</string>
<string name="already_exists">A file with that name already exists</string>
<string name="moving_success_partial">Some files could not be moved</string>
<string name="copying_success_partial">Some files could not be copied</string>
<plurals name="folders_deleted">
<item quantity="one">1 folder deleted</item>