public final void onDrag(float dx, float dy) { if (DEBUG) { Log.d(LOG_TAG, String.format("onDrag: dx: %.2f. dy: %.2f", dx, dy)); } ImageView imageView = getImageView(); if (null != imageView && hasDrawable(imageView)) { mSuppMatrix.postTranslate(dx, dy); checkAndDisplayMatrix(); /** * Here we decide whether to let the ImageView's parent to start * taking over the touch event. * * First we check whether this function is enabled. We never want * the parent to take over if we're scaling. We then check the edge * we're on, and the direction of the scroll (i.e. if we're pulling * against the edge, aka 'overscrolling', let the parent take over). */ if (mAllowParentInterceptOnEdge && !mScaleDragDetector.isScaling()) { if (mScrollEdge == EDGE_BOTH || (mScrollEdge == EDGE_LEFT && dx >= 1f) || (mScrollEdge == EDGE_RIGHT && dx <= -1f)) { imageView.getParent().requestDisallowInterceptTouchEvent(false); } } } }
if (null != mScaleDragDetector && mScaleDragDetector.onTouchEvent(ev)) { handled = true;
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); } }
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); } }
public final void onDrag(float dx, float dy) { if (DEBUG) { Log.d(LOG_TAG, String.format("onDrag: dx: %.2f. dy: %.2f", dx, dy)); } ImageView imageView = getImageView(); if (null != imageView && hasDrawable(imageView)) { mSuppMatrix.postTranslate(dx, dy); checkAndDisplayMatrix(); /** * Here we decide whether to let the ImageView's parent to start * taking over the touch event. * * First we check whether this function is enabled. We never want * the parent to take over if we're scaling. We then check the edge * we're on, and the direction of the scroll (i.e. if we're pulling * against the edge, aka 'overscrolling', let the parent take over). */ if (mAllowParentInterceptOnEdge && !mScaleDragDetector.isScaling()) { if (mScrollEdge == EDGE_BOTH || (mScrollEdge == EDGE_LEFT && dx >= 1f) || (mScrollEdge == EDGE_RIGHT && dx <= -1f)) { imageView.getParent().requestDisallowInterceptTouchEvent(false); } } } }
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); } }
if (null != mScaleDragDetector && mScaleDragDetector.onTouchEvent(ev)) { handled = true;
public final void onDrag(float dx, float dy) { if (DEBUG) { Log.d(LOG_TAG, String.format("onDrag: dx: %.2f. dy: %.2f", dx, dy)); } ImageView imageView = getImageView(); if (null != imageView && hasDrawable(imageView)) { mSuppMatrix.postTranslate(dx, dy); checkAndDisplayMatrix(); /** * Here we decide whether to let the ImageView's parent to start * taking over the touch event. * * First we check whether this function is enabled. We never want * the parent to take over if we're scaling. We then check the edge * we're on, and the direction of the scroll (i.e. if we're pulling * against the edge, aka 'overscrolling', let the parent take over). */ if (mAllowParentInterceptOnEdge && !mScaleDragDetector.isScaling()) { if (mScrollEdge == EDGE_BOTH || (mScrollEdge == EDGE_LEFT && dx >= 1f) || (mScrollEdge == EDGE_RIGHT && dx <= -1f)) { imageView.getParent().requestDisallowInterceptTouchEvent(false); } } } }
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); } }
if (null != mScaleDragDetector && mScaleDragDetector.onTouchEvent(ev)) { handled = true;
public final void onDrag(float dx, float dy) { if (DEBUG) { Log.d(LOG_TAG, String.format("onDrag: dx: %.2f. dy: %.2f", dx, dy)); } ImageView imageView = getImageView(); if (null != imageView && hasDrawable(imageView)) { mSuppMatrix.postTranslate(dx, dy); checkAndDisplayMatrix(); /** * Here we decide whether to let the ImageView's parent to start * taking over the touch event. * * First we check whether this function is enabled. We never want * the parent to take over if we're scaling. We then check the edge * we're on, and the direction of the scroll (i.e. if we're pulling * against the edge, aka 'overscrolling', let the parent take over). */ if (mAllowParentInterceptOnEdge && !mScaleDragDetector.isScaling()) { if (mScrollEdge == EDGE_BOTH || (mScrollEdge == EDGE_LEFT && dx >= 1f) || (mScrollEdge == EDGE_RIGHT && dx <= -1f)) { imageView.getParent().requestDisallowInterceptTouchEvent(false); } } } }
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); } }
if (null != mScaleDragDetector && mScaleDragDetector.onTouchEvent(ev)) { handled = true;
public final void onDrag(float dx, float dy) { if (DEBUG) { Log.d(LOG_TAG, String.format("onDrag: dx: %.2f. dy: %.2f", dx, dy)); } ImageView imageView = getImageView(); if (null != imageView && hasDrawable(imageView)) { mSuppMatrix.postTranslate(dx, dy); checkAndDisplayMatrix(); /** * Here we decide whether to let the ImageView's parent to start * taking over the touch event. * * First we check whether this function is enabled. We never want * the parent to take over if we're scaling. We then check the edge * we're on, and the direction of the scroll (i.e. if we're pulling * against the edge, aka 'overscrolling', let the parent take over). */ if (mAllowParentInterceptOnEdge && !mScaleDragDetector.isScaling()) { if (mScrollEdge == EDGE_BOTH || (mScrollEdge == EDGE_LEFT && dx >= 1f) || (mScrollEdge == EDGE_RIGHT && dx <= -1f)) { imageView.getParent().requestDisallowInterceptTouchEvent(false); } } } }
if (null != mScaleDragDetector && mScaleDragDetector.onTouchEvent(ev)) { handled = true;