write a separate toast when folder is being renamed

This commit is contained in:
tibbi 2016-04-01 22:12:13 +02:00
parent 375489a536
commit af61d30113
2 changed files with 7 additions and 4 deletions

View File

@ -247,15 +247,16 @@ public class MainActivity extends AppCompatActivity
return;
}
final File newDir = new File(dir.getParent(), newDirName);
if (dir.renameTo(newDir)) {
Utils.showToast(getApplicationContext(), R.string.rename_folder_ok);
alertDialog.dismiss();
actionMode.finish();
final List<String> updatedFiles = new ArrayList<>();
updatedFiles.add(dir.getAbsolutePath());
updatedFiles.add(newDir.getAbsolutePath());
final File newDir = new File(dir.getParent(), newDirName);
if (dir.renameTo(newDir)) {
Utils.showToast(getApplicationContext(), R.string.renaming_folder);
alertDialog.dismiss();
actionMode.finish();
updatedFiles.add(newDir.getAbsolutePath());
final String[] changedFiles = updatedFiles.toArray(new String[updatedFiles.size()]);
MediaScannerConnection.scanFile(getApplicationContext(), changedFiles, null, MainActivity.this);
} else {
@ -348,6 +349,7 @@ public class MainActivity extends AppCompatActivity
final String[] changedFiles = updatedFiles.toArray(new String[updatedFiles.size()]);
MediaScannerConnection.scanFile(getApplicationContext(), changedFiles, null, null);
Utils.showToast(getApplicationContext(), R.string.rename_folder_ok);
dirs = new ArrayList<>(getDirectories().values());
updateGridView();
gridView.requestLayout();

View File

@ -13,6 +13,7 @@
<string name="rename_folder_error">Could not rename the folder</string>
<string name="rename_folder_empty">Folder name must not be empty</string>
<string name="rename_folder_ok">Folder renamed successfully</string>
<string name="renaming_folder">Renaming folder</string>
<string name="file_name">File name</string>
<string name="folder_name">Folder name</string>
<string name="extension">Extension</string>