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


Java ShoveGestureDetector类代码示例

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


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

示例1: onCreate

import com.almeros.android.multitouch.ShoveGestureDetector; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main);

	// Determine the center of the screen to center 'earth'
	Display display = getWindowManager().getDefaultDisplay();
	mFocusX = display.getWidth()/2f;
	mFocusY = display.getHeight()/2f;
	
	// Set this class as touchListener to the ImageView
	ImageView view = (ImageView) findViewById(R.id.imageView);
	view.setOnTouchListener(this);
	
	// Determine dimensions of 'earth' image
	Drawable d 		= this.getResources().getDrawable(R.drawable.earth);
	mImageHeight 	= d.getIntrinsicHeight();
	mImageWidth 	= d.getIntrinsicWidth();

	// View is scaled and translated by matrix, so scale and translate initially
       float scaledImageCenterX = (mImageWidth*mScaleFactor)/2; 
       float scaledImageCenterY = (mImageHeight*mScaleFactor)/2;
       
	mMatrix.postScale(mScaleFactor, mScaleFactor);
	mMatrix.postTranslate(mFocusX - scaledImageCenterX, mFocusY - scaledImageCenterY);
	view.setImageMatrix(mMatrix);

	// Setup Gesture Detectors
	mScaleDetector 	= new ScaleGestureDetector(getApplicationContext(), new ScaleListener());
	mRotateDetector = new RotateGestureDetector(getApplicationContext(), new RotateListener());
	mMoveDetector 	= new MoveGestureDetector(getApplicationContext(), new MoveListener());
	mShoveDetector 	= new ShoveGestureDetector(getApplicationContext(), new ShoveListener());
}
 
开发者ID:JoeySheng,项目名称:AndroidGestureDetector,代码行数:35,代码来源:TouchActivity.java

示例2: onShove

import com.almeros.android.multitouch.ShoveGestureDetector; //导入依赖的package包/类
@Override
public boolean onShove(ShoveGestureDetector detector) {
	mAlpha += detector.getShovePixelsDelta();
	if (mAlpha > 255)
		mAlpha = 255;
	else if (mAlpha < 0)
		mAlpha = 0;
	
	return true;
}
 
开发者ID:JoeySheng,项目名称:AndroidGestureDetector,代码行数:11,代码来源:TouchActivity.java


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