waleedAhmad1 / google-glass-api

Automatically exported from code.google.com/p/google-glass-api
0 stars 0 forks source link

ListView Not Scroll After Update to XE16 #479

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
After updating to Xe16 Scrolling through ListView is impossible

What version of the product are you using? On what operating system?
XE16

Original issue reported on code.google.com by Mark.Bi...@gmail.com on 19 Apr 2014 at 3:54

GoogleCodeExporter commented 9 years ago

Original comment by allev...@google.com on 23 Apr 2014 at 4:14

GoogleCodeExporter commented 9 years ago
I worked out a solution for this issue, using Gesture detector. It's simple to 
implement this. 
Check below -

    private GestureDetector createGestureDetector(Context context) {
    GestureDetector gestureDetector = new GestureDetector(context);
        //Create a base listener for generic gestures
        gestureDetector.setBaseListener( new GestureDetector.BaseListener() {
            @Override
            public boolean onGesture(Gesture gesture) {
                 if (gesture == Gesture.SWIPE_RIGHT) {
                    // do something on right (forward) swipe
                    LISTVIEW.setSelection(LISTVIEW.getSelectedItemPosition()+1);

                    return true;
                } else if (gesture == Gesture.SWIPE_LEFT) {
                    // do something on left (backwards) swipe
                    LISTVIEW.setSelection(LISTVIEW.getSelectedItemPosition()-1);
                    return true;
                }
                return false;
            }
        });
        gestureDetector.setFingerListener(new GestureDetector.FingerListener() {
            @Override
            public void onFingerCountChanged(int previousCount, int currentCount) {
              // do something on finger count changes
            }
        });
        gestureDetector.setScrollListener(new GestureDetector.ScrollListener() {
            @Override
            public boolean onScroll(float displacement, float delta, float velocity) {
                // do something on scrolling
            }
        });
        return gestureDetector;
    }

    /*
     * Send generic motion events to the gesture detector
     */
    @Override
    public boolean onGenericMotionEvent(MotionEvent event) {
        if (mGestureDetector != null) {
            return mGestureDetector.onMotionEvent(event);
        }
        return false;
    }

Original comment by birendra...@gmail.com on 24 Apr 2014 at 7:01