當前位置: 首頁>>代碼示例>>Java>>正文


Java MotionEventCompat.getPointerCount方法代碼示例

本文整理匯總了Java中android.support.v4.view.MotionEventCompat.getPointerCount方法的典型用法代碼示例。如果您正苦於以下問題:Java MotionEventCompat.getPointerCount方法的具體用法?Java MotionEventCompat.getPointerCount怎麽用?Java MotionEventCompat.getPointerCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v4.view.MotionEventCompat的用法示例。


在下文中一共展示了MotionEventCompat.getPointerCount方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: PhotoViewAttacher

import android.support.v4.view.MotionEventCompat; //導入方法依賴的package包/類
public PhotoViewAttacher(ImageView imageView, boolean zoomable) {
    mImageView = new WeakReference<>(imageView);

    imageView.setDrawingCacheEnabled(true);
    imageView.setOnTouchListener(this);

    ViewTreeObserver observer = imageView.getViewTreeObserver();
    if (null != observer)
        observer.addOnGlobalLayoutListener(this);

    // Make sure we using MATRIX Scale Type
    setImageViewScaleTypeMatrix(imageView);

    if (imageView.isInEditMode()) {
        return;
    }
    // Create Gesture Detectors...
    mScaleDragDetector = VersionedGestureDetector.newInstance(
            imageView.getContext(), this);

    mGestureDetector = new GestureDetector(imageView.getContext(),
            new GestureDetector.SimpleOnGestureListener() {

                // forward long click listener
                @Override
                public void onLongPress(MotionEvent e) {
                    if (null != mLongClickListener) {
                        mLongClickListener.onLongClick(getImageView());
                    }
                }

                @Override
                public boolean onFling(MotionEvent e1, MotionEvent e2,
                                       float velocityX, float velocityY) {
                    if (mSingleFlingListener != null) {
                        if (getScale() > DEFAULT_MIN_SCALE) {
                            return false;
                        }

                        if (MotionEventCompat.getPointerCount(e1) > SINGLE_TOUCH
                                || MotionEventCompat.getPointerCount(e2) > SINGLE_TOUCH) {
                            return false;
                        }

                        return mSingleFlingListener.onFling(e1, e2, velocityX, velocityY);
                    }
                    return false;
                }
            });

    mGestureDetector.setOnDoubleTapListener(new DefaultOnDoubleTapListener(this));
    mBaseRotation = 0.0f;

    // Finally, update the UI so that we're zoomable
    setZoomable(zoomable);
}
 
開發者ID:joelan,項目名稱:ClouldReader,代碼行數:57,代碼來源:PhotoViewAttacher.java

示例2: saveLastMotion

import android.support.v4.view.MotionEventCompat; //導入方法依賴的package包/類
private void saveLastMotion(MotionEvent ev) {
    final int pointerCount = MotionEventCompat.getPointerCount(ev);
    for (int i = 0; i < pointerCount; i++) {
        final int pointerId = MotionEventCompat.getPointerId(ev, i);
        final float x = MotionEventCompat.getX(ev, i);
        final float y = MotionEventCompat.getY(ev, i);
        mLastMotionX[pointerId] = x;
        mLastMotionY[pointerId] = y;
    }
}
 
開發者ID:houshuai0816,項目名稱:DragVideos,代碼行數:11,代碼來源:CustomViewDragHelper.java

示例3: saveLastMotion

import android.support.v4.view.MotionEventCompat; //導入方法依賴的package包/類
private void saveLastMotion(MotionEvent ev) {
	final int pointerCount = MotionEventCompat.getPointerCount(ev);
	for (int i = 0; i < pointerCount; i++) {
		final int pointerId = MotionEventCompat.getPointerId(ev, i);
		final float x = MotionEventCompat.getX(ev, i);
		final float y = MotionEventCompat.getY(ev, i);
		if (mLastMotionX != null && mLastMotionY != null) {
			mLastMotionX[pointerId] = x;
			mLastMotionY[pointerId] = y;
		}
	}
}
 
開發者ID:dibakarece,項目名稱:DMAudioStreamer,代碼行數:13,代碼來源:ViewDragHelper.java

示例4: saveLastMotion

import android.support.v4.view.MotionEventCompat; //導入方法依賴的package包/類
private void saveLastMotion(MotionEvent ev) {
    int pointerCount = MotionEventCompat.getPointerCount(ev);
    for (int i = 0; i < pointerCount; i++) {
        int pointerId = MotionEventCompat.getPointerId(ev, i);
        float x = MotionEventCompat.getX(ev, i);
        float y = MotionEventCompat.getY(ev, i);
        this.mLastMotionX[pointerId] = x;
        this.mLastMotionY[pointerId] = y;
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:11,代碼來源:ViewDragHelper.java

示例5: saveLastMotion

import android.support.v4.view.MotionEventCompat; //導入方法依賴的package包/類
private void saveLastMotion(MotionEvent ev) {
    final int pointerCount = MotionEventCompat.getPointerCount(ev);
    for (int i = 0; i < pointerCount; i++) {
        final int pointerId = MotionEventCompat.getPointerId(ev, i);
        final float x = MotionEventCompat.getX(ev, i);
        final float y = MotionEventCompat.getY(ev, i);
        // Sometimes we can try and save last motion for a pointer never recorded in initial motion. In this case we just discard it.
        if (mLastMotionX != null && mLastMotionY != null
                && mLastMotionX.length > pointerId && mLastMotionY.length > pointerId) {
            mLastMotionX[pointerId] = x;
            mLastMotionY[pointerId] = y;
        }
    }
}
 
開發者ID:eventtus,項目名稱:photo-editor-android,代碼行數:15,代碼來源:ViewDragHelper.java

示例6: saveLastMotion

import android.support.v4.view.MotionEventCompat; //導入方法依賴的package包/類
private void saveLastMotion(MotionEvent ev) {
    final int pointerCount = MotionEventCompat.getPointerCount(ev);
    for (int i = 0; i < pointerCount; i++) {
        final int pointerId = MotionEventCompat.getPointerId(ev, i);
        final float x = MotionEventCompat.getX(ev, i);
        final float y = MotionEventCompat.getY(ev, i);
        if (mLastMotionX != null && mLastMotionY != null) {
            mLastMotionX[pointerId] = x;
            mLastMotionY[pointerId] = y;
        }
    }
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:13,代碼來源:ViewDragHelper.java

示例7: PhotoViewAttacher

import android.support.v4.view.MotionEventCompat; //導入方法依賴的package包/類
private PhotoViewAttacher(ImageView imageView, boolean zoomable) {
    mImageView = new WeakReference<>(imageView);

    imageView.setDrawingCacheEnabled(true);
    imageView.setOnTouchListener(this);

    ViewTreeObserver observer = imageView.getViewTreeObserver();
    if (null != observer)
        observer.addOnGlobalLayoutListener(this);

    // Make sure we using MATRIX Scale Type
    setImageViewScaleTypeMatrix(imageView);

    if (imageView.isInEditMode()) {
        return;
    }
    // Create Gesture Detectors...
    mScaleDragDetector = VersionedGestureDetector.newInstance(
            imageView.getContext(), this);

    mGestureDetector = new GestureDetector(imageView.getContext(),
            new GestureDetector.SimpleOnGestureListener() {

                // forward long click listener
                @Override
                public void onLongPress(MotionEvent e) {
                    if (null != mLongClickListener) {
                        mLongClickListener.onLongClick(getImageView());
                    }
                }

                @Override
                public boolean onFling(MotionEvent e1, MotionEvent e2,
                                       float velocityX, float velocityY) {
                    if (mSingleFlingListener != null) {
                        if (getScale() > DEFAULT_MIN_SCALE) {
                            return false;
                        }

                        if (MotionEventCompat.getPointerCount(e1) > SINGLE_TOUCH
                                || MotionEventCompat.getPointerCount(e2) > SINGLE_TOUCH) {
                            return false;
                        }

                        return mSingleFlingListener.onFling(e1, e2, velocityX, velocityY);
                    }
                    return false;
                }
            });

    mGestureDetector.setOnDoubleTapListener(new DefaultOnDoubleTapListener(this));
    mBaseRotation = 0.0f;

    // Finally, update the UI so that we're zoomable
    setZoomable(zoomable);
}
 
開發者ID:wuhighway,項目名稱:DailyStudy,代碼行數:57,代碼來源:PhotoViewAttacher.java

示例8: PhotoViewAttacher

import android.support.v4.view.MotionEventCompat; //導入方法依賴的package包/類
public PhotoViewAttacher(ImageView imageView, boolean zoomable) {
    mImageView = new WeakReference<>(imageView);

    imageView.setDrawingCacheEnabled(true);
    imageView.setOnTouchListener(this);

    ViewTreeObserver observer = imageView.getViewTreeObserver();
    if (null != observer)
        observer.addOnGlobalLayoutListener(this);

    // Make sure we using MATRIX Scale Type
    setImageViewScaleTypeMatrix(imageView);

    if (imageView.isInEditMode()) {
        return;
    }
    // Create Gesture Detectors...
    mScaleDragDetector = VersionedGestureDetector.newInstance(imageView.getContext(), this);

    mGestureDetector = new GestureDetector(imageView.getContext(),
            new GestureDetector.SimpleOnGestureListener() {

                // forward long click listener
                @Override
                public void onLongPress(MotionEvent e) {
                    if (null != mLongClickListener) {
                        mLongClickListener.onLongClick(getImageView());
                    }
                }

                @Override
                public boolean onFling(MotionEvent e1, MotionEvent e2,
                                       float velocityX, float velocityY) {
                    if (mSingleFlingListener != null) {
                        if (getScale() > DEFAULT_MIN_SCALE) {
                            return false;
                        }

                        if (MotionEventCompat.getPointerCount(e1) > SINGLE_TOUCH
                                || MotionEventCompat.getPointerCount(e2) > SINGLE_TOUCH) {
                            return false;
                        }

                        return mSingleFlingListener.onFling(e1, e2, velocityX, velocityY);
                    }
                    return false;
                }
            });

    mGestureDetector.setOnDoubleTapListener(new DefaultOnDoubleTapListener(this));
    mBaseRotation = 0.0f;

    // Finally, update the UI so that we're zoomable
    setZoomable(zoomable);
}
 
開發者ID:WeiXinqiao,項目名稱:Recognize-it,代碼行數:56,代碼來源:PhotoViewAttacher.java


注:本文中的android.support.v4.view.MotionEventCompat.getPointerCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。