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

Commit 6f8f0195 authored by Robin Lee's avatar Robin Lee Committed by Android (Google) Code Review
Browse files

Merge "Redact GridTaskViewThumbnail"

parents c3f15749 7e9a26fb
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -77,10 +77,11 @@ public class TaskViewThumbnail extends View {
    @ViewDebug.ExportedProperty(category="recents")
    private float mDimAlpha;
    private Matrix mMatrix = new Matrix();
    protected Paint mDrawPaint = new Paint();
    private Paint mLockedPaint = new Paint();
    private Paint mDrawPaint = new Paint();
    protected Paint mLockedPaint = new Paint();
    protected Paint mBgFillPaint = new Paint();
    protected BitmapShader mBitmapShader;
    protected boolean mUserLocked = false;
    private LightingColorFilter mLightingColorFilter = new LightingColorFilter(0xffffffff, 0);

    // Clip the top of the thumbnail against the opaque header bar that overlaps this view
@@ -152,7 +153,7 @@ public class TaskViewThumbnail extends View {
        int thumbnailHeight = Math.min(viewHeight,
                (int) (mThumbnailRect.height() * mThumbnailScale));

        if (mTask != null && mTask.isLocked) {
        if (mUserLocked) {
            canvas.drawRoundRect(0, 0, viewWidth, viewHeight, mCornerRadius, mCornerRadius,
                    mLockedPaint);
        } else if (mBitmapShader != null && thumbnailWidth > 0 && thumbnailHeight > 0) {
@@ -343,6 +344,17 @@ public class TaskViewThumbnail extends View {
        updateThumbnailPaintFilter();
    }

    /**
     * Returns the {@link Paint} used to draw a task screenshot, or {@link #mLockedPaint} if the
     * thumbnail shouldn't be drawn because it belongs to a locked user.
     */
    protected Paint getDrawPaint() {
        if (mUserLocked) {
            return mLockedPaint;
        }
        return mDrawPaint;
    }

    /**
     * Binds the thumbnail view to the task.
     */
@@ -354,7 +366,10 @@ public class TaskViewThumbnail extends View {
        if (t.colorBackground != 0) {
            mBgFillPaint.setColor(t.colorBackground);
        }
        if (t.colorPrimary != 0) {
            mLockedPaint.setColor(t.colorPrimary);
        }
        mUserLocked = t.isLocked;
        EventBus.getDefault().register(this);
    }

+6 −7
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ public class GridTaskViewThumbnail extends TaskViewThumbnail {

    private Path mThumbnailOutline;
    private Path mRestBackgroundOutline;
    private Path mFullBackgroundOutline;
    // True if either this view's size or thumbnail scale has changed and mThumbnailOutline should
    // be updated.
    private boolean mUpdateThumbnailOutline = true;
@@ -145,10 +144,7 @@ public class GridTaskViewThumbnail extends TaskViewThumbnail {
                        90, 90, false); // F
                mRestBackgroundOutline.lineTo(l, t); // A
                mRestBackgroundOutline.close();

            }
        } else {
            mFullBackgroundOutline = mThumbnailOutline;
        }
    }

@@ -167,7 +163,10 @@ public class GridTaskViewThumbnail extends TaskViewThumbnail {
            updateThumbnailOutline();
            mUpdateThumbnailOutline = false;
        }
        if (mBitmapShader != null && thumbnailWidth > 0 && thumbnailHeight > 0) {

        if (mUserLocked) {
            canvas.drawPath(mThumbnailOutline, mLockedPaint);
        } else if (mBitmapShader != null && thumbnailWidth > 0 && thumbnailHeight > 0) {
            // Draw the background, there will be some small overdraw with the thumbnail
            if (thumbnailWidth < viewWidth) {
                // Portrait thumbnail on a landscape task view
@@ -177,9 +176,9 @@ public class GridTaskViewThumbnail extends TaskViewThumbnail {
                // Landscape thumbnail on a portrait task view
                canvas.drawPath(mRestBackgroundOutline, mBgFillPaint);
            }
            canvas.drawPath(mThumbnailOutline, mDrawPaint);
            canvas.drawPath(mThumbnailOutline, getDrawPaint());
        } else {
            canvas.drawPath(mFullBackgroundOutline, mBgFillPaint);
            canvas.drawPath(mThumbnailOutline, mBgFillPaint);
        }
    }
}