daniel-stoneuk / material-about-library

Makes it easy to create beautiful about screens for your apps
Apache License 2.0
1.12k stars 140 forks source link

Don't use LongClickListener by default #50

Closed Robyer closed 7 years ago

Robyer commented 7 years ago

Because of this: https://github.com/daniel-stoneuk/material-about-library/commit/7ef52e4be8023198e064211e95e7b3a125dc7853#diff-2fa9301a8938a1903a30c3ed37d9b6b2R279 and this: https://github.com/daniel-stoneuk/material-about-library/commit/7ef52e4be8023198e064211e95e7b3a125dc7853#diff-085050164284a0d3154349c07c6bc0dcR168

there is no way to not have onLongClickListener set. Which means every clickable item now react to long clicks too. Which is not desired, because calling View.setOnLongClickListener() internally changes behavior of the view -- it add haptic feedback (slight vibration) on long click.

IMHO having 2 separate listeners (as Android uses it on View) is much better. Usually you don't set same reaction to single click and long click + most of the time you don't even need the longClick.

So I would vote for reverting that unified OnClickListener. But if that's not acceptable for you, could you at least give us method like .setLongClickEnabled(boolean enabled) or similar, and make the longClick disabled by default?

Note that also your ConvenienceBuilder's methods are affected by this and so long click on any such item makes same reaction as single click, and that just feels weird.

Thanks.

daniel-stoneuk commented 7 years ago

Ah I see. I'm currently short of time so if you'd like to create a pull request separating them back into two OnClickListeners I would be extremely grateful.

Robyer commented 7 years ago

Ok, I will rework these listeners and provide pull request when it's ready.

Robyer commented 7 years ago

I was just writing that I prepared pull request, and you already merged it! :) Thanks.

Also I'm thinking about simplifying use of custom items (and also simplifying current code) by providing MaterialAboutBaseItem that will share the basics from both ActionItem and TitleItem (they will extend it). So probably I'll prepare another PR during next days :)