diff options
Diffstat (limited to 'core')
| -rw-r--r-- | core/java/android/widget/AbsListView.java | 12 | ||||
| -rw-r--r-- | core/java/android/widget/EdgeGlow.java | 18 |
2 files changed, 17 insertions, 13 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index eb8e2de..423a788 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -3115,8 +3115,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final int restoreCount = canvas.save(); final int width = getWidth(); - canvas.translate(-width / 2, Math.min(0, scrollY + mFirstPositionDistanceGuess)); - mEdgeGlowTop.setSize(width * 2, getHeight()); + canvas.translate(0, Math.min(0, scrollY + mFirstPositionDistanceGuess)); + mEdgeGlowTop.setSize(width, getHeight()); if (mEdgeGlowTop.draw(canvas)) { invalidate(); } @@ -3127,10 +3127,10 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final int width = getWidth(); final int height = getHeight(); - canvas.translate(-width / 2, - Math.max(height, scrollY + mLastPositionDistanceGuess)); - canvas.rotate(180, width, 0); - mEdgeGlowBottom.setSize(width * 2, height); + canvas.translate(-width, 0); + canvas.rotate(-180, width, 0); + canvas.translate(0, -height); + mEdgeGlowBottom.setSize(width, height); if (mEdgeGlowBottom.draw(canvas)) { invalidate(); } diff --git a/core/java/android/widget/EdgeGlow.java b/core/java/android/widget/EdgeGlow.java index 416be86..9b3a6e6 100644 --- a/core/java/android/widget/EdgeGlow.java +++ b/core/java/android/widget/EdgeGlow.java @@ -245,19 +245,23 @@ public class EdgeGlow { update(); final int edgeHeight = mEdge.getIntrinsicHeight(); + final int edgeWidth = mEdge.getIntrinsicWidth(); final int glowHeight = mGlow.getIntrinsicHeight(); - - final float distScale = (float) mHeight / mWidth; + final int glowWidth = mGlow.getIntrinsicWidth(); mGlow.setAlpha((int) (Math.max(0, Math.min(mGlowAlpha, 1)) * 255)); - // Width of the image should be 3 * the width of the screen. - // Should start off screen to the left. - mGlow.setBounds(-mWidth, 0, mWidth * 2, (int) Math.min( - glowHeight * mGlowScaleY * distScale * 0.6f, mHeight * MAX_GLOW_HEIGHT)); + + // Center the glow inside the width of the container. + int glowLeft = (mWidth - glowWidth)/2; + mGlow.setBounds(glowLeft, 0, mWidth - glowLeft, (int) Math.min( + glowHeight * mGlowScaleY * glowHeight/ glowWidth * 0.6f, + glowHeight * MAX_GLOW_HEIGHT)); mGlow.draw(canvas); mEdge.setAlpha((int) (Math.max(0, Math.min(mEdgeAlpha, 1)) * 255)); - mEdge.setBounds(0, 0, mWidth, (int) (edgeHeight * mEdgeScaleY)); + + int edgeLeft = (mWidth - edgeWidth)/2; + mEdge.setBounds(edgeLeft, 0, mWidth - edgeLeft, (int) (edgeHeight * mEdgeScaleY)); mEdge.draw(canvas); return mState != STATE_IDLE; |
