klinker24 / Android-TextView-LinkBuilder

Insanely easy way to define clickable links within a TextView.
MIT License
1.59k stars 199 forks source link

Support for Text Selection #47

Closed ritesh-dubey closed 7 years ago

ritesh-dubey commented 7 years ago

I am using LinkConsumableTextView and enabled setTextIsSelectable(true) for it in RecyclerView but as soon as I long-press on the LinkConsumableTextView it highlights the text being selected and immediately fires the onClickListener and jumps to the second screen which shouldn't be the case. Can you please help me to achieve the below mentioned functionality?

Functionality:

klinker24 commented 7 years ago

I would imagine that when you long click the link and the text selection happens, the TextView loses focus, so the click event goes off. Hmm. I am not really sure how to solve this, admittedly. I know that you can long click any non-linked text and then drag to select the linked text that way, but that is different from what you are asking about.

In my apps, I just set up a long click listener for the link that brings up a contextual menu where one of the actions is copy. I feel like if the user is long clicking a link, they will see that it is highlighted and they would not expect it to react the same way as regular text. I think it is perfectly justified - and expected - to pop up some kind of AlertDialog or bottom sheet to handle the long click actions on the link. Your users will expect a different experience here, it isn't normal text that they are clicking, it is linked text.

klinker24 commented 7 years ago

Does that help you with your issue? I am going to close this, if so.

ritesh-dubey commented 7 years ago

Your answer was quite helpful though it didn't solve my problem. I guess I will have to try few more alternatives to achieve what is needed or go with what you suggested. Deeply appreciate you help and quick response.