summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMindy Pereira <mindyp@google.com>2010-11-23 11:07:30 -0800
committerMindy Pereira <mindyp@google.com>2010-11-23 11:12:20 -0800
commita5531d784b9b79fe3bf9b30d99e9c99ea3947c6d (patch)
treea13a47eb7de28c82a3eb80c4fd8865122184c9d5 /core
parenta6a52dece70d75f6b5781fc902fd646b1122abd7 (diff)
downloadframeworks_base-a5531d784b9b79fe3bf9b30d99e9c99ea3947c6d.zip
frameworks_base-a5531d784b9b79fe3bf9b30d99e9c99ea3947c6d.tar.gz
frameworks_base-a5531d784b9b79fe3bf9b30d99e9c99ea3947c6d.tar.bz2
Update edge and glow rendering to match new specs.
Change-Id: Id2ad0ff4fa78617cb79475952e9ce561ee8fec10
Diffstat (limited to 'core')
-rw-r--r--core/java/android/widget/AbsListView.java12
-rw-r--r--core/java/android/widget/EdgeGlow.java18
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;