Example usage for android.view MotionEvent TOOL_TYPE_FINGER

List of usage examples for android.view MotionEvent TOOL_TYPE_FINGER

Introduction

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

Prototype

int TOOL_TYPE_FINGER

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

Click Source Link

Document

Tool type constant: The tool is a finger.

Usage

From source file:com.mylikes.likes.etchasketch.Slate.java

@SuppressLint("NewApi")
final static int getToolTypeCompat(MotionEvent me, int index) {
    if (hasToolType()) {
        return me.getToolType(index);
    }//from ww  w  .j  a v  a2s  . co  m

    // dirty hack for the HTC Flyer
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
        if ("flyer".equals(Build.HARDWARE)) {
            if (me.getSize(index) <= 0.1f) {
                // with very high probability this is the stylus
                return MotionEvent.TOOL_TYPE_STYLUS;
            }
        }
    }

    return MotionEvent.TOOL_TYPE_FINGER;
}

From source file:com.undatech.opaque.RemoteCanvasActivity.java

@Override
public boolean onGenericMotionEvent(MotionEvent event) {
    // Ignore TOOL_TYPE_FINGER events that come from the touchscreen with y == 0.0
    // which cause pointer jumping trouble for some users.
    if (!(event.getY() == 0.0f && event.getSource() == InputDevice.SOURCE_TOUCHSCREEN
            && event.getToolType(0) == MotionEvent.TOOL_TYPE_FINGER)) {
        try {//from w w  w  .j  a va 2 s. c om
            return inputHandler.onTouchEvent(event);
        } catch (NullPointerException e) {
        }
    }
    return super.onGenericMotionEvent(event);
}

From source file:com.iiordanov.bVNC.RemoteCanvasActivity.java

@Override
public boolean onGenericMotionEvent(MotionEvent event) {
    // Ignore TOOL_TYPE_FINGER events that come from the touchscreen with HOVER type action
    // which cause pointer jumping trouble in simulated touchpad for some devices.
    int a = event.getAction();
    if (!((a == MotionEvent.ACTION_HOVER_ENTER || a == MotionEvent.ACTION_HOVER_EXIT
            || a == MotionEvent.ACTION_HOVER_MOVE) && event.getSource() == InputDevice.SOURCE_TOUCHSCREEN
            && event.getToolType(0) == MotionEvent.TOOL_TYPE_FINGER)) {
        try {/*  w  ww  .  ja va  2s  .  co  m*/
            return inputHandler.onTouchEvent(event);
        } catch (NullPointerException e) {
        }
    }
    return super.onGenericMotionEvent(event);
}