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

View file

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