Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #5 is not fixed #48

Open
GoogleCodeExporter opened this issue Apr 18, 2016 · 2 comments
Open

Issue #5 is not fixed #48

GoogleCodeExporter opened this issue Apr 18, 2016 · 2 comments

Comments

@GoogleCodeExporter
Copy link

Issue #5 is marked as fixed but as of Android 4.0 the behavior is back.

I have the latest version of the Wheel but running on a real device (Samsung 
Galaxy SII) with Android 4.0.4 the Wheel scrolls inside a ScrollView but it is 
VERY unresponsive. I need to make sure to click precisely in the center of the 
wheel hold my position for a moment and slowly scroll. With the same wheel 
outside of the ScrollView it functions flawlessly.

My layout:

--------------main layout
LinearLayout
 ScrollView
  LinearLayout
-----------------compound control layout
   LinearLayout
    WheelView
    WheelView
    WheelView

Not sure if it matters but the direct parent of the wheel is not the ScrollView 
so the call to getParent().requestDisallowInterceptTouchEvent(true) might not 
be working properly. The WheelView is inside a compound control and I believe 
the parent LinearLayout is being merged into the next parent so the end result 
overall is only 2 LinearLayouts not 3 (I could be mistaken about that). 

I tried to put a while loop in its place that recursively went through all 
parent checking for ScrollViews and making the appropriate call as needed but 
this didn't work either.

Original issue reported on code.google.com by akuse...@gmail.com on 4 Feb 2013 at 6:31

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

I found a solution to this. 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;
}

Original comment by akuse...@gmail.com on 4 Feb 2013 at 6:54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant