Skip to content

fix: Show red text if the tag already exists and disable the button#20368

Merged
david-allison merged 1 commit intoankidroid:mainfrom
PrathamDevX:add-tag-validation
Mar 13, 2026
Merged

fix: Show red text if the tag already exists and disable the button#20368
david-allison merged 1 commit intoankidroid:mainfrom
PrathamDevX:add-tag-validation

Conversation

@PrathamDevX
Copy link
Contributor

Purpose / Description

The PR fixes the issue where adding an already existing tag does not provide proper validation feedback.
Now the Add Tag dialog shows a red error message and disables the OK button when a duplicate tag is entered.

Fixes

Approach

Added validation in TagsDialog.kt to check whether the entered tag already exists.

  • Normalizes user input using TagsUtil.getUniformedTag()
  • Displays inline error text when a duplicate tag is detected
  • Disables the OK button until a valid unique tag is entered

How Has This Been Tested?

Ran the app and verified that when entering an existing tag in the Add Tag dialog, a red error message is displayed and the OK button remains disabled.

Also verified that entering a new unique tag enables the OK button and allows the tag to be added successfully.

before:
Screenshot From 2026-02-28 00-47-51

Screenshot From 2026-02-28 00-48-01

after:
image

Learning (optional, can help others)

None

Links to blog posts, patterns, libraries or addons used to solve this problem

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@welcome
Copy link

welcome bot commented Feb 27, 2026

First PR! 🚀 We sincerely appreciate that you have taken the time to propose a change to AnkiDroid! Please have patience with us as we are all volunteers - we will get to this as soon as possible.

@github-actions
Copy link
Contributor

Important

Maintainers: This PR contains Strings changes

  1. Sync Translations before merging this PR and wait for the action to complete
  2. Review and merge the auto-generated PR in order to sync all user-submitted translations
  3. Sync Translations again and merge the PR so the huge automated string changes caused by merging this PR are by themselves and easy to review

inputET.filters = arrayOf(addTagFilter)

if (!prefixTag.isNullOrEmpty()) {
// utilize the addTagFilter to append '::' properly by appending a space to prefixTag
Copy link
Contributor

Choose a reason for hiding this comment

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

Why removing the comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, that wasn’t intentional. I’ll add it back.

@criticalAY criticalAY added Needs Author Reply Waiting for a reply from the original author and removed Needs Review labels Feb 27, 2026
@PrathamDevX PrathamDevX requested a review from criticalAY March 1, 2026 07:08
Copy link
Contributor

@criticalAY criticalAY left a comment

Choose a reason for hiding this comment

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

Changes are not reverted

@PrathamDevX PrathamDevX requested a review from criticalAY March 8, 2026 06:42
@david-allison david-allison added Needs Review Needs Second Approval Has one approval, one more approval to merge squash-merge A squash & force push is required. The PR author may do this to speed up the merge process. and removed Needs Author Reply Waiting for a reply from the original author Needs Review labels Mar 8, 2026
@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Mar 9, 2026
Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

If you re-request review, it removes my approval. Still good to go

@PrathamDevX
Copy link
Contributor Author

Got it!, Thanks

@criticalAY criticalAY removed the Needs Author Reply Waiting for a reply from the original author label Mar 11, 2026
Copy link
Contributor

@criticalAY criticalAY left a comment

Choose a reason for hiding this comment

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

I am ok with the code, the commit can be squashed.
Thankyou!

@criticalAY criticalAY added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels Mar 11, 2026
@david-allison david-allison removed the squash-merge A squash & force push is required. The PR author may do this to speed up the merge process. label Mar 13, 2026
@david-allison david-allison enabled auto-merge March 13, 2026 14:48
@david-allison david-allison added this pull request to the merge queue Mar 13, 2026
Merged via the queue into ankidroid:main with commit 5973ee7 Mar 13, 2026
15 checks passed
@github-actions github-actions bot added this to the 2.24 release milestone Mar 13, 2026
@github-actions
Copy link
Contributor

Maintainers: Please Sync Translations to produce a commit with only the automated changes from this PR.

Read more about updating strings on the wiki,

@github-actions github-actions bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants