0

In our app we use Android wheel lib. Problem is on Galaxy SII. The wheel works only when user touch it, move his finger on the side (out of the wheel) and then scroll up or down. Have anyone this problem too and possible solution?

Machavity
  • 30,841
  • 27
  • 92
  • 100
cecan
  • 25
  • 8

1 Answers1

0

This is a bug of the kankan android-wheel library. In WheelView.java on line 611 change the switch statement to the following:

switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN: //added to fix problem
    case MotionEvent.ACTION_MOVE:
        if (getParent() != null) {
            getParent().requestDisallowInterceptTouchEvent(true);
    }
    break;

    case MotionEvent.ACTION_UP:
        if (getParent() != null) { //added to fix problem, this may be uneeded
            getParent().requestDisallowInterceptTouchEvent(false);
        }

    if (!isScrollingPerformed) {
        int distance = (int) event.getY() - getHeight() / 2;
        if (distance > 0) {
            distance += getItemHeight() / 2;
        } else {
                distance -= getItemHeight() / 2;
        }
        int items = distance / getItemHeight();
        if (items != 0 && isValidItemIndex(currentItem + items)) {
                notifyClickListenersAboutClick(currentItem + items);
            }
    }
    break;
}
endian
  • 4,761
  • 7
  • 32
  • 54