Loading api/current.txt +0 −1 Original line number Diff line number Diff line Loading @@ -26377,7 +26377,6 @@ package android.widget { ctor public EdgeEffect(android.content.Context); method public boolean draw(android.graphics.Canvas); method public void finish(); method public android.graphics.Rect getBounds(); method public boolean isFinished(); method public void onAbsorb(int); method public void onPull(float); core/java/android/widget/AbsListView.java +7 −17 Original line number Diff line number Diff line Loading @@ -2944,27 +2944,17 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mDirection = 0; // Reset when entering overscroll. mTouchMode = TOUCH_MODE_OVERSCROLL; if (rawDeltaY > 0) { if (!mEdgeGlowTop.isIdle()) { invalidate(mEdgeGlowTop.getBounds()); } else { invalidate(); } mEdgeGlowTop.onPull((float) overscroll / getHeight()); if (!mEdgeGlowBottom.isFinished()) { mEdgeGlowBottom.onRelease(); } invalidate(mEdgeGlowTop.getBounds(false)); } else if (rawDeltaY < 0) { if (!mEdgeGlowBottom.isIdle()) { invalidate(mEdgeGlowBottom.getBounds()); } else { invalidate(); } mEdgeGlowBottom.onPull((float) overscroll / getHeight()); if (!mEdgeGlowTop.isFinished()) { mEdgeGlowTop.onRelease(); } invalidate(mEdgeGlowBottom.getBounds(true)); } } } Loading Loading @@ -3002,13 +2992,13 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te if (!mEdgeGlowBottom.isFinished()) { mEdgeGlowBottom.onRelease(); } invalidate(mEdgeGlowTop.getBounds()); invalidate(mEdgeGlowTop.getBounds(false)); } else if (rawDeltaY < 0) { mEdgeGlowBottom.onPull((float) overScrollDistance / getHeight()); if (!mEdgeGlowTop.isFinished()) { mEdgeGlowTop.onRelease(); } invalidate(mEdgeGlowBottom.getBounds()); invalidate(mEdgeGlowBottom.getBounds(true)); } } } Loading Loading @@ -3485,7 +3475,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mEdgeGlowTop.setSize(width, getHeight()); if (mEdgeGlowTop.draw(canvas)) { mEdgeGlowTop.setPosition(leftPadding, edgeY); invalidate(mEdgeGlowTop.getBounds()); invalidate(mEdgeGlowTop.getBounds(false)); } canvas.restoreToCount(restoreCount); } Loading @@ -3503,8 +3493,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mEdgeGlowBottom.setSize(width, height); if (mEdgeGlowBottom.draw(canvas)) { // Account for the rotation mEdgeGlowBottom.setPosition(edgeX + width, edgeY - mEdgeGlowBottom.getHeight()); invalidate(mEdgeGlowBottom.getBounds()); mEdgeGlowBottom.setPosition(edgeX + width, edgeY); invalidate(mEdgeGlowBottom.getBounds(true)); } canvas.restoreToCount(restoreCount); } Loading core/java/android/widget/EdgeEffect.java +23 −23 Original line number Diff line number Diff line Loading @@ -123,6 +123,11 @@ public class EdgeEffect { private final Rect mBounds = new Rect(); private final int mEdgeHeight; private final int mGlowHeight; private final int mGlowWidth; private final int mMaxEffectHeight; /** * Construct a new EdgeEffect with a theme appropriate for the provided context. * @param context Context used to provide theming and resource information for the EdgeEffect Loading @@ -132,6 +137,14 @@ public class EdgeEffect { mEdge = res.getDrawable(R.drawable.overscroll_edge); mGlow = res.getDrawable(R.drawable.overscroll_glow); mEdgeHeight = mEdge.getIntrinsicHeight(); mGlowHeight = mGlow.getIntrinsicHeight(); mGlowWidth = mGlow.getIntrinsicWidth(); mMaxEffectHeight = (int) (Math.min( mGlowHeight * MAX_GLOW_HEIGHT * mGlowHeight / mGlowWidth * 0.6f, mGlowHeight * MAX_GLOW_HEIGHT) + 0.5f); mMinWidth = (int) (res.getDisplayMetrics().density * MIN_WIDTH + 0.5f); mInterpolator = new DecelerateInterpolator(); } Loading @@ -149,7 +162,7 @@ public class EdgeEffect { /** * Set the position of this edge effect in pixels. This position is * only used by {@link #getBounds()}. * only used by {@link #getBounds(boolean)}. * * @param x The position of the edge effect on the X axis * @param y The position of the edge effect on the Y axis Loading @@ -159,17 +172,6 @@ public class EdgeEffect { mY = y; } boolean isIdle() { return mState == STATE_IDLE; } /** * Returns the height of the effect itself. */ int getHeight() { return Math.max(mGlow.getBounds().height(), mEdge.getBounds().height()); } /** * Reports if this EdgeEffect's animation is finished. If this method returns false * after a call to {@link #draw(Canvas)} the host widget should schedule another Loading Loading @@ -326,15 +328,11 @@ public class EdgeEffect { public boolean draw(Canvas canvas) { update(); final int edgeHeight = mEdge.getIntrinsicHeight(); final int glowHeight = mGlow.getIntrinsicHeight(); final int glowWidth = mGlow.getIntrinsicWidth(); mGlow.setAlpha((int) (Math.max(0, Math.min(mGlowAlpha, 1)) * 255)); int glowBottom = (int) Math.min( glowHeight * mGlowScaleY * glowHeight/ glowWidth * 0.6f, glowHeight * MAX_GLOW_HEIGHT); mGlowHeight * mGlowScaleY * mGlowHeight / mGlowWidth * 0.6f, mGlowHeight * MAX_GLOW_HEIGHT); if (mWidth < mMinWidth) { // Center the glow and clip it. int glowLeft = (mWidth - mMinWidth)/2; Loading @@ -348,7 +346,7 @@ public class EdgeEffect { mEdge.setAlpha((int) (Math.max(0, Math.min(mEdgeAlpha, 1)) * 255)); int edgeBottom = (int) (edgeHeight * mEdgeScaleY); int edgeBottom = (int) (mEdgeHeight * mEdgeScaleY); if (mWidth < mMinWidth) { // Center the edge and clip it. int edgeLeft = (mWidth - mMinWidth)/2; Loading @@ -368,11 +366,13 @@ public class EdgeEffect { /** * Returns the bounds of the edge effect. * * @hide */ public Rect getBounds() { mBounds.set(mGlow.getBounds()); mBounds.union(mEdge.getBounds()); mBounds.offset(mX, mY); public Rect getBounds(boolean reverse) { mBounds.set(0, 0, mWidth, mMaxEffectHeight); mBounds.offset(mX, mY - (reverse ? mMaxEffectHeight : 0)); return mBounds; } Loading Loading
api/current.txt +0 −1 Original line number Diff line number Diff line Loading @@ -26377,7 +26377,6 @@ package android.widget { ctor public EdgeEffect(android.content.Context); method public boolean draw(android.graphics.Canvas); method public void finish(); method public android.graphics.Rect getBounds(); method public boolean isFinished(); method public void onAbsorb(int); method public void onPull(float);
core/java/android/widget/AbsListView.java +7 −17 Original line number Diff line number Diff line Loading @@ -2944,27 +2944,17 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mDirection = 0; // Reset when entering overscroll. mTouchMode = TOUCH_MODE_OVERSCROLL; if (rawDeltaY > 0) { if (!mEdgeGlowTop.isIdle()) { invalidate(mEdgeGlowTop.getBounds()); } else { invalidate(); } mEdgeGlowTop.onPull((float) overscroll / getHeight()); if (!mEdgeGlowBottom.isFinished()) { mEdgeGlowBottom.onRelease(); } invalidate(mEdgeGlowTop.getBounds(false)); } else if (rawDeltaY < 0) { if (!mEdgeGlowBottom.isIdle()) { invalidate(mEdgeGlowBottom.getBounds()); } else { invalidate(); } mEdgeGlowBottom.onPull((float) overscroll / getHeight()); if (!mEdgeGlowTop.isFinished()) { mEdgeGlowTop.onRelease(); } invalidate(mEdgeGlowBottom.getBounds(true)); } } } Loading Loading @@ -3002,13 +2992,13 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te if (!mEdgeGlowBottom.isFinished()) { mEdgeGlowBottom.onRelease(); } invalidate(mEdgeGlowTop.getBounds()); invalidate(mEdgeGlowTop.getBounds(false)); } else if (rawDeltaY < 0) { mEdgeGlowBottom.onPull((float) overScrollDistance / getHeight()); if (!mEdgeGlowTop.isFinished()) { mEdgeGlowTop.onRelease(); } invalidate(mEdgeGlowBottom.getBounds()); invalidate(mEdgeGlowBottom.getBounds(true)); } } } Loading Loading @@ -3485,7 +3475,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mEdgeGlowTop.setSize(width, getHeight()); if (mEdgeGlowTop.draw(canvas)) { mEdgeGlowTop.setPosition(leftPadding, edgeY); invalidate(mEdgeGlowTop.getBounds()); invalidate(mEdgeGlowTop.getBounds(false)); } canvas.restoreToCount(restoreCount); } Loading @@ -3503,8 +3493,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mEdgeGlowBottom.setSize(width, height); if (mEdgeGlowBottom.draw(canvas)) { // Account for the rotation mEdgeGlowBottom.setPosition(edgeX + width, edgeY - mEdgeGlowBottom.getHeight()); invalidate(mEdgeGlowBottom.getBounds()); mEdgeGlowBottom.setPosition(edgeX + width, edgeY); invalidate(mEdgeGlowBottom.getBounds(true)); } canvas.restoreToCount(restoreCount); } Loading
core/java/android/widget/EdgeEffect.java +23 −23 Original line number Diff line number Diff line Loading @@ -123,6 +123,11 @@ public class EdgeEffect { private final Rect mBounds = new Rect(); private final int mEdgeHeight; private final int mGlowHeight; private final int mGlowWidth; private final int mMaxEffectHeight; /** * Construct a new EdgeEffect with a theme appropriate for the provided context. * @param context Context used to provide theming and resource information for the EdgeEffect Loading @@ -132,6 +137,14 @@ public class EdgeEffect { mEdge = res.getDrawable(R.drawable.overscroll_edge); mGlow = res.getDrawable(R.drawable.overscroll_glow); mEdgeHeight = mEdge.getIntrinsicHeight(); mGlowHeight = mGlow.getIntrinsicHeight(); mGlowWidth = mGlow.getIntrinsicWidth(); mMaxEffectHeight = (int) (Math.min( mGlowHeight * MAX_GLOW_HEIGHT * mGlowHeight / mGlowWidth * 0.6f, mGlowHeight * MAX_GLOW_HEIGHT) + 0.5f); mMinWidth = (int) (res.getDisplayMetrics().density * MIN_WIDTH + 0.5f); mInterpolator = new DecelerateInterpolator(); } Loading @@ -149,7 +162,7 @@ public class EdgeEffect { /** * Set the position of this edge effect in pixels. This position is * only used by {@link #getBounds()}. * only used by {@link #getBounds(boolean)}. * * @param x The position of the edge effect on the X axis * @param y The position of the edge effect on the Y axis Loading @@ -159,17 +172,6 @@ public class EdgeEffect { mY = y; } boolean isIdle() { return mState == STATE_IDLE; } /** * Returns the height of the effect itself. */ int getHeight() { return Math.max(mGlow.getBounds().height(), mEdge.getBounds().height()); } /** * Reports if this EdgeEffect's animation is finished. If this method returns false * after a call to {@link #draw(Canvas)} the host widget should schedule another Loading Loading @@ -326,15 +328,11 @@ public class EdgeEffect { public boolean draw(Canvas canvas) { update(); final int edgeHeight = mEdge.getIntrinsicHeight(); final int glowHeight = mGlow.getIntrinsicHeight(); final int glowWidth = mGlow.getIntrinsicWidth(); mGlow.setAlpha((int) (Math.max(0, Math.min(mGlowAlpha, 1)) * 255)); int glowBottom = (int) Math.min( glowHeight * mGlowScaleY * glowHeight/ glowWidth * 0.6f, glowHeight * MAX_GLOW_HEIGHT); mGlowHeight * mGlowScaleY * mGlowHeight / mGlowWidth * 0.6f, mGlowHeight * MAX_GLOW_HEIGHT); if (mWidth < mMinWidth) { // Center the glow and clip it. int glowLeft = (mWidth - mMinWidth)/2; Loading @@ -348,7 +346,7 @@ public class EdgeEffect { mEdge.setAlpha((int) (Math.max(0, Math.min(mEdgeAlpha, 1)) * 255)); int edgeBottom = (int) (edgeHeight * mEdgeScaleY); int edgeBottom = (int) (mEdgeHeight * mEdgeScaleY); if (mWidth < mMinWidth) { // Center the edge and clip it. int edgeLeft = (mWidth - mMinWidth)/2; Loading @@ -368,11 +366,13 @@ public class EdgeEffect { /** * Returns the bounds of the edge effect. * * @hide */ public Rect getBounds() { mBounds.set(mGlow.getBounds()); mBounds.union(mEdge.getBounds()); mBounds.offset(mX, mY); public Rect getBounds(boolean reverse) { mBounds.set(0, 0, mWidth, mMaxEffectHeight); mBounds.offset(mX, mY - (reverse ? mMaxEffectHeight : 0)); return mBounds; } Loading