-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Enhancement: allow renaming flag from CardBrowser menu #16244
base: main
Are you sure you want to change the base?
Conversation
Message to maintainers, this PR contains strings changes.
Read more about updating strings on the wiki, |
I have placed the rename option in menu for now, reason too many steps would be required in that case We can place the rename option just above the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have placed the rename option in menu for now, reason too many steps would be required in that case
Menu -> Options dialog -> Rename flag -> One more dialog consisting of the list of flag -> flag clicked -> another rename dialog
Again, this is not an option that will be used by many users and even those that are going to use it are going to use it a few times. There's no justification to have this option cluttering the menu for everyone for such small/specific usage.
Menu -> Options dialog -> Rename flag -> One dialog
That dialog can both display the flags with their current name and an option to edit them inline. For example, for a flag entry, initially show a TextView + Button to rename(maybe also the flag icon so it's more clear). When the rename button is clicked replace the TextView + Button with an EditText + 2 Buttons(1 for accept and 1 for cancel the new name). This way the user both sees the current names + has the option to edit all of them in the same dialog.
AnkiDroid/src/main/java/com/ichi2/anki/dialogs/FlagRenameDialog.kt
Outdated
Show resolved
Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/dialogs/FlagRenameDialog.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anki Desktop does not allow 'No Flag' to be renamed
AnkiDroid/src/main/java/com/ichi2/anki/dialogs/FlagRenameDialog.kt
Outdated
Show resolved
Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/dialogs/FlagRenameDialog.kt
Outdated
Show resolved
Hide resolved
Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically |
Done in the Card Browser options Fixes 16205
9c43c12
to
d1a65a0
Compare
override fun onResume() { | ||
super.onResume() | ||
(dialog as AlertDialog).positiveButton.setOnClickListener { | ||
// TODO: Extract pending changes from the adapter and save them |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically: I'm being lazy here
I didn't like the fact that pressing 'OK' closed the dialog
But don't have the capacity to extract the logic from the ViewHolder, or handle the FlagItem
matching the state of the adapter's edit mode (.copy()
is used, changing references)
I feel this is an acceptable compromise. Needs new dev if I'm being too lazy
val pendingChanges = flagAdapter.currentList.filter { it.isInEditMode } | ||
if (pendingChanges.any()) { | ||
Timber.i("Attempted to close with %d pending changes", pendingChanges.size) | ||
showThemedToast(R.string.confirm_before_saving, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hoping this is temporary code, so not putting effort into getting the snackbar working inside the dialog
Purpose / Description
Fixes
How Has This Been Tested?
AnkiDroid: (orange flag)
Anki after sync:
Checklist
Please, go through these checks before submitting the PR.