klinker24 / Android-TextView-LinkBuilder

Insanely easy way to define clickable links within a TextView.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for Text Selection

ritesh-dubey opened this issue · comments

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:

  • Long Press should enable text selection but shouldn't fire onClickListener().
  • Click (Not Links) should jump to next screen.
  • Clicking on links should function as it is.

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.

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

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.