private MotionEvent transformEvent(MotionEvent e, int headerPosition) { if (headerPosition == MATCHED_STICKIED_HEADER) { return e; } long downTime = e.getDownTime(); long eventTime = e.getEventTime(); int action = e.getAction(); int pointerCount = e.getPointerCount(); int[] pointerIds = getPointerIds(e); MotionEvent.PointerCoords[] pointerCoords = getPointerCoords(e); int metaState = e.getMetaState(); float xPrecision = e.getXPrecision(); float yPrecision = e.getYPrecision(); int deviceId = e.getDeviceId(); int edgeFlags = e.getEdgeFlags(); int source = e.getSource(); int flags = e.getFlags(); View headerHolder = getChildAt(headerPosition); for (int i = 0; i < pointerCount;i++) { pointerCoords[i].y -= headerHolder.getTop(); } MotionEvent n = MotionEvent.obtain(downTime, eventTime, action, pointerCount, pointerIds, pointerCoords, metaState, xPrecision, yPrecision, deviceId, edgeFlags, source, flags); return n; }
check("buttonState()").that(actual().getButtonState()).isEqualTo(other.getButtonState()); check("deviceId()").that(actual().getDeviceId()).isEqualTo(other.getDeviceId()); check("getFlags()").that(actual().getFlags()).isEqualTo(other.getFlags()); check("getEdgeFlags()").that(actual().getEdgeFlags()).isEqualTo(other.getEdgeFlags()); check("getXPrecision()").that(actual().getXPrecision()).isEqualTo(other.getXPrecision());
@Override public boolean onFilterTouchEventForSecurity(MotionEvent event) { if ((event.getFlags() & MotionEvent.FLAG_WINDOW_IS_OBSCURED) == MotionEvent.FLAG_WINDOW_IS_OBSCURED){ // show error message return false; } return super.onFilterTouchEventForSecurity(event);
@Override public boolean dispatchTouchEvent(MotionEvent event) { /* * See comments for isTouchObscured above. */ isTouchObscured = (event.getFlags() & MotionEvent.FLAG_WINDOW_IS_OBSCURED) != 0; return super.dispatchTouchEvent(event); }
public boolean onTouch(View v, MotionEvent event) { if ((event.getFlags() & MotionEvent.FLAG_WINDOW_IS_OBSCURED) != 0) { if (event.getAction() == MotionEvent.ACTION_UP) { new AlertDialog.Builder(SecureView.this) .setTitle(R.string.secure_view_caught_dialog_title) .setMessage(R.string.secure_view_caught_dialog_message) .setNeutralButton(getResources().getString( R.string.secure_view_caught_dialog_dismiss), null) .show(); } // Return true to prevent the button from processing the touch. return true; } return false; } });
public boolean onTouch(View v, MotionEvent event) { if ((event.getFlags() & MotionEvent.FLAG_WINDOW_IS_OBSCURED) != 0) { if (event.getAction() == MotionEvent.ACTION_UP) { new AlertDialog.Builder(SecureView.this) .setTitle(R.string.secure_view_caught_dialog_title) .setMessage(R.string.secure_view_caught_dialog_message) .setNeutralButton(getResources().getString( R.string.secure_view_caught_dialog_dismiss), null) .show(); } // Return true to prevent the button from processing the touch. return true; } return false; } });
@TargetApi(14) public boolean onInterceptTouchEvent(MotionEvent e) { super.onInterceptTouchEvent(e); if (_shouldCapture) { if (_motionEvents.size() < _maxEvents) { boolean isObscured = (e.getFlags() & MotionEvent.FLAG_WINDOW_IS_OBSCURED) != 0; synchronized (_motionEvents) { _motionEvents.add(new AdUnitMotionEvent(e.getActionMasked(), isObscured, e.getToolType(0), e.getSource(), e.getDeviceId(), e.getX(0), e.getY(0), e.getEventTime(), e.getPressure(0), e.getSize(0))); } } } return false; }
ev.getEdgeFlags(), ev.getSource(), ev.getFlags());
.getXPrecision(), event.getYPrecision(), event .getDeviceId(), event.getEdgeFlags(), event.getSource(), event.getFlags());
private MotionEvent transformEvent(MotionEvent e, int headerPosition) { if (headerPosition == MATCHED_STICKIED_HEADER) { return e; } long downTime = e.getDownTime(); long eventTime = e.getEventTime(); int action = e.getAction(); int pointerCount = e.getPointerCount(); int[] pointerIds = getPointerIds(e); MotionEvent.PointerCoords[] pointerCoords = getPointerCoords(e); int metaState = e.getMetaState(); float xPrecision = e.getXPrecision(); float yPrecision = e.getYPrecision(); int deviceId = e.getDeviceId(); int edgeFlags = e.getEdgeFlags(); int source = e.getSource(); int flags = e.getFlags(); View headerHolder = getChildAt(headerPosition); for (int i = 0; i < pointerCount; i++) { pointerCoords[i].y -= headerHolder.getTop(); } MotionEvent n = MotionEvent.obtain(downTime, eventTime, action, pointerCount, pointerIds, pointerCoords, metaState, xPrecision, yPrecision, deviceId, edgeFlags, source, flags); return n; }
int edgeFlags = e.getEdgeFlags(); int source = e.getSource(); int flags = e.getFlags();