Java 类android.support.v4.view.InputDeviceCompat 实例源码

项目:airgram    文件:RecyclerView.java   
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;
}
项目:letv    文件:FragmentActivity.java   
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");
    }
}
项目:letv    文件:FragmentActivity.java   
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));
    }
}
项目:PlusGram    文件:RecyclerView.java   
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;
}
项目:boohee_v5.6    文件:InstructionCodec.java   
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");
    }
}
项目:boohee_v5.6    文件:Base256Encoder.java   
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);
}
项目:boohee_v5.6    文件:FragmentActivity.java   
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");
    }
}
项目:boohee_v5.6    文件:FragmentActivity.java   
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));
    }
}
项目:NestedScroll    文件:SSScrollView.java   
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;
}
项目:TwoWayNestedScrollView    文件:TwoWayNestedScrollView.java   
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;
}
项目:MyBlogDemo    文件:NestedScrollView.java   
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;
}
项目:Telegram    文件:RecyclerView.java   
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;
}
项目:boohee_v5.6    文件:TableOfContents.java   
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);
    }
}
项目:boohee_v5.6    文件:TableOfContents.java   
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);
    }
}
项目:androidScreenShareAndControl    文件:Main.java   
private static void menu() throws InvocationTargetException, IllegalAccessException {
    sendKeyEvent(im, injectInputEventMethod, InputDeviceCompat.SOURCE_KEYBOARD, KeyEvent.KEYCODE_MENU, false);
}
项目:androidScreenShareAndControl    文件:Main.java   
private static void back() throws InvocationTargetException, IllegalAccessException {
    sendKeyEvent(im, injectInputEventMethod, InputDeviceCompat.SOURCE_KEYBOARD, 4, false);
}
项目:androidScreenShareAndControl    文件:Main.java   
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);
}
项目:androidScreenShareAndControl    文件:Main.java   
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);
}
项目:androidScreenShareAndControl    文件:Main.java   
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);

}
项目:androidScreenShareAndControl    文件:Main.java   
private static void pressHome() throws InvocationTargetException, IllegalAccessException {
    sendKeyEvent(im, injectInputEventMethod, InputDeviceCompat.SOURCE_KEYBOARD, 3, false);
}