diff options
| author | Mindy Pereira <mindyp@google.com> | 2010-11-23 11:32:51 -0800 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-11-23 11:32:51 -0800 |
| commit | b43d7589cf6201fc05f4c9d8b4a0c44d7cdba81e (patch) | |
| tree | 6223ab05d9bc2b947efe0fb916b8b22f766224ca /core | |
| parent | 05063d8a599891723db7c03797febaeefeca0154 (diff) | |
| parent | a5531d784b9b79fe3bf9b30d99e9c99ea3947c6d (diff) | |
| download | frameworks_base-b43d7589cf6201fc05f4c9d8b4a0c44d7cdba81e.zip frameworks_base-b43d7589cf6201fc05f4c9d8b4a0c44d7cdba81e.tar.gz frameworks_base-b43d7589cf6201fc05f4c9d8b4a0c44d7cdba81e.tar.bz2 | |
Merge "Update edge and glow rendering to match new specs."
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; |
