Merge "Using an independent drawable for rounded corners" into sc-dev
This commit is contained in:
commit
70c3d5f98b
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -512,7 +512,7 @@ public abstract class AbstractLauncherUiTest {
|
|||
}
|
||||
|
||||
protected boolean isInBackground(Launcher launcher) {
|
||||
return !launcher.hasBeenResumed();
|
||||
return launcher == null || !launcher.hasBeenResumed();
|
||||
}
|
||||
|
||||
protected boolean isInState(Supplier<LauncherState> state) {
|
||||
|
|
Loading…
Reference in New Issue