@Override public boolean onSingleTapConfirmed(MotionEvent e) { if (this.photoViewAttacher == null) return false; ImageView imageView = photoViewAttacher.getImageView(); if (null != photoViewAttacher.getOnPhotoTapListener()) { final RectF displayRect = photoViewAttacher.getDisplayRect(); if (null != displayRect) { final float x = e.getX(), y = e.getY(); // Check to see if the user tapped on the photo 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; }
protected void init() { if (null == mAttacher || null == mAttacher.getImageView()) { mAttacher = new PhotoViewAttacher(this); } if (null != mPendingScaleType) { setScaleType(mPendingScaleType); mPendingScaleType = null; } // if (mDraweeHolder == null) { // GenericDraweeHierarchy hierarchy = new // GenericDraweeHierarchyBuilder(getResources()) // .setFadeDuration(800) // .setProgressBarImage(getResources().getDrawable(R.mipmap.ic_launcher)) // .setFailureImage(getResources().getDrawable(R.mipmap.pic_failure)) // .setRetryImage(getResources().getDrawable(R.mipmap.pic_failure)) // .build(); // mDraweeHolder = DraweeHolder.create(hierarchy, getContext()); // } }