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


Java GestureDetector.SimpleOnGestureListener方法代码示例

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


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

示例1: PhotoViewAttacher

import android.view.GestureDetector; //导入方法依赖的package包/类
public PhotoViewAttacher(ImageView imageView) {
	mImageView = new WeakReference<ImageView>(imageView);

	imageView.setOnTouchListener(this);

	mViewTreeObserver = imageView.getViewTreeObserver();
	mViewTreeObserver.addOnGlobalLayoutListener(this);

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

	if (!imageView.isInEditMode()) {
		// 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(mImageView.get());
						}
					}
				});

		mGestureDetector.setOnDoubleTapListener(this);

		// Finally, update the UI so that we're zoomable
		setZoomable(true);
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:35,代码来源:PhotoViewAttacher.java

示例2: FlingPlayBackController

import android.view.GestureDetector; //导入方法依赖的package包/类
public FlingPlayBackController(Context context) {
    flingPlayBackController = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
            if (Math.abs(velocityX) > Math.abs(velocityY)) {
                if (velocityX < 0) {
                    MusicPlayerRemote.playNextSong();
                    return true;
                } else if (velocityX > 0) {
                    MusicPlayerRemote.playPreviousSong();
                    return true;
                }
            }
            return false;
        }
    });
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:18,代码来源:MiniPlayerFragment.java

示例3: PhotoViewAttacher

import android.view.GestureDetector; //导入方法依赖的package包/类
public PhotoViewAttacher(ImageView imageView) {
    mImageView = new WeakReference<ImageView>(imageView);

    imageView.setOnTouchListener(this);

    mViewTreeObserver = imageView.getViewTreeObserver();
    mViewTreeObserver.addOnGlobalLayoutListener(this);

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

    if (!imageView.isInEditMode()) {
        // 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(mImageView.get());
                        }
                    }
                });

        mGestureDetector.setOnDoubleTapListener(this);

        // Finally, update the UI so that we're zoomable
        setZoomable(true);
    }
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:34,代码来源:PhotoViewAttacher.java

示例4: PhotoViewAttacher

import android.view.GestureDetector; //导入方法依赖的package包/类
public PhotoViewAttacher(ImageView imageView) {
    mImageView = new WeakReference<ImageView>(imageView);

    imageView.setOnTouchListener(this);

    mViewTreeObserver = imageView.getViewTreeObserver();
    mViewTreeObserver.addOnGlobalLayoutListener(this);

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

    if (!imageView.isInEditMode()) {
        // 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(mImageView.get());
                }
            }
        });

        mGestureDetector.setOnDoubleTapListener(this);

        // Finally, addOrUpdate the UI so that we're zoomable
        setZoomable(true);
    }
}
 
开发者ID:liuke2016,项目名称:filepicker,代码行数:33,代码来源:PhotoViewAttacher.java

示例5: PhotoViewAttacher

import android.view.GestureDetector; //导入方法依赖的package包/类
public PhotoViewAttacher(ImageView imageView) {
    mImageView = new WeakReference<ImageView>(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) {
                    try {
                    if (null != mLongClickListener) {
                        mLongClickListener.onLongClick(getImageView());
                    }
                    }catch (Exception exception){}
                }
            });

    mGestureDetector.setOnDoubleTapListener(new DefaultOnDoubleTapListener(this));

    // Finally, update the UI so that we're zoomable
    setZoomable(true);
}
 
开发者ID:yun2win,项目名称:tvConnect_android,代码行数:39,代码来源:PhotoViewAttacher.java

示例6: PhotoViewAttacher

import android.view.GestureDetector; //导入方法依赖的package包/类
public PhotoViewAttacher(ImageView imageView) {
	mImageView = new WeakReference<ImageView>(imageView);

	imageView.setOnTouchListener(this);

	mViewTreeObserver = imageView.getViewTreeObserver();
	mViewTreeObserver.addOnGlobalLayoutListener(this);

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

	if (!imageView.isInEditMode()) {
		// 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(mImageView.get());
						}
					}
				});

		mGestureDetector.setOnDoubleTapListener(this);

		// Finally, update the UI so that we're zoomable
		setZoomable(true);
	}
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:34,代码来源:PhotoViewAttacher.java

示例7: setFilingGesture

import android.view.GestureDetector; //导入方法依赖的package包/类
private void setFilingGesture(Context context) {
    mFlingDetector = new GestureDetector(context,new GestureDetector.SimpleOnGestureListener(){
        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {

            if (mTranslateEnabled && mReadySent && mViewTranslate != null && e1 != null && e2 != null
                    && (Math.abs(e1.getX() - e2.getX()) > 50 || Math.abs(e1.getY() - e2.getY()) > 50)
                    && (Math.abs(velocityX) > 500 || Math.abs(velocityY) > 500) && !mIsZooming) {
                PointF vTranslateEnd =
                        new PointF(mViewTranslate.x + (velocityX * 0.25f), mViewTranslate.y + (velocityY * 0.25f));
                float sCenterXEnd = ((getWidth() / 2.0F) - vTranslateEnd.x) / mScale;
                float sCenterYEnd = ((getHeight() / 2.0F) - vTranslateEnd.y) / mScale;
                startFilingAnimation(sCenterXEnd, sCenterYEnd);
                if (BuildConfig.DEBUG) Log.d(TAG, "onFling: 正在滑行");
                return true;
            }
            return false;
        }
    });
}
 
开发者ID:EvilBT,项目名称:HDImageView,代码行数:21,代码来源:HDImageView.java

示例8: initGestureDetector

import android.view.GestureDetector; //导入方法依赖的package包/类
private void initGestureDetector() {
    //手势处理
    mGestureDetector = new GestureDetector(getContext(),
            new GestureDetector.SimpleOnGestureListener(){
        @Override
        public boolean onSingleTapUp(MotionEvent e) {
            if (mOnItemClickListener!=null){
                if (mAdapter instanceof LoopPagerAdapter){
                    int i = mViewPager.getCurrentItem() % ((LoopPagerAdapter) mAdapter)
                            .getRealCount();
                    mOnItemClickListener.onItemClick(i);
                }else {
                    mOnItemClickListener.onItemClick(mViewPager.getCurrentItem());
                }
            }
            return super.onSingleTapUp(e);
        }
    });
}
 
开发者ID:yangchong211,项目名称:YCBanner,代码行数:20,代码来源:BannerView.java

示例9: RecyclerItemClickListener

import android.view.GestureDetector; //导入方法依赖的package包/类
public RecyclerItemClickListener(Context context, OnItemClickListener listener) {
	mListener = listener;
	mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
		@Override
		public boolean onSingleTapUp(MotionEvent e) {
			return true;
		}
	});
}
 
开发者ID:Komdosh,项目名称:SocEltech,代码行数:10,代码来源:RecyclerItemClickListener.java

示例10: init

import android.view.GestureDetector; //导入方法依赖的package包/类
private void init() {
    inflate(getContext(), R.layout.image_viewer, this);

    backgroundView = findViewById(R.id.backgroundView);
    pager = (MultiTouchViewPager) findViewById(R.id.pager);

    dismissContainer = (ViewGroup) findViewById(R.id.container);
    swipeDismissListener = new SwipeToDismissListener(findViewById(R.id.dismissView), this, this);
    dismissContainer.setOnTouchListener(swipeDismissListener);

    directionDetector = new SwipeDirectionDetector(getContext()) {
        @Override
        public void onDirectionDetected(Direction direction) {
            ImageViewerView.this.direction = direction;
        }
    };

    scaleDetector = new ScaleGestureDetector(getContext(),
            new ScaleGestureDetector.SimpleOnScaleGestureListener());

    gestureDetector = new GestureDetectorCompat(getContext(), new GestureDetector.SimpleOnGestureListener() {
        @Override
        public boolean onSingleTapConfirmed(MotionEvent e) {
            if (pager.isScrolled()) {
                onClick(e, isOverlayWasClicked);
            }
            return false;
        }
    });
}
 
开发者ID:achenglike,项目名称:imageviewer,代码行数:31,代码来源:ImageViewerView.java

示例11: OnItemSelectedListener

import android.view.GestureDetector; //导入方法依赖的package包/类
protected OnItemSelectedListener(Context context) {
    gestureDetector = new GestureDetector(context,
            new GestureDetector.SimpleOnGestureListener() {
                @Override
                public boolean onSingleTapUp(MotionEvent e) {
                    return true;
                }
            });
}
 
开发者ID:Pingsh,项目名称:Mix,代码行数:10,代码来源:OnItemSelectedListener.java

示例12: CustomTouchListener

import android.view.GestureDetector; //导入方法依赖的package包/类
public CustomTouchListener(Context context, final OnItemClickListener clickListener) {
    this.clickListener = clickListener;
    gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {

        @Override
        public boolean onSingleTapUp(MotionEvent e) {
            return true;
        }
    });
}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:11,代码来源:CustomTouchListener.java

示例13: TabItemView

import android.view.GestureDetector; //导入方法依赖的package包/类
public TabItemView(Context context) {
    super(context);
    mTextView = new InnerTextView(getContext());
    mTextView.setSingleLine(true);
    mTextView.setGravity(Gravity.CENTER);
    mTextView.setEllipsize(TextUtils.TruncateAt.MIDDLE);
    // 用于提供给customView布局用
    mTextView.setId(R.id.qmui_tab_segment_item_id);
    RelativeLayout.LayoutParams tvLp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    tvLp.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
    addView(mTextView, tvLp);
    // 添加双击事件
    mGestureDetector = new GestureDetector(getContext(), new GestureDetector.SimpleOnGestureListener() {
        @Override
        public boolean onDoubleTap(MotionEvent e) {
            if (mSelectedListeners == null) {
                return false;
            } else {
                if (mIsAnimating) {
                    return false;
                }
                int index = (int) TabItemView.this.getTag();
                Tab model = getAdapter().getItem(index);
                if (model != null) {
                    dispatchTabDoubleTap(index);
                    return true;
                }
                return false;
            }
        }
    });
}
 
开发者ID:QMUI,项目名称:QMUI_Android,代码行数:33,代码来源:QMUITabSegment.java

示例14: OnItemTouchListener

import android.view.GestureDetector; //导入方法依赖的package包/类
public OnItemTouchListener(Context context, OnItemClickListener listener) {
    mListener = listener;
    mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
        @Override
        public boolean onSingleTapUp(MotionEvent e) {
            return true;
        }
    });
}
 
开发者ID:appteam-nith,项目名称:Nimbus,代码行数:10,代码来源:OnItemTouchListener.java

示例15: setLongPress

import android.view.GestureDetector; //导入方法依赖的package包/类
private void setLongPress(Context context) {
    mLongPressDetector = new GestureDetector(context,new GestureDetector.SimpleOnGestureListener(){
        @Override
        public void onLongPress(MotionEvent e) {
            if (isLongClickable() && mOnLongClickListener != null){
                mOnLongClickListener.onLongClick(HDImageView.this);
            }
            super.onLongPress(e);
        }
    });
}
 
开发者ID:EvilBT,项目名称:HDImageView,代码行数:12,代码来源:HDImageView.java


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