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

Commit 70c3d5f9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Using an independent drawable for rounded corners" into sc-dev

parents e0536137 940c27ef
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ public class TaskIconCache {
                    key.getComponent(), key.userId);
            if (activityInfo != null) {
                BitmapInfo bitmapInfo = getBitmapInfo(
                        mIconProvider.getIcon(activityInfo, UserHandle.of(key.userId)),
                        mIconProvider.getIcon(activityInfo),
                        key.userId,
                        desc.getPrimaryColor(),
                        activityInfo.applicationInfo.isInstantApp());
+6 −9
Original line number Diff line number Diff line
@@ -541,20 +541,17 @@ public class WidgetPreviewLoader {
            c.setBitmap(preview);
            c.drawColor(0, PorterDuff.Mode.CLEAR);
        }
        RectF boxRect = drawBoxWithShadow(c, size, size);

        drawBoxWithShadow(c, size, size);

        LauncherIcons li = LauncherIcons.obtain(mContext);
        Bitmap icon = li.createBadgedIconBitmap(
        Drawable icon = li.createBadgedIconBitmap(
                mutateOnMainThread(info.getFullResIcon(mIconCache)),
                Process.myUserHandle(), 0).icon;
                Process.myUserHandle(), 0).newIcon(launcher);
        li.recycle();

        Rect src = new Rect(0, 0, icon.getWidth(), icon.getHeight());

        boxRect.set(0, 0, iconSize, iconSize);
        boxRect.offset(padding, padding);
        c.drawBitmap(icon, src, boxRect,
                new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG));
        icon.setBounds(padding, padding, padding + iconSize, padding + iconSize);
        icon.draw(c);
        c.setBitmap(null);
        return preview;
    }
+2 −4
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.app.ActivityOptions;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.os.Bundle;
@@ -86,9 +85,8 @@ public class NotificationInfo implements View.OnClickListener {
            mIsIconLarge = true;
        }
        if (mIconDrawable == null) {
            mIconDrawable = new BitmapDrawable(context.getResources(), LauncherAppState
                    .getInstance(context).getIconCache()
                    .getDefaultIcon(statusBarNotification.getUser()).icon);
            mIconDrawable = LauncherAppState.getInstance(context).getIconCache()
                    .getDefaultIcon(statusBarNotification.getUser()).newIcon(context);
        }
        intent = notification.contentIntent;
        autoCancel = (notification.flags & Notification.FLAG_AUTO_CANCEL) != 0;
+3 −2
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import com.android.launcher3.dragndrop.DraggableView;
import com.android.launcher3.graphics.DragPreviewProvider;
import com.android.launcher3.icons.FastBitmapDrawable;
import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.icons.RoundDrawableWrapper;
import com.android.launcher3.widget.dragndrop.AppWidgetHostViewDragListener;

/**
@@ -118,12 +119,12 @@ public class PendingItemDragHelper extends DragPreviewProvider {
                        .addDragListener(new AppWidgetHostViewDragListener(launcher));
            }
            if (preview == null) {
                FastBitmapDrawable p = new FastBitmapDrawable(
                Drawable p = new FastBitmapDrawable(
                        app.getWidgetCache().generateWidgetPreview(launcher,
                                createWidgetInfo.info, maxWidth, null,
                                previewSizeBeforeScale).first);
                if (RoundedCornerEnforcement.isRoundedCornerEnabled()) {
                    p.setRoundedCornersRadius(mEnforcedRoundedCornersForWidget);
                    p = new RoundDrawableWrapper(p, mEnforcedRoundedCornersForWidget);
                }
                preview = p;
            }
+2 −2
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import com.android.launcher3.dragndrop.AppWidgetHostViewDrawable;
import com.android.launcher3.icons.BaseIconFactory;
import com.android.launcher3.icons.BitmapRenderer;
import com.android.launcher3.icons.FastBitmapDrawable;
import com.android.launcher3.icons.RoundDrawableWrapper;
import com.android.launcher3.model.WidgetItem;

/**
@@ -248,8 +249,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {

    public void applyPreview(Bitmap bitmap) {
        FastBitmapDrawable drawable = new FastBitmapDrawable(bitmap);
        drawable.setRoundedCornersRadius(mEnforcedCornerRadius);
        applyPreview(drawable);
        applyPreview(new RoundDrawableWrapper(drawable, mEnforcedCornerRadius));
    }

    private void applyPreview(Drawable drawable) {
Loading