Skip to content

feat: improve Study by card state or tag dialog#20805

Open
Akira2206 wants to merge 1 commit intoankidroid:mainfrom
Akira2206:fix/study-by-tag-dialog
Open

feat: improve Study by card state or tag dialog#20805
Akira2206 wants to merge 1 commit intoankidroid:mainfrom
Akira2206:fix/study-by-tag-dialog

Conversation

@Akira2206
Copy link
Copy Markdown
Contributor

Note

Logic and documentation assisted by Gemini 3 Flash.

Purpose / Description

Improves the "Study by card state or tag" dialog and implements filtering of tags.

Fixes

Approach

  • Added a title to the input dialog using AlertDialog.Builder.title(), affecting all custom study sub-dialogs
  • Removed the "Select x cards from the deck" label
  • Implemented dynamic hints in TextInputLayout that switch between "Number of days" and "Number of cards" based on the ContextMenuOption
  • Called selectAll() in a post {} block within the input dialog to improve text selection behavior
  • Changed positive button labels to "Create" in CustomStudyDialog and "Confirm" in TagsDialog
  • Integrated a red error state in TextInputLayout and dynamic isEnabled updates for the positive button when findNotes returns zero results
  • Added a tag selection button that mimics the Note Editor's tag box
  • Updated TagsDialogViewModel to accept a filterQuery, ensuring the TagsDialog only displays tags available for the selected CustomStudyCardState
  • Implemented an intersection check during card state changes to retain valid tags in viewModel.selectedTags while removing unavailable ones
  • Added logic in the doAfterTextChanged listener to sanitize numeric input and prevent leading zeros

How Has This Been Tested?

WhatsApp.Video.2026-04-22.at.05.11.48.mp4

Screenshots of affected dialogs

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

@github-actions
Copy link
Copy Markdown
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

@criticalAY criticalAY added the Needs Author Reply Waiting for a reply from the original author label Apr 22, 2026
@criticalAY
Copy link
Copy Markdown
Contributor

CI is failing

@Akira2206 Akira2206 marked this pull request as draft April 22, 2026 02:00
@Akira2206 Akira2206 force-pushed the fix/study-by-tag-dialog branch from 1c86c7a to 50b9de0 Compare April 22, 2026 16:23
@Akira2206 Akira2206 marked this pull request as ready for review April 22, 2026 17:10
@Akira2206
Copy link
Copy Markdown
Contributor Author

I ran ./gradlew ktlintCheck and ./gradlew jacocoUnitTestReport. The unit tests and lint are passing, but codecov check is failing

@criticalAY criticalAY self-requested a review April 23, 2026 10:16
Comment thread AnkiDroid/src/main/java/com/ichi2/anki/dialogs/customstudy/CustomStudyDialog.kt Outdated
tools:text="New cards only"
/>
</com.google.android.material.textfield.TextInputLayout>
<androidx.appcompat.widget.AppCompatButton
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I didn't like the UI, it doesnt go withh the current dialog UI

@Akira2206 Akira2206 force-pushed the fix/study-by-tag-dialog branch 2 times, most recently from f3874b2 to 74257f0 Compare April 24, 2026 01:44
@Akira2206 Akira2206 force-pushed the fix/study-by-tag-dialog branch from 74257f0 to 4561bd8 Compare April 25, 2026 07:52
@Akira2206
Copy link
Copy Markdown
Contributor Author

I have updated the tag selection UI to use a ChipGroup for selected tags. Here is a video for the interaction:

WhatsApp.Video.2026-04-25.at.14.41.13.mp4

And images of the dialog in different themes:

@Akira2206 Akira2206 requested a review from criticalAY April 25, 2026 09:38
@ZornHadNoChoice
Copy link
Copy Markdown
Collaborator

Looks great!

However, I think it'd be even better if it was more compact. For starters, the vertical spacing between the chips could be smaller. Also, the crosses aren't really necessary since the user can use the edit button.

@Akira2206 Akira2206 force-pushed the fix/study-by-tag-dialog branch from 4561bd8 to 2637466 Compare May 2, 2026 09:51
@Akira2206
Copy link
Copy Markdown
Contributor Author

Hope it's better now

WhatsApp.Video.2026-05-02.at.15.29.02.mp4

@ZornHadNoChoice
Copy link
Copy Markdown
Collaborator

It's better, yes, but can we do anything about the edit button? It's eating up half of the space. Perhaps, tapping anywhere on the "ChipGroup" can open the tag dialog instead?

@Akira2206
Copy link
Copy Markdown
Contributor Author

Actually the edit button isnt taking up any space here

Because it's a FrameLayout, the chips group and the text box are layered on top of each other.
I had set a 40dp padding so chips don't overlap the edit pencil button, so the reason why you see so much space is simply because the third tag didn't fit inside the remaining space

Earlier this was set to 36dp which i changed to 40dp because I felt the chips were getting too close
These are ss from 36dp one for comparison:
WhatsApp Image 2026-05-02 at 16 08 08 (1) WhatsApp Image 2026-05-02 at 16 08 08

That being said I can completely remove the edit icon and just make the chips/box clickable to open the dialog as well if that's better

@ZornHadNoChoice
Copy link
Copy Markdown
Collaborator

I'm in favor of removing it.

@Akira2206 Akira2206 force-pushed the fix/study-by-tag-dialog branch from 2637466 to 34ae6d3 Compare May 2, 2026 12:02
@Akira2206
Copy link
Copy Markdown
Contributor Author

done, clicking either the chips or inside the outline box opens the tags dialog

WhatsApp Image 2026-05-02 at 17 45 05

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Has Conflicts Needs Author Reply Waiting for a reply from the original author Needs Review Strings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve the Study by card state or tag dialog

3 participants