Ignore padding for drawing round scrollbars.

This change is needed to correctly cope eg. with list views
which introduce header and footer view through additional
list view padding.

See ag/1221005 for details.

Bug:30420573
Change-Id: I7c9c0ce2b5ba85429b7921c42e4f97e139814e17
This commit is contained in:
Aga Madurska
2016-07-27 13:40:23 +01:00
parent 993b4b2380
commit c283507246

View File

@@ -14778,26 +14778,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
} }
private void getRoundVerticalScrollBarBounds(Rect bounds) { private void getRoundVerticalScrollBarBounds(Rect bounds) {
final int inside = (mViewFlags & SCROLLBARS_OUTSIDE_MASK) == 0 ? ~0 : 0;
int verticalScrollbarPosition = mVerticalScrollbarPosition;
if (verticalScrollbarPosition == SCROLLBAR_POSITION_DEFAULT) {
verticalScrollbarPosition = isLayoutRtl() ?
SCROLLBAR_POSITION_LEFT : SCROLLBAR_POSITION_RIGHT;
}
final int width = mRight - mLeft; final int width = mRight - mLeft;
final int height = mBottom - mTop; final int height = mBottom - mTop;
switch (verticalScrollbarPosition) { // Do not take padding into account as we always want the scrollbars
default: // to hug the screen for round wearable devices.
case SCROLLBAR_POSITION_RIGHT: bounds.left = mScrollX;
bounds.left = mScrollX - (mUserPaddingRight & inside); bounds.top = mScrollY;
break;
case SCROLLBAR_POSITION_LEFT:
bounds.left = mScrollX + (mUserPaddingLeft & inside);
break;
}
bounds.top = mScrollY + (mPaddingTop & inside);
bounds.right = bounds.left + width; bounds.right = bounds.left + width;
bounds.bottom = mScrollY + height - (mUserPaddingBottom & inside); bounds.bottom = mScrollY + height;
} }
private void getStraightVerticalScrollBarBounds(Rect bounds) { private void getStraightVerticalScrollBarBounds(Rect bounds) {