Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notify the user when renaming to the same name #4347

Open
wants to merge 3 commits into
base: release/4.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -339,16 +339,22 @@ public void rename(
final boolean isDirectory,
final Activity context,
boolean rootmode) {
final Toast toast =
Toast.makeText(context, context.getString(R.string.renaming), Toast.LENGTH_SHORT);
toast.show();
HybridFile oldFile = new HybridFile(mode, oldPath);
HybridFile newFile;
if (Utils.isNullOrEmpty(newName)) {
newFile = new HybridFile(mode, newPath);
} else {
newFile = new HybridFile(mode, newPath, newName, isDirectory);
}
if (oldFile.getSimpleName().equals(newFile.getSimpleName())) {
Toast.makeText(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Toast should not be used anymore, in favor of Snackbar

context, context.getString(R.string.no_changes_while_rename), Toast.LENGTH_SHORT)
.show();
return;
}
final Toast toast =
Toast.makeText(context, context.getString(R.string.renaming), Toast.LENGTH_SHORT);
toast.show();
Operations.rename(
oldFile,
newFile,
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@
<string name="creatingfile">Creating File</string>
<string name="creatingfolder">Creating Folder</string>
<string name="renaming">Renaming</string>
<string name="no_changes_while_rename">No changes were made as the new name matches the old name.</string>
<string name="cant_be_empty">%s cannot be empty</string>
<string name="ip">Address</string>
<string name="connection_name">Connection name</string>
Expand Down
Loading