Repository navigation
Notify user when renaming a file/folder to its original name - #4669
Merged
EmmanuelMess merged 2 commits intoJul 12, 2026
Merged
EmmanuelMess merged 2 commits into
EmmanuelMess merged 2 commits into
Conversation
Adds a STATE_WARNING branch to the validator lambda in MainFragment.rename(...) so that when the typed EditText text equals the source file name, R.string.no_changes_while_rename is rendered inline below the field via the existing WarnableTextInputLayout - mirroring the warning pattern already used by mkfile() for hidden-file / .txt-extension suggestions. The backend early-return + Toast in MainActivityHelper.rename is intentionally preserved as a safety net for direct callers. Fixes TeamAmaze#4660
EmmanuelMess
enabled auto-merge
July 12, 2026 15:10
Member
|
If this was done with automated coding tools, please tell me which one you used. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Opening the rename dialog and leaving the EditText value untouched
(typing nothing, or simply not editing) provides no inline feedback
that the operation is a no-op. The user must tap submit, the dialog
closes, and a backend-side Toast appears — or, on plain local files,
nothing visible happens at all. The user has already committed to
tapping a destructive-looking button before being told the rename
will do nothing.
Root cause
The
renamedialog's validator lambda inMainFragment.rename(...)covers only the invalid-filename, leading-space, and empty-text
states. There is no branch that compares the typed text against the
source file's current name and surfaces a result for that condition;
the dialog relies on
MainActivityHelper.rename(...)to detectthe no-change case after the user has already submitted.
Fix to #4660
Added an additional branch to the validator lambda that returns
STATE_WARNINGcarryingR.string.no_changes_while_renamewheneverthe typed text equals the source file's name. This renders inline
beneath the EditText through the existing
WarnableTextInputLayouthelper-text area — the same surface used by
mkfile()for itshidden-file and
.txt-extension warnings — so no new UI elementsare introduced and the layout matches the project's established
pattern for inline dialog warnings.
Files changed
app/src/main/java/com/amaze/filemanager/ui/fragments/MainFragment.java
rename(HybridFileParcelable f)validator lambda: added anelse if (text.equals(f.getName(getMainActivity())))branch thatreturns
WarnableTextInputValidator.ReturnState.STATE_WARNINGwithR.string.no_changes_while_rename, then formatting pass via Spotless.No changes to
MainActivityHelper,Operations, string resources,dialog layouts, or
WarnableTextInputValidatoritself.Testing
text "No changes were made as the new name matches the old name."
appears below the EditText in the warning helper-text style.
reappears.