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

下面列出了怎么用android.support.v4.view.InputDeviceCompat的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: FimiX8-RE   文件: X8ValueSeakBarWithTip.java
private void readAttr(Context context, AttributeSet attrs) {
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.X8ValueSeakBarView);
    this.accuracy = a.getInteger(R.styleable.X8ValueSeakBarView_x8_value_accuracy, 1);
    this.title = a.getString(R.styleable.X8ValueSeakBarView_x8_value_title);
    this.suffix = a.getString(R.styleable.X8ValueSeakBarView_x8_value_suffix);
    this.closeColor = a.getColor(R.styleable.X8ValueSeakBarView_x8_value_close_color, -1);
    this.openColor = a.getColor(R.styleable.X8ValueSeakBarView_x8_value_open_color, InputDeviceCompat.SOURCE_ANY);
    this.seekBarMax = a.getFloat(R.styleable.X8ValueSeakBarView_x8_value_seekbar_max, 0.0f) * ((float) this.accuracy);
    this.seekBarMin = a.getFloat(R.styleable.X8ValueSeakBarView_x8_value_seekbar_min, 0.0f) * ((float) this.accuracy);
    this.seekBarDefault = a.getFloat(R.styleable.X8ValueSeakBarView_x8_value_seekbar_default, 0.0f);
    this.isFloat = a.getBoolean(R.styleable.X8ValueSeakBarView_x8_value_seekbar_float, false);
    a.recycle();
    if (this.isFloat) {
        this.MAX = (int) (this.seekBarMax - this.seekBarMin);
    } else {
        this.MAX = (int) (this.seekBarMax - this.seekBarMin);
    }
}
 
源代码2 项目: FimiX8-RE   文件: X8ValueSeakBarView.java
private void readAttr(Context context, AttributeSet attrs) {
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.X8ValueSeakBarView);
    this.accuracy = a.getInteger(R.styleable.X8ValueSeakBarView_x8_value_accuracy, 1);
    this.title = a.getString(R.styleable.X8ValueSeakBarView_x8_value_title);
    this.suffix = a.getString(R.styleable.X8ValueSeakBarView_x8_value_suffix);
    this.closeColor = a.getColor(R.styleable.X8ValueSeakBarView_x8_value_close_color, -1);
    this.openColor = a.getColor(R.styleable.X8ValueSeakBarView_x8_value_open_color, InputDeviceCompat.SOURCE_ANY);
    this.seekBarMax = a.getFloat(R.styleable.X8ValueSeakBarView_x8_value_seekbar_max, 0.0f) * ((float) this.accuracy);
    this.seekBarMin = a.getFloat(R.styleable.X8ValueSeakBarView_x8_value_seekbar_min, 0.0f) * ((float) this.accuracy);
    this.seekBarDefault = a.getFloat(R.styleable.X8ValueSeakBarView_x8_value_seekbar_default, 0.0f);
    this.isFloat = a.getBoolean(R.styleable.X8ValueSeakBarView_x8_value_seekbar_float, false);
    a.recycle();
    if (this.isFloat) {
        this.MAX = (int) (this.seekBarMax - this.seekBarMin);
    } else {
        this.MAX = (int) (this.seekBarMax - this.seekBarMin);
    }
}
 
源代码3 项目: FimiX8-RE   文件: ByteHexHelper.java
public static byte decodeBinaryString(String byteStr) {
    if (byteStr == null) {
        return (byte) 0;
    }
    int len = byteStr.length();
    if (len != 4 && len != 8) {
        return (byte) 0;
    }
    int re;
    if (len != 8) {
        re = Integer.parseInt(byteStr, 2);
    } else if (byteStr.charAt(0) == '0') {
        re = Integer.parseInt(byteStr, 2);
    } else {
        re = Integer.parseInt(byteStr, 2) + InputDeviceCompat.SOURCE_ANY;
    }
    return (byte) re;
}
 
源代码4 项目: FunnyDraw   文件: MotionEventFactory.java
static MotionEvent create(int action, long downTime, int x, int y) {
    MotionEvent event = MotionEvent.obtain(downTime, SystemClock.uptimeMillis(), action, x, y,
            1.0f,1.0f, 0, 1.0f, 1.0f, 0,
            0);
    event.setSource(InputDeviceCompat.SOURCE_TOUCHSCREEN);
    return event;
}
 
源代码5 项目: 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");
    }
}
 
源代码6 项目: 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));
    }
}
 
源代码7 项目: 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;
}
 
 类所在包
 类方法
 同包方法