Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

Reviewer: "Lookup Dictionary" menu item is unused

Open david-allison opened this issue 6 years ago • 9 comments

Functionality is hooked up, but not usable as the control is never made visible.

We should add this to "App Bar Buttons" so the user can move this around on the menu.

https://github.com/ankidroid/Anki-Android/blob/46075e2ccc93a40e3b64c39333263184f43fbe07/AnkiDroid/src/main/res/menu/reviewer.xml#L118-L121

david-allison avatar Nov 14 '20 07:11 david-allison

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[bot] avatar Jan 14 '21 21:01 github-actions[bot]

I'm working on it

@david-allison-1 Could you please provide a detailed description? Should I make this item appear? What's the funtionality of it and ... ?

abanoub-asaad avatar Mar 12 '21 13:03 abanoub-asaad

AnkiDroid has a lookup dictionary which is rarely used. It involves looking up selected text in one of a few externally defined dictionaries.

It can be enabled in the settings.

The current flow is:

  • Highlight a word,
  • Copy it
  • A clickable "lookup" icon should appear,

It would be helpful to also allow a menu item to replicate the functionality without copy/pasting the word:

  • Highlight the word
  • Select "Lookup" from the App Bar

The Menu Item is already defined in the linked code snippet, but the functionality was never implemented so the item is never shown.

This change would involve:

  • Show the menu item if the "Lookup Dictionary" preference is enabled
  • Disable the menu item when "Lookup Dictionary" preference is disabled
  • Define the menu item https://github.com/ankidroid/Anki-Android/blob/5128cc2c756ce1434367eb58807650581f26c661/AnkiDroid/src/main/java/com/ichi2/anki/reviewer/ActionButtonStatus.java#L47
  • Add a ViewerCommand for the functionality to lookup a word: https://github.com/ankidroid/Anki-Android/blob/ec5d9e535c391a150e3489ceb515426a3946c305/AnkiDroid/src/main/java/com/ichi2/anki/cardviewer/ViewerCommand.java#L66-L65
  • Implement the ViewerCommand in AbstractFlashcardViewer: do nothing/show a toast if no word is highlighted, otherwise perform a lookup search
  • (Optional) Add a gesture for the functionality (see past PRs for how this is done - maybe add some documentation).

david-allison avatar Mar 12 '21 22:03 david-allison

can I work on this?

Mohaned-Elfeky avatar Mar 27 '21 20:03 Mohaned-Elfeky

Let's give it 48 hours. @Abanoub-Asaad are you still working on this?

@mohaned-hassan Ping me when the 48 hours is up, thanks!!

david-allison avatar Mar 27 '21 20:03 david-allison

@mohaned-hassan All yours

david-allison avatar Mar 30 '21 01:03 david-allison

Thanks, on it.

Mohaned-Elfeky avatar Mar 30 '21 03:03 Mohaned-Elfeky

@david-allison-1

Anki-Android/AnkiDroid/src/main/java/com/ichi2/anki/reviewer/ActionButtonStatus.java/setup setupButton(preferences, R.id.action_search_dictionary, "customButtonSearchDictionary", SHOW_AS_ACTION_IF_ROOM);

Can you please point out why the preference of the search_dictionary button has no value (always returns the default value)?

Mohaned-Elfeky avatar Mar 31 '21 01:03 Mohaned-Elfeky

@mohaned-hassan if the user has not opened the settings screen

david-allison avatar Mar 31 '21 07:03 david-allison