From c2835072469f712ba2b73e4a93b5d0b8818777b8 Mon Sep 17 00:00:00 2001 From: Aga Madurska Date: Wed, 27 Jul 2016 13:40:23 +0100 Subject: [PATCH] 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 --- core/java/android/view/View.java | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index d93f8af2165d0..2be99d020bda0 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -14778,26 +14778,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } 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 height = mBottom - mTop; - switch (verticalScrollbarPosition) { - default: - case SCROLLBAR_POSITION_RIGHT: - bounds.left = mScrollX - (mUserPaddingRight & inside); - break; - case SCROLLBAR_POSITION_LEFT: - bounds.left = mScrollX + (mUserPaddingLeft & inside); - break; - } - bounds.top = mScrollY + (mPaddingTop & inside); + // Do not take padding into account as we always want the scrollbars + // to hug the screen for round wearable devices. + bounds.left = mScrollX; + bounds.top = mScrollY; bounds.right = bounds.left + width; - bounds.bottom = mScrollY + height - (mUserPaddingBottom & inside); + bounds.bottom = mScrollY + height; } private void getStraightVerticalScrollBarBounds(Rect bounds) {