From b1297f76351795822c64236c4ce27b97d18e5bca Mon Sep 17 00:00:00 2001 From: Mindy Pereira Date: Tue, 7 Dec 2010 15:06:47 -0800 Subject: [PATCH] Make horizotnalscrollview and scrollview edgeglows match the new algorithm. Instead of going past the left and right sides, the glow now stretches just to the width of the edge and stops. For horizontalscrollview, instead of going past the top and bottom, now stretches just to the height and stops. Change-Id: I0cc9bdef3ab263b16dd32e088c6b64ff5a8809c8 --- core/java/android/widget/HorizontalScrollView.java | 9 +++++---- core/java/android/widget/ScrollView.java | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java index c05e3ad3027a3..50867b9514d07 100644 --- a/core/java/android/widget/HorizontalScrollView.java +++ b/core/java/android/widget/HorizontalScrollView.java @@ -1420,8 +1420,8 @@ public class HorizontalScrollView extends FrameLayout { final int height = getHeight(); canvas.rotate(270); - canvas.translate(-height * 1.5f, Math.min(0, scrollX)); - mEdgeGlowLeft.setSize(getHeight() * 2, getWidth()); + canvas.translate(-height, Math.min(0, scrollX)); + mEdgeGlowLeft.setSize(getHeight(), getWidth()); if (mEdgeGlowLeft.draw(canvas)) { invalidate(); } @@ -1433,8 +1433,9 @@ public class HorizontalScrollView extends FrameLayout { final int height = getHeight(); canvas.rotate(90); - canvas.translate(-height / 2, -(Math.max(getScrollRange(), scrollX) + width)); - mEdgeGlowRight.setSize(height * 2, width); + canvas.translate(0, + -(Math.max(getScrollRange(), scrollX) + width)); + mEdgeGlowRight.setSize(height, width); if (mEdgeGlowRight.draw(canvas)) { invalidate(); } diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java index 9fa90dc3c80f8..f25edd8c05df5 100644 --- a/core/java/android/widget/ScrollView.java +++ b/core/java/android/widget/ScrollView.java @@ -1467,8 +1467,8 @@ public class ScrollView extends FrameLayout { final int restoreCount = canvas.save(); final int width = getWidth(); - canvas.translate(-width / 2, Math.min(0, scrollY)); - mEdgeGlowTop.setSize(width * 2, getHeight()); + canvas.translate(0, Math.min(0, scrollY)); + mEdgeGlowTop.setSize(width, getHeight()); if (mEdgeGlowTop.draw(canvas)) { invalidate(); } @@ -1479,9 +1479,9 @@ public class ScrollView extends FrameLayout { final int width = getWidth(); final int height = getHeight(); - canvas.translate(-width / 2, Math.max(getScrollRange(), scrollY) + height); + canvas.translate(-width, Math.max(getScrollRange(), scrollY) + height); canvas.rotate(180, width, 0); - mEdgeGlowBottom.setSize(width * 2, height); + mEdgeGlowBottom.setSize(width, height); if (mEdgeGlowBottom.draw(canvas)) { invalidate(); }