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

Conversation

yashwanthgajji
Copy link

Description

Added a condition to check if old name and new name of the file are same. Started renaming code only if the names are different.

Issue tracker

Fixes #4340

Automatic tests

  • Added test cases

Manual tests

  • Done
  • Device: Samsung S23 Ultra
  • OS: 12

Build tasks success

Successfully running following tasks on local:

  • ./gradlew assembledebug
  • ./gradlew spotlessCheck

Copy link
Member

@VishnuSanal VishnuSanal left a comment

Choose a reason for hiding this comment

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

thanks for your interest in contributing to Amaze. but, I don't think this will be a better UX than the way it is currently. if renaming is not possible, we should let the user know the "why?".

@yashwanthgajji
Copy link
Author

What about we toast a message saying "Your new name is same as old name. Rename isn't done". Or the best thing we can do is, we can disable save button if old and new names are same.

Please let me know what you have in mind.

@yashwanthgajji
Copy link
Author

I added a message to notify that no changes are made as new name matches the old name.

Please let me know if you are thinking the same.

Copy link
Member

@VishnuSanal VishnuSanal left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@VishnuSanal VishnuSanal changed the title Removed unnecessary "File with the same name already exists" toast notify the user when renaming to the same name Feb 1, 2025
@VishnuSanal VishnuSanal added the pr-awaiting-final-review this PR is awaiting a final review/approval label Feb 1, 2025
Copy link
Member

@EmmanuelMess EmmanuelMess left a comment

Choose a reason for hiding this comment

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

As to not leave this stuck, I am approving. @VishnuSanal please only merge if you tested the code and works.

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

Copy link
Member

@EmmanuelMess EmmanuelMess left a comment

Choose a reason for hiding this comment

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

Okay, I am rescinding the approval. When "CREATE" is selected for a new folder, the popup closes. The way this should work is that CREATE should not be able to be selected and a text in red should appear under the text line saying "Cannot rename to already existing file name" or something similar.
See how naming a file works for reference:
imagen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-awaiting-final-review this PR is awaiting a final review/approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unreasonable 'File with the same name already exists' prompt appears when renaming a folder without changes
3 participants