AnderWeb / discreteSeekBar

Apache License 2.0
2.11k stars 400 forks source link

Issue 37 Fix #45

Closed Teja-Konjeti closed 8 years ago

Teja-Konjeti commented 8 years ago

Fix Solving Basic Tap to set Progress as in Issue 37 (https://github.com/AnderWeb/discreteSeekBar/issues/37) Added

Vandalko commented 8 years ago

It's, actually, a nasty hack - touch slop is used to detect intentional user finger movements. In order to fix https://github.com/AnderWeb/discreteSeekBar/issues/37 you have to properly process MotionEvent.ACTION_DOWN event.

There is an issue with SeekBarCompatDontCrash.isInScrollingContainer method - it is another hack to skip touches when user just want to scroll the form.

So, there are two possible solutions: quick and easy Ignore ignoreTrackIfInScrollContainer parameter when mAllowTrackClick == true so touch would immediately set the thumb in proper place. But then it brings an issue with scroll - touches would trigger progress change even if user just wanted to scroll the form.

better way Track clicks. Yes, if touch movement was less than mTouchSlop, then simply fire click event when MotionEvent.ACTION_UP arrives. Cancel tracking if mTouchSlop distance achieved or MotionEvent.ACTION_CANCEL fired. This would allow to move thumb by clicking anywhere on the view while maintaining proper scroll behavior.

Teja-Konjeti commented 8 years ago

@vandalko but touchslop in d context of a seek bar just doesn't make any sense i guess, nd if i simply fire click event when MotionEvent.ACTION_UP arrives the popup indicator won't showup. That's why I made touch slop -1 by default and gave the programmer to add touch slop simply from xml if he wants it !

AnderWeb commented 8 years ago

Hi guys, thanks for the different solutions. In the end, I've used some code taken from https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/widget/AbsSeekBar.java#601 and I think is simpler and works pretty well.

If you find any issue with it, please reopen the issue or create a new one.

Thank you!

Vandalko commented 8 years ago

@AnderWeb I would be very grateful if you would announce the release date of that fix :)

AnderWeb commented 8 years ago

Probably in a couple days, I'm checking for other blocker issues.