diff options
author | Jorge Ruesga <jorge@ruesga.com> | 2012-07-29 23:55:17 +0200 |
---|---|---|
committer | Jorge Ruesga <jorge@ruesga.com> | 2012-07-29 23:55:17 +0200 |
commit | c02ae2457a11e4631f4593480c4905424d024018 (patch) | |
tree | 009f450202bb17f8f762cff43d9c55a21814d541 | |
parent | ec2df26d40daef188108422f24c19a72c03e6d48 (diff) | |
download | frameworks_base-c02ae2457a11e4631f4593480c4905424d024018.zip frameworks_base-c02ae2457a11e4631f4593480c4905424d024018.tar.gz frameworks_base-c02ae2457a11e4631f4593480c4905424d024018.tar.bz2 |
Fix 5761: Power widget bar widens if >6 toggle buttons enabled
If more that 6 button widgets are enabled in the power widget, and hide scrollbar is active,
the space of the scrollbars is not recovered
This change make 2 modifications:
- Recreate the button layout, when a EXPANDED_HIDE_SCROLLBAR is received, instead of only update
the scrollview. This remove the scrollview if it is not needed.
- Move the setPadding of the buttonLayout to updateScrollbar to determine the correct botton padding
Change-Id: Ib8f149d9d220391ea0606da2252df4ace8cd7611
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerWidget.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerWidget.java b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerWidget.java index 5f8f91f..1fc48d9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerWidget.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerWidget.java @@ -272,11 +272,6 @@ public class PowerWidget extends FrameLayout { mScrollView.setFadingEdgeLength(mContext.getResources().getDisplayMetrics().widthPixels / LAYOUT_SCROLL_BUTTON_THRESHOLD); mScrollView.setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET); mScrollView.setOverScrollMode(View.OVER_SCROLL_NEVER); - // set the padding on the linear layout to the size of our scrollbar, so we don't have them overlap - mButtonLayout.setPadding(mButtonLayout.getPaddingLeft(), - mButtonLayout.getPaddingTop(), - mButtonLayout.getPaddingRight(), - mScrollView.getVerticalScrollbarWidth()); mScrollView.addView(mButtonLayout, WIDGET_LAYOUT_PARAMS); updateScrollbar(); addView(mScrollView, WIDGET_LAYOUT_PARAMS); @@ -370,6 +365,15 @@ public class PowerWidget extends FrameLayout { boolean hideScrollBar = Settings.System.getInt(mContext.getContentResolver(), Settings.System.EXPANDED_HIDE_SCROLLBAR, 0) == 1; mScrollView.setHorizontalScrollBarEnabled(!hideScrollBar); + + // set the padding on the linear layout to the size of our scrollbar, + // so we don't have them overlap + // need to be here for make use of EXPANDED_HIDE_SCROLLBAR, expanding or collapsing + // the space used by the scrollbar + if (mButtonLayout != null) { + mButtonLayout.setPadding(0, 0, 0, + !hideScrollBar ? mScrollView.getVerticalScrollbarWidth() : 0); + } } private void updateHapticFeedbackSetting() { @@ -486,7 +490,8 @@ public class PowerWidget extends FrameLayout { updateVisibility(); // now check for scrollbar hiding } else if(uri.equals(Settings.System.getUriFor(Settings.System.EXPANDED_HIDE_SCROLLBAR))) { - updateScrollbar(); + // Needed to remove scrollview to gain the space of the scrollable area + recreateButtonLayout(); } if (uri.equals(Settings.System.getUriFor(Settings.System.HAPTIC_FEEDBACK_ENABLED)) |