Example usage for android.view MotionEvent ACTION_SCROLL

List of usage examples for android.view MotionEvent ACTION_SCROLL

Introduction

In this page you can find the example usage for android.view MotionEvent ACTION_SCROLL.

Prototype

int ACTION_SCROLL

To view the source code for android.view MotionEvent ACTION_SCROLL.

Click Source Link

Document

Constant for #getActionMasked : The motion event contains relative vertical and/or horizontal scroll offsets.

Usage

From source file:com.appunite.list.AbsListView.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
@Override//from  www .ja  v a2 s . com
public boolean onGenericMotionEvent(MotionEvent event) {
    if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
        switch (event.getAction()) {
        case MotionEvent.ACTION_SCROLL: {
            if (mTouchMode == TOUCH_MODE_REST) {
                final float vscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
                if (vscroll != 0) {
                    final int delta = (int) (vscroll * getVerticalScrollFactorUnhide());
                    if (!trackMotionScroll(delta, delta)) {
                        return true;
                    }
                }
            }
        }
        }
    }
    return super.onGenericMotionEvent(event);
}