public bool OnSingleTapConfirmed(Android.Views.MotionEvent e) { if (this.photoViewAttacher == null) { return(false); } ImageView imageView = photoViewAttacher.GetImageView(); if (null != photoViewAttacher.GetOnPhotoTapListener()) { RectF displayRect = photoViewAttacher.GetDisplayRect(); if (null != displayRect) { float x = e.GetX(), y = e.GetY(); if (displayRect.Contains(x, y)) { float xResult = (x - displayRect.Left) / displayRect.Width(); float yResult = (y - displayRect.Top) / displayRect.Height(); photoViewAttacher.GetOnPhotoTapListener().OnPhotoTap(imageView, xResult, yResult); return(true); } } } if (null != photoViewAttacher.GetOnViewTapListener()) { photoViewAttacher.GetOnViewTapListener().OnViewTap(imageView, e.GetX(), e.GetY()); } return(false); }
public override void OnLongPress(MotionEvent e) { if (null != photoViewAttacher.mLongClickListener) { photoViewAttacher.mLongClickListener.OnLongClick(photoViewAttacher.GetImageView()); } }
public void Run() { if (mScroller.IsFinished()) { return; // remaining post that should not be handled } ImageView imageView = photoViewAttacher.GetImageView(); if (null != imageView && mScroller.ComputeScrollOffset()) { int newX = mScroller.GetCurrX(); int newY = mScroller.GetCurrY(); if (photoViewAttacher.DEBUG) { LogManager.GetLogger().d( LOG_TAG, "fling run(). CurrentX:" + mCurrentX + " CurrentY:" + mCurrentY + " NewX:" + newX + " NewY:" + newY); } photoViewAttacher.mSuppMatrix.PostTranslate(mCurrentX - newX, mCurrentY - newY); photoViewAttacher.SetImageViewMatrix(photoViewAttacher.GetDrawMatrix()); mCurrentX = newX; mCurrentY = newY; Compat.PostOnAnimation(imageView, this); } }
public void Run() { ImageView imageView = photoViewAttacher.GetImageView(); if (imageView == null) { return; } float t = Interpolate(); float scale = mZoomStart + t * (mZoomEnd - mZoomStart); float deltaScale = scale / photoViewAttacher.GetScale(); photoViewAttacher.mSuppMatrix.PostScale(deltaScale, deltaScale, mFocalX, mFocalY); photoViewAttacher.CheckAndDisplayMatrix(); // We haven't hit our target scale yet, so post ourselves again if (t < 1f) { Compat.PostOnAnimation(imageView, this); } }