Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b43d7589 authored by Mindy Pereira's avatar Mindy Pereira Committed by Android (Google) Code Review
Browse files

Merge "Update edge and glow rendering to match new specs."

parents 05063d8a a5531d78
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -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();
                }
+11 −7
Original line number Diff line number Diff line
@@ -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;