saket / Better-Link-Movement-Method

Attempts to improve how clickable links are detected, highlighted and handled in TextView
Apache License 2.0
783 stars 77 forks source link

Allow long presses on links #5

Closed ehehhh closed 7 years ago

ehehhh commented 8 years ago

I feel like this library is missing an important feature - long press handling on the links.

saket commented 8 years ago

Sorry for replying so late @ehehhh. I was travelling for the past week. So I cannot think of situations where long-pressing on links will add any value over single-tapping them. Can you please help me understand this?

ehehhh commented 8 years ago

Hello @Saketme! I am currently building a messenger into our app and when a message contains a link, a user can choose to single-tap to open the link like normal, but also long press to open a small popup menu with the option to copy the link to clipboard. It's definitely not a very important feature, but a nice add-on to the library.

saket commented 8 years ago

Makes sense. I've seen Whatsapp and Telegram do this. But before we merge this to the library, can you please remove the GestureDetector? BetterLinkMovementMethod.java already has an onTouchEvent() where you can schedule a delayed handler and listen to long presses. This is also how Views listen to long presses. Your way looks kinda hacky :)

Also, sorry again for the late reply. I was occupied with Droidcon, which happened yesterday here in India.

saket commented 8 years ago

Update: I guess you've gotten busy. I'll try adding this support myself.

ehehhh commented 8 years ago

Hey, yeah, sorry, I've been quite busy, haven't got around to doing this. Would be great if you could add it :)

d3bt3ch commented 7 years ago

@Saketme Same problem here. I want to implement copy on long press.

saket commented 7 years ago

Sorry for not paying any attention to this. I will begin working on this tomorrow.

d3bt3ch commented 7 years ago

@Saketme Thanks :)

saket commented 7 years ago

@ehehhh I see you have made more useful changes to the library in your fork. Can you please open a PR for them, except for the last long-press support commit?

Update: Or nevermind, I ended up adding those changes for enabling long-click support :)

saket commented 7 years ago

This will be a part of v2.

saket commented 7 years ago

Update: v2 released!

@debjitk @ehehhh.