当前位置: 首页>>代码示例>>Java>>正文


Java ViewConfiguration.getTouchSlop方法代码示例

本文整理汇总了Java中android.view.ViewConfiguration.getTouchSlop方法的典型用法代码示例。如果您正苦于以下问题:Java ViewConfiguration.getTouchSlop方法的具体用法?Java ViewConfiguration.getTouchSlop怎么用?Java ViewConfiguration.getTouchSlop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.ViewConfiguration的用法示例。


在下文中一共展示了ViewConfiguration.getTouchSlop方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onInterceptTouchEvent

import android.view.ViewConfiguration; //导入方法依赖的package包/类
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
    int y = (int) motionEvent.getY();
    com.tencent.open.a.f.b("XXXX", "onInterceptTouchEvent-- action = " + motionEvent.getAction() + "currentY = " + y);
    this.b.d(3000);
    switch (motionEvent.getAction()) {
        case 0:
            this.a = y;
            return false;
        case 1:
            if (this.a - y > ViewConfiguration.getTouchSlop() * 2) {
                this.b.l();
                return true;
            }
            break;
    }
    return super.onInterceptTouchEvent(motionEvent);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:18,代码来源:TaskGuide.java

示例2: onTouchEvent

import android.view.ViewConfiguration; //导入方法依赖的package包/类
public boolean onTouchEvent(MotionEvent motionEvent) {
    super.onTouchEvent(motionEvent);
    int y = (int) motionEvent.getY();
    com.tencent.open.a.f.b("XXXX", " onTouchEvent-----startY = " + this.a + "currentY = " + y);
    switch (motionEvent.getAction()) {
        case 0:
            this.a = y;
            break;
        case 1:
            if (this.a - y > ViewConfiguration.getTouchSlop() * 2) {
                this.b.l();
                break;
            }
            break;
    }
    return false;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:18,代码来源:TaskGuide.java

示例3: StylusEventHelper

import android.view.ViewConfiguration; //导入方法依赖的package包/类
/**
 * Constructs a helper for listening to stylus button presses and releases. Ensure that {
 * {@link #onMotionEvent(MotionEvent)} and {@link #onGenericMotionEvent(MotionEvent)} are called on
 * the helper to correctly identify stylus events.
 *
 * @param listener The listener to call for stylus events.
 * @param view Optional view associated with the touch events.
 */
public StylusEventHelper(StylusButtonListener listener, View view) {
    mListener = listener;
    mView = view;
    if (mView != null) {
        mSlop = ViewConfiguration.get(mView.getContext()).getScaledTouchSlop();
    } else {
        mSlop = ViewConfiguration.getTouchSlop();
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:18,代码来源:StylusEventHelper.java

示例4: onTouchEvent

import android.view.ViewConfiguration; //导入方法依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent event) {
    boolean isClickItem = false;
    int action = event.getActionMasked();
    switch (action) {
        case MotionEvent.ACTION_DOWN:
            mEventDown = MotionEvent.obtain(event);
            mDown = getClickItem(mEventDown);
            isClickItem = mDown > -1;
            break;
        case MotionEvent.ACTION_UP:
            if (mEventDown != null) {
                float distance = (float) Math.sqrt(Math.pow((event.getX() - mEventDown.getX()), 2) + Math.pow((event.getY() - mEventDown.getY()), 2));
                if (distance < ViewConfiguration.getTouchSlop()) {
                    int iUp = getClickItem(event);
                    if (mDown == iUp && iUp > -1) {
                        isClickItem = true;
                        if (onClickItemListener != null) {
                            onClickItemListener.onClick(iUp, new ArrayList<>(Arrays.asList(mImageUrls)));
                        }
                    }
                }
            }
            break;
    }
    return isClickItem || super.onTouchEvent(event);
}
 
开发者ID:HotBitmapGG,项目名称:Acg,代码行数:28,代码来源:MomentPicView.java

示例5: OnDefaultGestureListener

import android.view.ViewConfiguration; //导入方法依赖的package包/类
public OnDefaultGestureListener(@Nullable IPlayer p, @Nullable IPlayerControlView c) {
    this.mPlayer = p;
    this.mPlayerControlView = c;
    if (c != null && c.getContext() != null) {
        final ViewConfiguration configuration = ViewConfiguration.get(c.getContext().getApplicationContext());
        mTouchSlop = configuration.getScaledTouchSlop();
    } else {
        //noinspection deprecation
        mTouchSlop = ViewConfiguration.getTouchSlop();
    }
}
 
开发者ID:xinpianchang,项目名称:NSMPlayer-Android,代码行数:12,代码来源:OnDefaultGestureListener.java

示例6: onInterceptTouchEvent

import android.view.ViewConfiguration; //导入方法依赖的package包/类
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    mScroller.forceFinished(true);
    int type = MotionEventCompat.getActionMasked(ev);
    float currentX = MotionEventCompat.getX(ev, 0);
    float currentY = MotionEventCompat.getY(ev, 0);

    switch (type) {
        case MotionEvent.ACTION_DOWN:
            downX = currentX;
            downY = currentY;

            float x = firstView.getX() + firstView.getMeasuredWidth() / 2.0f;
            float y = firstView.getY() + firstView.getMeasuredHeight() / 2.0f;

            lastAngle = (float) getRelativeAngle(x, y);
            break;
        case MotionEvent.ACTION_MOVE:
            float distance = getDistance(downX, downY, currentX, currentY);
            if (distance > ViewConfiguration.getTouchSlop()) {
                return true;
            }
            break;
        case MotionEvent.ACTION_UP:

            break;
    }

    return false;
}
 
开发者ID:tortuvshin,项目名称:sign-android,代码行数:31,代码来源:CircleMenu.java

示例7: init

import android.view.ViewConfiguration; //导入方法依赖的package包/类
private void init(Context context, AttributeSet attrs) {
    setOrientation(1);
    this.mTouchSlop = ViewConfiguration.getTouchSlop();
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PullToRefresh);
    if (a.hasValue(22)) {
        this.mMode = a.getInteger(22, 1);
    }
    this.mRefreshableView = createRefreshableView(context, attrs);
    addRefreshableView(context, this.mRefreshableView);
    String pullLabel = context.getString(2131100695);
    String refreshingLabel = context.getString(2131100699);
    String releaseLabel = context.getString(2131100700);
    if (this.mMode == 1 || this.mMode == 3) {
        this.mHeaderLayout = new PullToRefreshHeaderView(context, 1, releaseLabel, pullLabel, refreshingLabel, this.objs);
        addView(this.mHeaderLayout, 0, new LayoutParams(-1, -2));
        measureView(this.mHeaderLayout);
        this.mHeaderHeight = this.mHeaderLayout.getMeasuredHeight();
    }
    if (this.mMode == 2 || this.mMode == 3) {
        this.mFooterLayout = new PullToRefreshHeaderView(context, 2, releaseLabel, pullLabel, refreshingLabel, this.objs);
        addView(this.mFooterLayout, new LayoutParams(-1, -2));
        measureView(this.mFooterLayout);
        this.mHeaderHeight = this.mFooterLayout.getMeasuredHeight();
    }
    if (a.hasValue(21)) {
        int color = a.getColor(21, -16777216);
        if (this.mHeaderLayout != null) {
            this.mHeaderLayout.setTextColor(color);
        }
        if (this.mFooterLayout != null) {
            this.mFooterLayout.setTextColor(color);
        }
    }
    if (a.hasValue(20)) {
        setBackgroundResource(a.getResourceId(20, 0));
    }
    if (a.hasValue(19)) {
        this.mRefreshableView.setBackgroundResource(a.getResourceId(19, 0));
    }
    a.recycle();
    switch (this.mMode) {
        case 2:
            setPadding(0, 0, 0, -this.mHeaderHeight);
            break;
        case 3:
            setPadding(0, -this.mHeaderHeight, 0, -this.mHeaderHeight);
            break;
        default:
            setPadding(0, -this.mHeaderHeight, 0, 0);
            break;
    }
    if (this.mMode != 3) {
        this.mCurrentMode = this.mMode;
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:56,代码来源:PullToRefreshBase.java


注:本文中的android.view.ViewConfiguration.getTouchSlop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。