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

Commit d1a6bd84 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "If the view for the drag preview is a BubbleTextVie use the icon...

Merge "If the view for the drag preview is a BubbleTextVie use the icon drawable for the preview" into udc-qpr-dev am: ea193019

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/24473798



Change-Id: Ice8719c8ba7b57ef386140fdf26c8ad8baba90a6
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 37ba5dd0 ea193019
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -21,10 +21,12 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.InsetDrawable;
import android.view.View;

import androidx.annotation.Nullable;

import com.android.launcher3.BubbleTextView;
import com.android.launcher3.R;
import com.android.launcher3.dragndrop.DraggableView;
import com.android.launcher3.icons.BitmapRenderer;
@@ -37,7 +39,6 @@ import com.android.launcher3.widget.LauncherAppWidgetHostView;
 * A utility class to generate preview bitmap for dragging.
 */
public class DragPreviewProvider {

    private final Rect mTempRect = new Rect();

    protected final View mView;
@@ -99,6 +100,14 @@ public class DragPreviewProvider {
            height = mView.getHeight();
        }

        if (mView instanceof BubbleTextView) {
            FastBitmapDrawable icon = ((BubbleTextView) mView).getIcon();
            Drawable drawable = icon.getConstantState().newDrawable();
            float xInset = (float) blurSizeOutline / (float) (width + blurSizeOutline);
            float yInset = (float) blurSizeOutline / (float) (height + blurSizeOutline);
            return new InsetDrawable(drawable, xInset / 2, yInset / 2, xInset / 2, yInset / 2);
        }

        return new FastBitmapDrawable(
                BitmapRenderer.createHardwareBitmap(width + blurSizeOutline,
                        height + blurSizeOutline, (c) -> drawDragView(c, scale)));