Example usage for android.view MotionEvent BUTTON_STYLUS_SECONDARY

List of usage examples for android.view MotionEvent BUTTON_STYLUS_SECONDARY

Introduction

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

Prototype

int BUTTON_STYLUS_SECONDARY

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

Click Source Link

Document

Button constant: Secondary stylus button pressed.

Usage

From source file:com.android.systemui.statusbar.phone.NotificationPanelView.java

private boolean isOpenQsEvent(MotionEvent event) {
    final int pointerCount = event.getPointerCount();
    final int action = event.getActionMasked();

    final boolean twoFingerDrag = action == MotionEvent.ACTION_POINTER_DOWN && pointerCount == 2;

    final boolean stylusButtonClickDrag = action == MotionEvent.ACTION_DOWN
            && (event.isButtonPressed(MotionEvent.BUTTON_STYLUS_PRIMARY)
                    || event.isButtonPressed(MotionEvent.BUTTON_STYLUS_SECONDARY));

    final boolean mouseButtonClickDrag = action == MotionEvent.ACTION_DOWN
            && (event.isButtonPressed(MotionEvent.BUTTON_SECONDARY)
                    || event.isButtonPressed(MotionEvent.BUTTON_TERTIARY));
    boolean isOverride = true;

    return twoFingerDrag || isOverride || stylusButtonClickDrag || mouseButtonClickDrag;
}