當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。