Merge "Show and update preload icons when they are in a FolderIcon preview." into ub-launcher3-dorval-polish
This commit is contained in:
committed by
Android (Google) Code Review
commit
7518fa2d40
@@ -30,6 +30,7 @@ import android.graphics.Rect;
|
||||
import android.graphics.Region;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.graphics.ColorUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Property;
|
||||
@@ -47,6 +48,7 @@ import com.android.launcher3.IconCache.ItemInfoUpdateReceiver;
|
||||
import com.android.launcher3.badge.BadgeInfo;
|
||||
import com.android.launcher3.badge.BadgeRenderer;
|
||||
import com.android.launcher3.folder.FolderIconPreviewVerifier;
|
||||
import com.android.launcher3.folder.FolderPagedView;
|
||||
import com.android.launcher3.graphics.DrawableFactory;
|
||||
import com.android.launcher3.graphics.HolographicOutlineHelper;
|
||||
import com.android.launcher3.graphics.IconPalette;
|
||||
@@ -207,6 +209,17 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver {
|
||||
applyFromShortcutInfo(info, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidateDrawable(@NonNull Drawable drawable) {
|
||||
super.invalidateDrawable(drawable);
|
||||
|
||||
if (getParent() != null
|
||||
&& getParent().getParent() != null
|
||||
&& getParent().getParent().getParent() instanceof FolderPagedView) {
|
||||
((FolderPagedView) getParent().getParent().getParent()).onIconInvalidated(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void applyFromShortcutInfo(ShortcutInfo info, boolean promiseStateChanged) {
|
||||
applyIconAndLabel(info.iconBitmap, info);
|
||||
setTag(info);
|
||||
|
||||
@@ -75,6 +75,7 @@ import com.android.launcher3.badge.FolderBadgeInfo;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.dragndrop.DragView;
|
||||
import com.android.launcher3.graphics.PreloadIconDrawable;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.graphics.IconPalette;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
@@ -511,7 +512,8 @@ public class FolderIcon extends FrameLayout implements FolderListener {
|
||||
if (d != null) {
|
||||
mTempBounds.set(d.getBounds());
|
||||
d.setBounds(0, 0, mIntrinsicIconSize, mIntrinsicIconSize);
|
||||
if (d instanceof FastBitmapDrawable) {
|
||||
boolean isPreloadIcon = d instanceof PreloadIconDrawable;
|
||||
if (!isPreloadIcon && d instanceof FastBitmapDrawable) {
|
||||
FastBitmapDrawable fd = (FastBitmapDrawable) d;
|
||||
fd.drawWithBrightness(canvas, params.overlayAlpha);
|
||||
} else {
|
||||
|
||||
@@ -180,6 +180,14 @@ public class FolderPagedView extends PagedView {
|
||||
super.dispatchDraw(canvas);
|
||||
}
|
||||
|
||||
public void onIconInvalidated(BubbleTextView icon) {
|
||||
FolderIcon folderIcon = mFolder.mFolderIcon;
|
||||
if (icon.getTag() instanceof ItemInfo
|
||||
&& folderIcon.mPreviewVerifier.isItemInPreview(((ItemInfo) icon.getTag()).rank)) {
|
||||
folderIcon.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds items to the layout.
|
||||
* @return list of items that could not be bound, probably because we hit the max size limit.
|
||||
|
||||
Reference in New Issue
Block a user