Skip to content
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

Adding tags to deck/multiple notes #4911

Closed
jalexvig opened this issue Aug 10, 2018 · 19 comments · Fixed by #8751
Closed

Adding tags to deck/multiple notes #4911

jalexvig opened this issue Aug 10, 2018 · 19 comments · Fixed by #8751
Labels
Accepted Maintainers welcome a PR implementing this feature Anki Ecosystem Compatibility Enhancement Keep Open avoids the stale bot Priority-Medium
Milestone

Comments

@jalexvig
Copy link

Research

Enter an [ x ] character to confirm the points below:

[ x ] I have read the support page and am reporting a bug or enhancement request specific to AnkiDroid

[ x ] I have checked the manual and the FAQ and could not find a solution to my issue

[ x ] I have searched for similar existing issues here and on the user forum

Being able to add tags to an entire deck and/or multiple notes simultaneously would be a time saver. I see that @vrublack is working on multiple note selection but I didn't notice anything on adding tags.

@timrae
Copy link
Member

timrae commented Aug 10, 2018

How do you propose this might be implemented in terms of the GUI?

@vrublack
Copy link
Contributor

I think it'd be simple to do this, just add a "add tag" item to the multi-select menu and create a corresponding logic in DeckTask.

@timrae
Copy link
Member

timrae commented Aug 10, 2018

What about removing tags? I think you'd want to use the tag editor

@jalexvig
Copy link
Author

@timrae Maybe in the deck options screen?

@timrae
Copy link
Member

timrae commented Sep 14, 2018

Definitely not in the deck options screen, I think it would need to use the tag editor like we do when adding / removing tags in the editor.

@timrae timrae added Enhancement Priority-Medium Accepted Maintainers welcome a PR implementing this feature labels Sep 14, 2018
@mrbryce
Copy link

mrbryce commented Jul 28, 2019

I've been missing a way to tag/untag and export the cards currently filtered in the browser view.
It would look as simple as "tag/untag all" and "export all", since the browser already has search&filtering abilities

@sudomain
Copy link
Contributor

My vote is to call the tag editor like @timrae said, but from the drop down menu that appears when long pressing a note in the browser. Maybe right below "Select all"?

Screenshot_2019-07-31-15-10-32

@sudomain
Copy link
Contributor

sudomain commented Oct 6, 2019

If the project maintainers approve, I'd like to try implementing this in the card browser context menu as shown in my screenshot above.

My initial research shows that this menu is defined in CardBrowserContextMenu.java. In the betas there's already functionality to toggle the 'marked' tag, so maybe I'll reuse code from there and create an instance of the TagsDialog. I'm struggling to find com.ichi2.anki.R which is used by CardBrowserContextMenu.java to toggle the marked tag. Shouldn't it be located in the com/ichi2/anki directory?

EDIT: In DeckTask.java, MARK_NOTE_MULTI calls CardUtils.markAll

@mikehardy
Copy link
Member

The 'R' symbol is actually dynamically generated at build time, and stands for "Resources", the contents are built from src/main/res XML files

Doing these 'Task' type features is a little involved because it is asynchronous while in my previous additions I've still tried to preserve undo while being aware of memory pressure jus tin case. But there are plenty of patterns to follow, yes - like you see with the DeckTask/MARK_NOTE_MULTI items. They are all pretty much the same so hopefully not too terrible to hack on

@sudomain you're approach in general (call tag editor, from card list menu in multi-select mode) seems like it should work

@github-actions
Copy link
Contributor

github-actions bot commented Jun 3, 2020

Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Jun 3, 2020
@david-allison david-allison added Keep Open avoids the stale bot and removed Stale labels Jun 3, 2020
@david-allison
Copy link
Member

david-allison commented Jun 3, 2020

Adding multiple tags in Card Browser is requested fairly often, and I'd like to get around to it

@sudomain
Copy link
Contributor

sudomain commented Jun 3, 2020

There is an old method in AnkiDroid's port of libanki that would theoretically handle bulk adding of tags, though it's currently broken. For reference, the corresponding function in desktop Anki calls a function in the rust backend. If someone were to make an attempt at this feature, should the approach be to port the rust code to java as discussed in #5805 ?

@bsudhanva
Copy link

+1

@TarekkMA
Copy link
Contributor

TarekkMA commented Mar 17, 2021

I would like to work on this one, if it's still a wanted feature.

I will make a change to the tags dialog, will add another state that will be visible, if multiple notes are selected.

  • Checked: if all notes have that tag
  • Unchecked: if all notes don't have that tag
  • indeterminate: if some notes, have this tag and other don't
    • clicking on it will change it to checked/unchecked, setting the same tag for all cards

Screen Shot 2021-03-17 at 5 08 22 PM

In desktop, they don't have this issue, as there is only 2 options from the card browser, add tags, or remove tags

@mikehardy
Copy link
Member

That sounds good @TarekkMA - as long as nothing is actually persisted to the database until the change is confirmed with an explicit save and there is the option to cancel this works for me.

As an implementation detail, this will need to be done as an AsyncTask with a progress listener because it's touching storage (slow) and the UI will become unresponsive unless it's off in another task, but the UI does need to block (thus the progress listener and a progress dialog) as the CardBrowser will not have a valid state until the oepration is done, at which point it will need to reload itself to show the result of the current search with new tags

@TarekkMA
Copy link
Contributor

@mikehardy no problems, will make that.

@TarekkMA
Copy link
Contributor

There is a library https://github.com/sevar83/indeterminate-checkbox that does have tri-state checkbox with animation transition. But not maintained. We could fork it, or make our own with no animations, I don't know anything about vector animation in android.

@mikehardy
Copy link
Member

We will not adopt external dependencies unless they are maintained, and we are busy enough now, fork+maintain is not a good option.

I don't think animation has any value here (in fact, if we animate anything we also have to support disabling the animation since we are used on e-ink readers!)

@mikehardy mikehardy added this to the 2.16 release milestone Nov 13, 2021
@mikehardy
Copy link
Member

The next alpha build will have a tags editor that works on multiple things at once

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Maintainers welcome a PR implementing this feature Anki Ecosystem Compatibility Enhancement Keep Open avoids the stale bot Priority-Medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants