Acclorite / book-story

Material3 eBook reader - Book's Story. Built with Jetpack Compose. Free & Open Source & Ad Free. 7 supported file formats (.txt, .pdf, .epub, .fb2, .zip, .html, .htm), 5 supported languages. Lots of customization.
GNU General Public License v3.0
209 stars 8 forks source link

Improve/Add text selection toolbar actions in Reader #46

Closed shuvashish76 closed 3 weeks ago

shuvashish76 commented 4 weeks ago

Describe the feature you'd like to be implemented Add option to show context menu actions when you perform text selection, which is better UX than current double click to send actions via intent.

Describe alternatives you've considered For example when I select text in browser it gives options to copy, share, select all, actions from installed apps e.g. Aard2, Translate You,, Tasks.org, AnkiDroid etc..

Screenshot_2024-08-13_12-45-08_1

Additional context https://developer.android.com/training/package-visibility/use-cases#custom-text-selection-actions

Task list

Acclorite commented 4 weeks ago

Add option to show context menu actions when you perform text selection, which is better UX than current double click to send actions via intent.

Personal preference. I prefer double click much more. Also, if you select text, you already see custom actions, e.g Translate or Dictionary, what's wrong with that?

Edit: I should mention that setting up intent does nothing, as it already is in Manifest. Compose selection is super undeveloped, I would like to make custom UI for that, to match chosen theme, but there is just no option to change anything. For now, this issue is impossible to do, there already are reports to Google to improve Selection Toolbar, but basically no movement yet. To just add "Translate" and "Dictionary" options, I had to use super ugly workaround, just because there is no other way.

Edit 2: I am not against extending Selection Toolbar's options, but currently that is not possible in compose.

shuvashish76 commented 4 weeks ago

Also, if you select text, you already see custom actions, e.g Translate or Dictionary, what's wrong with that?

https://github.com/user-attachments/assets/b87c4c38-20aa-4908-8fe0-542540cbe8e1

As you can see 1. Dictionary: redirects to browser only, missing the Aard2 dictionary app (other app you see is AM's interceptor) 2. Translate: redirects to all other relevant installed apps, the title of this context menu is kinda misleading 3. Missing share option as I shown in the screenshot of my 1st comment.

The current workaround works not a major issue but it's not perfect either. Adding all apps directly to the context menu would be nice.

Edit 2: I am not against extending Selection Toolbar's options, but currently that is not possible in compose.

Okay, got itπŸ‘πŸΏ

Acclorite commented 4 weeks ago

Dictionary: redirects to browser only, missing the Aard2 dictionary app (other app you see is AM's interceptor)

Can try to also target dictionaries, thanks.

Translate: redirects to all other relevant installed apps, the title of this context menu is kinda misleading

What is misleading? It does what it says.

Missing share option as I shown in the screenshot of my 1st comment

Actually I should be able to add share option, thanks.

The current workaround works not a major issue but it's not perfect either. Adding all apps directly to the context menu would be nice.

I think it's already an achievement to be able to do that. I spent over week on this thing and that's all I could do.

shuvashish76 commented 4 weeks ago

What is misleading? It does what it says.

"Translate", but it tries to open dictionary, tasks, flashcard and all kind of apps...

I think it's already an achievement to be able to do that. I spent over week on this thing and that's all I could do.

I agree πŸ‘πŸΏ, just need some improvements...maybe in future if possible. Low priority feature request. I appreciate your time & energy you've put in for this feature :D

Acclorite commented 4 weeks ago

"Translate", but it tries to open dictionary, tasks, flashcard and all kind of apps...

Because it opens any app that processes text. There is no intent category "Translator", I either specify translators by myself, or go with all apps that can process text. It shouldn't be an issue after you selected desired app, so don't see it as misleading, it's all in your hands after all.

Acclorite commented 4 weeks ago

Resolved in 3fdc289 and a830be1. Please wait for the next release.

Your notice about Translate action redirects to dictionary apps gave me a hint on how to target actual dictionary apps with Dictionary option.

As both Translate and Dictionary use same Intent, as a workaround you now have to choose an app to redirect to each time. (except double click translation)