Example usage for android.view MotionEvent TOOL_TYPE_MOUSE

List of usage examples for android.view MotionEvent TOOL_TYPE_MOUSE

Introduction

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

Prototype

int TOOL_TYPE_MOUSE

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

Click Source Link

Document

Tool type constant: The tool is a mouse or trackpad.

Usage

From source file:org.protocoderrunner.apprunner.AppRunnerActivity.java

@Override
public boolean onGenericMotionEvent(MotionEvent event) {

    int action = event.getAction();
    int actionCode = event.getActionMasked();

    ArrayList<PPadView.TouchEvent> t = new ArrayList<PPadView.TouchEvent>();

    // check finger if down or up
    if (actionCode == MotionEvent.ACTION_POINTER_DOWN || actionCode == MotionEvent.ACTION_POINTER_UP) {

    }//from w ww .j  a  v  a2 s .  c  om

    if (event.getSource() == MotionEvent.TOOL_TYPE_MOUSE) {
        // if (event.getButtonState() == ac) {

        // }
    }

    // get positions per finger
    for (int i = 0; i < event.getPointerCount(); i++) {
        // TouchEvent o = new TouchEvent("finger", event.getPointerId(i),
        // action, (int) event.getX(),
        // (int) event.getY());
        // t.add(o);
    }

    //
    // FINGER 1 UP x y
    // FINGER 2 MOVE x y
    // MOUSE 3 MOVE x y

    // return touching;
    return super.onGenericMotionEvent(event);
}