public boolean onGenericMotionEvent(MotionEvent event) { if (mLayout == null) { return false; } if (mLayoutFrozen) { return false; } if ((MotionEventCompat.getSource(event) & InputDeviceCompat.SOURCE_CLASS_POINTER) != 0) { if (event.getAction() == MotionEventCompat.ACTION_SCROLL) { final float vScroll, hScroll; if (mLayout.canScrollVertically()) { // Inverse the sign of the vertical scroll to align the scroll orientation // with AbsListView. vScroll = -MotionEventCompat .getAxisValue(event, MotionEventCompat.AXIS_VSCROLL); } else { vScroll = 0f; } if (mLayout.canScrollHorizontally()) { hScroll = MotionEventCompat .getAxisValue(event, MotionEventCompat.AXIS_HSCROLL); } else { hScroll = 0f; } if (vScroll != 0 || hScroll != 0) { final float scrollFactor = getScrollFactor(); scrollByInternal((int) (hScroll * scrollFactor), (int) (vScroll * scrollFactor), event); } } } return false; }
public final void validateRequestPermissionsRequestCode(int requestCode) { if (this.mRequestedPermissionsFromFragment) { this.mRequestedPermissionsFromFragment = false; } else if ((requestCode & InputDeviceCompat.SOURCE_ANY) != 0) { throw new IllegalArgumentException("Can only use lower 8 bits for requestCode"); } }
private void requestPermissionsFromFragment(Fragment fragment, String[] permissions, int requestCode) { if (requestCode == -1) { ActivityCompat.requestPermissions(this, permissions, requestCode); } else if ((requestCode & InputDeviceCompat.SOURCE_ANY) != 0) { throw new IllegalArgumentException("Can only use lower 8 bits for requestCode"); } else { this.mRequestedPermissionsFromFragment = true; ActivityCompat.requestPermissions(this, permissions, ((fragment.mIndex + 1) << 8) + (requestCode & 255)); } }
public static short codeUnit(int lowByte, int highByte) { if ((lowByte & InputDeviceCompat.SOURCE_ANY) != 0) { throw new IllegalArgumentException("bogus lowByte"); } else if ((highByte & InputDeviceCompat.SOURCE_ANY) == 0) { return (short) ((highByte << 8) | lowByte); } else { throw new IllegalArgumentException("bogus highByte"); } }
private static char randomize255State(char ch, int codewordPosition) { int tempVariable = ch + (((codewordPosition * 149) % 255) + 1); if (tempVariable <= 255) { return (char) tempVariable; } return (char) (tempVariable + InputDeviceCompat.SOURCE_ANY); }
public boolean onGenericMotionEvent(MotionEvent event) { if ((MotionEventCompat.getSource(event) & InputDeviceCompat.SOURCE_CLASS_POINTER) != 0) { switch (event.getAction()) { case MotionEventCompat.ACTION_SCROLL: { if (!mIsBeingDragged) { final float vscroll = MotionEventCompat.getAxisValue(event, MotionEventCompat.AXIS_VSCROLL); if (vscroll != 0) { final int delta = (int) (vscroll * getVerticalScrollFactorCompat()); final int range = getScrollRange(); int oldScrollY = getScrollY(); int newScrollY = oldScrollY - delta; if (newScrollY < 0) { newScrollY = 0; } else if (newScrollY > range) { newScrollY = range; } if (newScrollY != oldScrollY) { super.scrollTo(getScrollX(), newScrollY); return true; } } } } } } return false; }
public boolean onGenericMotionEvent(MotionEvent event) { if ((MotionEventCompat.getSource(event) & InputDeviceCompat.SOURCE_CLASS_POINTER) != 0) { switch (event.getAction()) { case MotionEventCompat.ACTION_SCROLL: { if (!mIsBeingDragged) { final float vscroll = MotionEventCompat.getAxisValue(event, MotionEventCompat.AXIS_VSCROLL); if (vscroll != 0) { final int delta = (int) (vscroll * getVerticalScrollFactorCompat()); final int range = getVerticalScrollRange(); int oldScrollY = getScrollY(); int newScrollY = oldScrollY - delta; if (newScrollY < 0) { newScrollY = 0; } else if (newScrollY > range) { newScrollY = range; } if (newScrollY != oldScrollY) { super.scrollTo(getScrollX(), newScrollY); return true; } } } } } } return false; }
public boolean onGenericMotionEvent(MotionEvent event) { if (mLayout == null) { return false; } if (mLayoutFrozen) { return false; } if ((event.getSource() & InputDeviceCompat.SOURCE_CLASS_POINTER) != 0) { if (event.getAction() == MotionEventCompat.ACTION_SCROLL) { final float vScroll, hScroll; if (mLayout.canScrollVertically()) { // Inverse the sign of the vertical scroll to align the scroll orientation // with AbsListView. vScroll = -MotionEventCompat .getAxisValue(event, MotionEventCompat.AXIS_VSCROLL); } else { vScroll = 0f; } if (mLayout.canScrollHorizontally()) { hScroll = MotionEventCompat .getAxisValue(event, MotionEventCompat.AXIS_HSCROLL); } else { hScroll = 0f; } if (vScroll != 0 || hScroll != 0) { final float scrollFactor = getScrollFactor(); scrollByInternal((int) (hScroll * scrollFactor), (int) (vScroll * scrollFactor), event); } } } return false; }
private int remapTypeOrderId(int type) { switch (type) { case 0: return 0; case 1: return 1; case 2: return 2; case 3: return 3; case 4: return 4; case 5: return 5; case 6: return 6; case 4096: return 17; case FragmentTransaction.TRANSIT_FRAGMENT_OPEN /*4097*/: return 8; case InputDeviceCompat.SOURCE_TOUCHSCREEN /*4098*/: return 11; case FragmentTransaction.TRANSIT_FRAGMENT_FADE /*4099*/: return 10; case 8192: return 15; case 8193: return 14; case 8194: return 7; case 8195: return 13; case 8196: return 9; case 8197: return 16; case 8198: return 12; default: throw new IllegalArgumentException("unknown section type: " + type); } }
public Section getSectionByType(int type) { switch (type) { case 0: return this.header; case 1: return this.stringIds; case 2: return this.typeIds; case 3: return this.protoIds; case 4: return this.fieldIds; case 5: return this.methodIds; case 6: return this.classDefs; case 4096: return this.mapList; case FragmentTransaction.TRANSIT_FRAGMENT_OPEN /*4097*/: return this.typeLists; case InputDeviceCompat.SOURCE_TOUCHSCREEN /*4098*/: return this.annotationSetRefLists; case FragmentTransaction.TRANSIT_FRAGMENT_FADE /*4099*/: return this.annotationSets; case 8192: return this.classDatas; case 8193: return this.codes; case 8194: return this.stringDatas; case 8195: return this.debugInfos; case 8196: return this.annotations; case 8197: return this.encodedArrays; case 8198: return this.annotationsDirectories; default: throw new IllegalArgumentException("unknown section type: " + type); } }
private static void menu() throws InvocationTargetException, IllegalAccessException { sendKeyEvent(im, injectInputEventMethod, InputDeviceCompat.SOURCE_KEYBOARD, KeyEvent.KEYCODE_MENU, false); }
private static void back() throws InvocationTargetException, IllegalAccessException { sendKeyEvent(im, injectInputEventMethod, InputDeviceCompat.SOURCE_KEYBOARD, 4, false); }
private static void touchUp(float clientX, float clientY) throws InvocationTargetException, IllegalAccessException { injectMotionEvent(im, injectInputEventMethod, InputDeviceCompat.SOURCE_TOUCHSCREEN, 1, downTime, SystemClock.uptimeMillis(), clientX, clientY, 1.0f); }
private static void touchMove(float clientX, float clientY) throws InvocationTargetException, IllegalAccessException { injectMotionEvent(im, injectInputEventMethod, InputDeviceCompat.SOURCE_TOUCHSCREEN, 2, downTime, SystemClock.uptimeMillis(), clientX, clientY, 1.0f); }
private static void touchDown(float clientX, float clientY) throws InvocationTargetException, IllegalAccessException { downTime = SystemClock.uptimeMillis(); injectMotionEvent(im, injectInputEventMethod, InputDeviceCompat.SOURCE_TOUCHSCREEN, 0, downTime, downTime, clientX, clientY, 1.0f); }
private static void pressHome() throws InvocationTargetException, IllegalAccessException { sendKeyEvent(im, injectInputEventMethod, InputDeviceCompat.SOURCE_KEYBOARD, 3, false); }