}
nativeClearCursor(); // start next trackball movement from page edge
if (bottom) {
- return pinScrollTo(mScrollX, computeVerticalScrollRange(), true, 0);
+ return pinScrollTo(mScrollX, computeRealVerticalScrollRange(), true, 0);
}
// Page down.
int h = getHeight();
private int pinLocY(int y) {
if (mInOverScrollMode) return y;
return pinLoc(y, getViewHeightWithTitle(),
- computeVerticalScrollRange() + getTitleHeight());
+ computeRealVerticalScrollRange() + getTitleHeight());
}
/**
return false;
}
- @Override
- protected int computeHorizontalScrollRange() {
+ private int computeRealHorizontalScrollRange() {
if (mDrawHistory) {
return mHistoryWidth;
} else {
}
@Override
- protected int computeVerticalScrollRange() {
+ protected int computeHorizontalScrollRange() {
+ int range = computeRealHorizontalScrollRange();
+
+ // Adjust reported range if overscrolled to compress the scroll bars
+ final int scrollX = mScrollX;
+ final int overscrollRight = computeMaxScrollX();
+ if (scrollX < 0) {
+ range -= scrollX;
+ } else if (scrollX > overscrollRight) {
+ range += scrollX - overscrollRight;
+ }
+
+ return range;
+ }
+
+ @Override
+ protected int computeHorizontalScrollOffset() {
+ return Math.max(mScrollX, 0);
+ }
+
+ private int computeRealVerticalScrollRange() {
if (mDrawHistory) {
return mHistoryHeight;
} else {
}
@Override
+ protected int computeVerticalScrollRange() {
+ int range = computeRealVerticalScrollRange();
+
+ // Adjust reported range if overscrolled to compress the scroll bars
+ final int scrollY = mScrollY;
+ final int overscrollBottom = computeMaxScrollY();
+ if (scrollY < 0) {
+ range -= scrollY;
+ } else if (scrollY > overscrollBottom) {
+ range += scrollY - overscrollBottom;
+ }
+
+ return range;
+ }
+
+ @Override
protected int computeVerticalScrollOffset() {
return Math.max(mScrollY - getTitleHeight(), 0);
}
canvas.save();
canvas.translate(mScrollX, mScrollY);
canvas.clipRect(-mScrollX, top - mScrollY,
- computeHorizontalScrollRange() - mScrollX, top
- + computeVerticalScrollRange() - mScrollY,
+ computeRealHorizontalScrollRange() - mScrollX, top
+ + computeRealVerticalScrollRange() - mScrollY,
Region.Op.DIFFERENCE);
canvas.drawPaint(mOverScrollBackground);
canvas.restore();
// next clip the region for the content
- canvas.clipRect(0, top, computeHorizontalScrollRange(), top
- + computeVerticalScrollRange());
+ canvas.clipRect(0, top, computeRealHorizontalScrollRange(), top
+ + computeRealVerticalScrollRange());
}
if (mTitleBar != null) {
canvas.translate(0, (int) mTitleBar.getHeight());
public DragTrackerHandler(float x, float y, DragTracker proxy) {
mProxy = proxy;
- int docBottom = computeVerticalScrollRange() + getTitleHeight();
+ int docBottom = computeRealVerticalScrollRange() + getTitleHeight();
int viewTop = getScrollY();
int viewBottom = viewTop + getHeight();
}
private int computeMaxScrollX() {
- return Math.max(computeHorizontalScrollRange() - getViewWidth(), 0);
+ return Math.max(computeRealHorizontalScrollRange() - getViewWidth(), 0);
}
private int computeMaxScrollY() {
- return Math.max(computeVerticalScrollRange() + getTitleHeight()
+ return Math.max(computeRealVerticalScrollRange() + getTitleHeight()
- getViewHeightWithTitle(), 0);
}