Skip to content

feat: New intuitive edit notetype field screen#20453

Draft
S-H-Y-A wants to merge 19 commits intoankidroid:mainfrom
S-H-Y-A:enhance_noteTypeFieldEditor
Draft

feat: New intuitive edit notetype field screen#20453
S-H-Y-A wants to merge 19 commits intoankidroid:mainfrom
S-H-Y-A:enhance_noteTypeFieldEditor

Conversation

@S-H-Y-A
Copy link
Contributor

@S-H-Y-A S-H-Y-A commented Mar 13, 2026

Purpose / Description

All actions in the note-type field screen are tucked away in the menu, and the UI is not intuitive. On this new screen, users can remove and reposition fields by dragging and dropping or swiping, and just tap buttons to change the sort field or language hint.

Approach

refactor

  • moved th field edit oprations to the viewModel

feature

  • The app keeps temporary changes in the ViewModel and applies them when the "Save" button is pressed.

How Has This Been Tested?

screen-20260313-191456-17733968665982.mp4

Physical Phone
Pixel 7a
Android16

Learning (optional, can help others)

https://forums.ankiweb.net/t/intuitive-field-management-screen/69113
https://developer.android.com/develop/ui/views/layout/recyclerview

Checklist

Please, go through these checks before submitting the PR.

  • 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

S-H-Y-A added 13 commits March 13, 2026 19:30
Migrated from listview to recyclerview and Made it pssible to drag and drop or swipe to edit notetypeField, and edit field names directly.
Rmoved menu buttons.
Show the current language settings.
…celed.

Reset view.transitionX by calling notifyItemChanged method.
Record changes to make it possible to undo from deck picker screen.
Extra: undo delete multiple Notetypes operation at a once.
Add save button to save all changes at once.
Show undo snackbar when notetypefields are changed.
Show one-way sync confirmation dialog before saving all changes.
…ze operations

Fixed too fast drag speed when moving editing field.
Fixed uncorrect rename operation.
Use LinerLayout insted of ConstraintLayout to scroll smoothly.
Did away with holding unsaved operation when Activity is recreated, avoiding operation stack inconsistency.
@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

@ZornHadNoChoice

This comment was marked as resolved.

@S-H-Y-A S-H-Y-A changed the title New intuitive edit notetype field screen feat: New intuitive edit notetype field screen Mar 13, 2026
Removed the confirmation dialog when deleting a field.
Disabled individual undo actions for field operations except for delete.
Cleaned up strings.
@S-H-Y-A
Copy link
Contributor Author

S-H-Y-A commented Mar 14, 2026

  • Disabled undo snackbar showing except for delete.
  • The delete field confirmation dialog doesn't appear now.

@ZornHadNoChoice
Copy link
Collaborator

Hi again! Seeing that you've worked on this screen, would you consider updating the "Add field" dialog as in #18553? It's totally fine if you don't want to.

The things that should be changed

  • Show red text if the field already exists and disable the button. A similar warning should be shown for those new input boxes. (See reference 1)
  • Add a border to the box with "Name" in it. (See reference 2)

Reference images

Screenshot_2026-03-14-21-38-48-167_com ichi2 anki a-edit
Screenshot_2026-03-14-21-39-18-601_com ichi2 anki a-edit

@S-H-Y-A
Copy link
Contributor Author

S-H-Y-A commented Mar 15, 2026

Hi again! Seeing that you've worked on this screen, would you consider updating the "Add field" dialog as in #18553? It's totally fine if you don't want to.

The things that should be changed

  • Show red text if the field already exists and disable the button. A similar warning should be shown for those new input boxes. (See reference 1)
  • Add a border to the box with "Name" in it. (See reference 2)

Shold these changes be appiled to only the new filed dialog editext, or all edittexts?

@ZornHadNoChoice
Copy link
Collaborator

The red warning should be shown for the dialog as well as the edittexts (by which I assume you mean the input boxes containing the names of the fields).

The name in the border should only be for the dialog.

S-H-Y-A added 4 commits March 15, 2026 15:06
Extracted field name validation logic.
Implemented real-time validation in the field editor.
Use `ConstraintLayout` to avoid UI corruption when error/helper text is showed.
Added a reset button in the text box to restore the original field name.
Re-enabled undo snackbar appearing when renaming a field, to notify users when users scroll recyclerview and the new name is automatically saved.
@S-H-Y-A
Copy link
Contributor Author

S-H-Y-A commented Mar 15, 2026

I added real-time name validation, and re-enabled undo snackbar appearing when renaming a field because users cannot be aware of automatically saving the rename operation without the notification, which is triggered by scrolling the recyclerlview.

It shows not only empty caution but also auto rename caused by the name including invalid characters.

Screenshots show "Name contained invalid characters; saved as ...", which is misleading, but this has been fixed.
I've already changed it to "Name contains invalid characters; will be saved as ...."
Screenshot_20260315-155657
Screenshot_20260315-155617
Screenshot_20260315-155848
Screenshot_20260315-160008
Screenshot_20260315-160017
Screenshot_20260315-160054

Copy link
Member

@lukstbit lukstbit left a comment

Choose a reason for hiding this comment

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

Thank you for the PR.
For future contributions please wait a bit for feedback in the forums from a maintainer just so you are sure you don't work on something that might not be accepted.

This PR is really big and the proposed UI change has a lower priority so it will take a while until it could get discussed and merged. I recommend that you extract smaller PRs from this one to make it easier to review and to merge. A first PR could be the first two commits, once we get the ViewModel in then we could discuss the actual UI change.

Some other notes after a quick look:

  • the third commit feels that is not needed, I don't see why all those classes were created
  • string changes should be done only in the values folder, our automatic system will take care of the strings for the other languages
  • I would expect for tests to be updated and not be deleted
  • you can reduce the size of the image posted here in Android Studio(example 50%)

@lukstbit lukstbit added Needs Author Reply Waiting for a reply from the original author and removed Needs Review labels Mar 15, 2026
@S-H-Y-A
Copy link
Contributor Author

S-H-Y-A commented Mar 15, 2026

For future contributions please wait a bit for feedback in the forums from a maintainer just so you are sure you don't work on something that might not be accepted.

I'm on a rare break for a week, so It seems that I was feeling rushed to compelete this PR during that vacation.
I'll convert this PR to draft and create a branch based on the halfway commit to create smaller PRs.

The answers to the questions:

  • RepositionTypeField.kt, which was added at the third commit and removed at the fourth commint, is created to seperate each dialogs and clarify the edit operations, and to migrate easily to drag and drop or swipe. (RepositionTypeField.k is also created for the same reason, but not deleted due to my overlook.)
  • The only one test I deleted (NoteTypeFieldEditorContextMenuTest.kt‎) tests menu values removed completely in this migration. There is no problem.

@S-H-Y-A S-H-Y-A marked this pull request as draft March 15, 2026 11:50
@S-H-Y-A
Copy link
Contributor Author

S-H-Y-A commented Mar 16, 2026

(The same content with what I wrote in #20480)

I have been working on this PR this week.
As I mentioned before, I spent my vacation on these commits, but it has become clear that I won't be able to finish them before my vacation ends.
I believe it's better to suspend this PR for now rather than leaving it in an unfinished state. I know it's selfish, but forgive me; I'm staying on as a user because I love this app.

@lukstbit
Copy link
Member

I know it's selfish, but forgive me; I'm staying on as a user because I love this app.

No need to apologize in any way, it's perfectly fine.
What you did is still valuable and with a bit of work will most likely be merged. Right now I'm going through high priority PRs for the next release but I can come back and fix issues here and bring it to the end.

@lukstbit lukstbit self-assigned this Mar 16, 2026
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 Strings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants