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


Java GestureDetector类代码示例

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


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

示例1: cleanup

import android.view.GestureDetector; //导入依赖的package包/类
public void cleanup() {
    if(null != this.mImageView) {
        ImageView imageView = (ImageView)this.mImageView.get();
        if(null != imageView) {
            ViewTreeObserver observer = imageView.getViewTreeObserver();
            if(null != observer && observer.isAlive()) {
                observer.removeGlobalOnLayoutListener(this);
            }

            imageView.setOnTouchListener((View.OnTouchListener)null);
            this.cancelFling();
        }

        if(null != this.mGestureDetector) {
            this.mGestureDetector.setOnDoubleTapListener((GestureDetector.OnDoubleTapListener)null);
        }

        this.mMatrixChangeListener = null;
        this.mPhotoTapListener = null;
        this.mViewTapListener = null;
        this.mImageView = null;
    }
}
 
开发者ID:leobert-lan,项目名称:UiLib,代码行数:24,代码来源:PhotoViewAttacher.java

示例2: initVideoView

import android.view.GestureDetector; //导入依赖的package包/类
private void initVideoView(Context context) {
    mAppContext = context.getApplicationContext();

    initBackground();
    initRenders();

    mVideoWidth = 0;
    mVideoHeight = 0;
    // REMOVED: getHolder().addCallback(mSHCallback);
    // REMOVED: getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    setFocusable(true);
    setFocusableInTouchMode(true);
    requestFocus();
    // REMOVED: mPendingSubtitleTracks = new Vector<Pair<InputStream, MediaFormat>>();
    mCurrentState = STATE_IDLE;
    mTargetState = STATE_IDLE;
    gestureDetector = new GestureDetector(mAppContext, new PlayerGestureListener());
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:19,代码来源:IjkVideoView.java

示例3: EntityView

import android.view.GestureDetector; //导入依赖的package包/类
public EntityView(Context context, Point pos) {
    super(context);

    uuid = UUID.randomUUID();
    position = pos;

    gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
        public void onLongPress(MotionEvent e) {
            if (hasPanned || hasTransformed || hasReleased) {
                return;
            }

            recognizedLongPress = true;
            if (delegate != null) {
                performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
                delegate.onEntityLongClicked(EntityView.this);
            }
        }
    });
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:21,代码来源:EntityView.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, update the UI so that we're zoomable
		setZoomable(true);
	}
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:33,代码来源:PhotoViewAttacher.java

示例5: onCreate

import android.view.GestureDetector; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PrefStore.setLocale(this);
    setContentView(R.layout.activity_profiles);

    // ListView Adapter
    listView = (ListView) findViewById(R.id.profilesView);
    adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_single_choice, listItems);
    listView.setAdapter(adapter);

    // Initialize the Gesture Detector
    listView.setOnTouchListener(this);
    gd = new GestureDetector(this,
            new GestureDetector.SimpleOnGestureListener() {
                @Override
                public boolean onDoubleTap(MotionEvent e) {
                    finish();
                    return false;
                }
            });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:ProfilesActivity.java

示例6: onCreate

import android.view.GestureDetector; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_fold);

    mImageView = (ImageView)findViewById(R.id.image_view);
    mImageView.setPadding(ANTIALIAS_PADDING, ANTIALIAS_PADDING, ANTIALIAS_PADDING,
            ANTIALIAS_PADDING);
    mImageView.setScaleType(ImageView.ScaleType.FIT_XY);
    mImageView.setImageDrawable(getResources().getDrawable(R.drawable.image));

    mTextureView = new TextureView(this);
    mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);

    mAnchorSeekBar = (SeekBar)findViewById(R.id.anchor_seek_bar);
    mFoldLayout = (FoldingLayout)findViewById(R.id.fold_view);
    mFoldLayout.setBackgroundColor(Color.BLACK);
    mFoldLayout.setFoldListener(mOnFoldListener);

    mTouchSlop = ViewConfiguration.get(this).getScaledTouchSlop();

    mAnchorSeekBar.setOnSeekBarChangeListener(mSeekBarChangeListener);

    mScrollGestureDetector = new GestureDetector(this, new ScrollGestureDetector());
    mItemSelectedListener = new ItemSelectedListener();

    mDefaultPaint = new Paint();
    mSepiaPaint = new Paint();

    ColorMatrix m1 = new ColorMatrix();
    ColorMatrix m2 = new ColorMatrix();
    m1.setSaturation(0);
    m2.setScale(1f, .95f, .82f, 1.0f);
    m1.setConcat(m2, m1);
    mSepiaPaint.setColorFilter(new ColorMatrixColorFilter(m1));
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:38,代码来源:FoldingLayoutActivity.java

示例7: onCreate

import android.view.GestureDetector; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	// 隐藏标题
	requestWindowFeature(Window.FEATURE_NO_TITLE);

	setContentView(R.layout.new_ad_media_play);
	
	sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);

	wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
	cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
	
	detector = new GestureDetector(this, new MyGesture());
	
	initView();

	initPlayHander();

	initPlayInfo();
	
	if (!isLocalPlay) {
		initNetworkTimerTask();
	}
	videoId = getIntent().getStringExtra("videoId");
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:27,代码来源:MediaPlayActivity.java

示例8: onCreate

import android.view.GestureDetector; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gesture_detector);
    tvGesture = (TextView) findViewById(R.id.tvGesture);

    //o primeiro this é pq GestureDetectorActivity é uma Activity (óbvio!)
    //o segundo é pq a gente precisa de um listener, no caso OnGestureListener
    gestureDetector = new GestureDetector(this,this);

    //esse this é pq esta Activity implementa OnDoubleTapListener
    gestureDetector.setOnDoubleTapListener(this);

    //vamos monitorar longpress
    gestureDetector.setIsLongpressEnabled(true);
}
 
开发者ID:if710,项目名称:2017.2-codigo,代码行数:17,代码来源:GestureDetectorActivity.java

示例9: initWorkspace

import android.view.GestureDetector; //导入依赖的package包/类
/**
 * Initializes various states for this workspace.
 */
protected void initWorkspace() {
    mCurrentPage = getDefaultPage();
    DeviceProfile grid = mLauncher.getDeviceProfile();
    setWillNotDraw(false);
    setClipChildren(false);
    setClipToPadding(false);

    setMinScale(mOverviewModeShrinkFactor);
    setupLayoutTransition();

    mMaxDistanceForFolderCreation = (0.55f * grid.iconSizePx);

    // Set the wallpaper dimensions when Launcher starts up
    setWallpaperDimension();

    setEdgeGlowColor(getResources().getColor(R.color.workspace_edge_effect_color));

    mGestureDetector = new GestureDetector(mLauncher,new SimpleGestureDetector(mLauncher));

    for (CellLayout cellLayout: mWorkspaceScreens) {
        initGestureDetector(cellLayout);
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:27,代码来源:Workspace.java

示例10: 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

示例11: sharedConstructing

import android.view.GestureDetector; //导入依赖的package包/类
private void sharedConstructing(Context context) {
    super.setClickable(true);
    this.context = context;
    this.mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
    this.mGestureDetector = new GestureDetector(context, new GestureListener());
    this.matrix = new Matrix();
    this.prevMatrix = new Matrix();
    this.m = new float[9];
    this.normalizedScale = 1.0f;
    if (this.mScaleType == null) {
        this.mScaleType = ScaleType.FIT_CENTER;
    }
    this.minScale = 1.0f;
    this.maxScale = IPhotoView.DEFAULT_MAX_SCALE;
    this.superMinScale = 0.75f * this.minScale;
    this.superMaxScale = SUPER_MAX_MULTIPLIER * this.maxScale;
    setImageMatrix(this.matrix);
    setScaleType(ScaleType.MATRIX);
    setState(State.NONE);
    this.onDrawReady = false;
    super.setOnTouchListener(new PrivateOnTouchListener());
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:TouchImageView.java

示例12: sharedConstructing

import android.view.GestureDetector; //导入依赖的package包/类
private void sharedConstructing(Context context) {
  super.setClickable(true);
  this.context = context;
  mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
  mGestureDetector = new GestureDetector(context, new GestureListener());
  matrix = new Matrix();
  prevMatrix = new Matrix();
  m = new float[9];
  normalizedScale = 1;
  if (mScaleType == null) {
    mScaleType = ScaleType.FIT_CENTER;
  }
  minScale = 1;
  maxScale = 3;
  superMinScale = SUPER_MIN_MULTIPLIER * minScale;
  superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
  setImageMatrix(matrix);
  setScaleType(ScaleType.MATRIX);
  setState(State.NONE);
  onDrawReady = false;
  super.setOnTouchListener(new PrivateOnTouchListener());
}
 
开发者ID:malijie,项目名称:PhotoPicker-master,代码行数:23,代码来源:TouchImageView.java

示例13: sharedConstructing

import android.view.GestureDetector; //导入依赖的package包/类
private void sharedConstructing(Context context) {
    super.setClickable(true);
    this.context = context;
    mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
    mGestureDetector = new GestureDetector(context, new GestureListener());
    matrix = new Matrix();
    prevMatrix = new Matrix();
    m = new float[9];
    normalizedScale = 1;
    if (mScaleType == null) {
        mScaleType = ScaleType.FIT_CENTER;
    }
    minScale = 1;
    maxScale = 3;
    superMinScale = SUPER_MIN_MULTIPLIER * minScale;
    superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
    setImageMatrix(matrix);
    setScaleType(ScaleType.MATRIX);
    setState(State.NONE);
    onDrawReady = false;
    super.setOnTouchListener(new PrivateOnTouchListener());
}
 
开发者ID:rozdoum,项目名称:social-app-android,代码行数:23,代码来源:TouchImageView.java

示例14: initLayout

import android.view.GestureDetector; //导入依赖的package包/类
private void initLayout() {
    mOverScroller = new OverScroller(getContext());
    mGestureDetectorCompat = new GestureDetectorCompat(getContext(),
            new GestureDetector.SimpleOnGestureListener() {

                @Override
                public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, final float velocityY) {
                    if (Math.abs(velocityX) > Math.abs(velocityY)) {
                        return false;
                    }

                    if (isFloat() /*&& velocityY < 0*/) {
                        return false;
                    }
                    fling(velocityY);
                    return true;
                }
            });
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:20,代码来源:StickLayout2.java

示例15: setContentView

import android.view.GestureDetector; //导入依赖的package包/类
/**设置该Activity界面布局,并设置底部左右滑动手势监听
 * @param layoutResID
 * @param listener
 * @use 在子类中
 * *1.onCreate中super.onCreate后setContentView(layoutResID, this);
 * *2.重写onDragBottom方法并实现滑动事件处理
 * *3.在导航栏左右按钮的onClick事件中调用onDragBottom方法
 */
public void setContentView(int layoutResID, OnBottomDragListener listener) {
	setContentView(layoutResID);

	onBottomDragListener = listener;
	gestureDetector = new GestureDetector(this, this);//初始化手势监听类

	view = inflater.inflate(layoutResID, null);
	view.setOnTouchListener(new OnTouchListener() {

		@SuppressLint("ClickableViewAccessibility")
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			return gestureDetector.onTouchEvent(event);
		}
	});
}
 
开发者ID:TommyLemon,项目名称:APIJSON-Android-RxJava,代码行数:25,代码来源:BaseActivity.java


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