/** * Determines whether this ImageViewTouch can be scrolled. * * @param direction - positive direction value means scroll from right to left, * negative value means scroll from left to right * @return true if there is some more place to scroll, false - otherwise. */ @SuppressWarnings ("unused") public boolean canScroll(int direction) { RectF bitmapRect = getBitmapRect(); updateRect(bitmapRect, mScrollPoint); Rect imageViewRect = new Rect(); getGlobalVisibleRect(imageViewRect); if (null == bitmapRect) { return false; } if (bitmapRect.right >= imageViewRect.right) { if (direction < 0) { return Math.abs(bitmapRect.right - imageViewRect.right) > SCROLL_DELTA_THRESHOLD; } } double bitmapScrollRectDelta = Math.abs(bitmapRect.left - mScrollPoint.x); return bitmapScrollRectDelta > SCROLL_DELTA_THRESHOLD; }
public boolean canScrollV(int direction) { RectF bitmapRect = getBitmapRect(); updateRect(bitmapRect, mScrollRect); Rect imageViewRect = new Rect(); getGlobalVisibleRect(imageViewRect); if (null == bitmapRect) { return false; } if (bitmapRect.bottom - bitmapRect.top < imageViewRect.bottom - imageViewRect.top) { return false; } if (bitmapRect.bottom >= imageViewRect.bottom) { if (direction < 0) { return Math.abs(bitmapRect.bottom - imageViewRect.bottom) > SCROLL_DELTA_THRESHOLD; } } double bitmapScrollRectDelta = Math.abs(bitmapRect.top - mScrollRect.top); return bitmapScrollRectDelta > SCROLL_DELTA_THRESHOLD; }
/** * Determines whether this ImageViewTouch can be scrolled. * * @param direction - positive direction value means scroll from right to left, * negative value means scroll from left to right * @return true if there is some more place to scroll, false - otherwise. */ public boolean canScroll(int direction) { RectF bitmapRect = getBitmapRect(); updateRect(bitmapRect, mScrollRect); Rect imageViewRect = new Rect(); getGlobalVisibleRect(imageViewRect); if (null == bitmapRect) { return false; } if (bitmapRect.right >= imageViewRect.right) { if (direction < 0) { return Math.abs(bitmapRect.right - imageViewRect.right) > SCROLL_DELTA_THRESHOLD; } } double bitmapScrollRectDelta = Math.abs(bitmapRect.left - mScrollRect.left); return bitmapScrollRectDelta > SCROLL_DELTA_THRESHOLD; }