use of com.android.launcher3.FastBitmapDrawable in project android_packages_apps_Launcher3 by ProtonAOSP.
the class DragPreviewProvider method createDrawable.
/**
* Returns a new drawable to show when the {@link #mView} is being dragged around.
* Responsibility for the drawable is transferred to the caller.
*/
public Drawable createDrawable() {
if (mView instanceof LauncherAppWidgetHostView) {
return null;
}
int width = 0;
int height = 0;
// Assume scaleX == scaleY, which is always the case for workspace items.
float scale = mView.getScaleX();
if (mView instanceof DraggableView) {
((DraggableView) mView).getSourceVisualDragBounds(mTempRect);
width = mTempRect.width();
height = mTempRect.height();
} else {
width = mView.getWidth();
height = mView.getHeight();
}
return new FastBitmapDrawable(BitmapRenderer.createHardwareBitmap(width + blurSizeOutline, height + blurSizeOutline, (c) -> drawDragView(c, scale)));
}
use of com.android.launcher3.FastBitmapDrawable in project android_packages_apps_Launcher3 by ProtonAOSP.
the class FloatingIconView method fetchIcon.
/**
* Loads the icon drawable on a worker thread to reduce latency between swapping views.
*/
@UiThread
public static IconLoadResult fetchIcon(Launcher l, View v, ItemInfo info, boolean isOpening) {
RectF position = new RectF();
getLocationBoundsForView(l, v, isOpening, position);
final FastBitmapDrawable btvIcon;
if (v instanceof BubbleTextView) {
BubbleTextView btv = (BubbleTextView) v;
if (info instanceof ItemInfoWithIcon && (((ItemInfoWithIcon) info).runtimeStatusFlags & ItemInfoWithIcon.FLAG_SHOW_DOWNLOAD_PROGRESS_MASK) != 0) {
btvIcon = btv.makePreloadIcon();
} else {
btvIcon = btv.getIcon();
}
} else {
btvIcon = null;
}
IconLoadResult result = new IconLoadResult(info, btvIcon == null ? false : btvIcon.isThemed());
result.btvDrawable = btvIcon;
final long fetchIconId = sFetchIconId++;
MODEL_EXECUTOR.getHandler().postAtFrontOfQueue(() -> {
if (fetchIconId < sRecycledFetchIconId) {
return;
}
getIconResult(l, v, info, position, btvIcon, result);
});
sIconLoadResult = result;
return result;
}
use of com.android.launcher3.FastBitmapDrawable in project android_packages_apps_Launcher3 by ProtonAOSP.
the class BubbleTextView method applyIconAndLabel.
@UiThread
protected void applyIconAndLabel(ItemInfoWithIcon info) {
boolean useTheme = mDisplay == DISPLAY_WORKSPACE || mDisplay == DISPLAY_FOLDER || mDisplay == DISPLAY_TASKBAR;
FastBitmapDrawable iconDrawable = info.newIcon(getContext(), useTheme);
mDotParams.color = IconPalette.getMutedColor(iconDrawable.getIconColor(), 0.54f);
setIcon(iconDrawable);
applyLabel(info);
}
use of com.android.launcher3.FastBitmapDrawable in project Launcher3 by chislon.
the class AppsCustomizePagedView method onSyncWidgetPageItems.
private void onSyncWidgetPageItems(AsyncTaskPageData data) {
if (mInTransition) {
mDeferredSyncWidgetPageItems.add(data);
return;
}
try {
int page = data.page;
PagedViewGridLayout layout = (PagedViewGridLayout) getPageAt(page);
ArrayList<Object> items = data.items;
int count = items.size();
for (int i = 0; i < count; ++i) {
PagedViewWidget widget = (PagedViewWidget) layout.getChildAt(i);
if (widget != null) {
Bitmap preview = data.generatedImages.get(i);
widget.applyPreview(new FastBitmapDrawable(preview), i);
}
}
enableHwLayersOnVisiblePages();
// Update all thread priorities
Iterator<AppsCustomizeAsyncTask> iter = mRunningTasks.iterator();
while (iter.hasNext()) {
AppsCustomizeAsyncTask task = (AppsCustomizeAsyncTask) iter.next();
int pageIndex = task.page;
task.setThreadPriority(getThreadPriorityForPage(pageIndex));
}
} finally {
data.cleanup(false);
}
}
use of com.android.launcher3.FastBitmapDrawable in project android_packages_apps_404Launcher by P-404.
the class BubbleTextView method applyIconAndLabel.
@UiThread
protected void applyIconAndLabel(ItemInfoWithIcon info) {
boolean useTheme = mDisplay == DISPLAY_WORKSPACE || mDisplay == DISPLAY_FOLDER || mDisplay == DISPLAY_TASKBAR;
FastBitmapDrawable iconDrawable = info.newIcon(getContext(), useTheme);
mDotParams.color = IconPalette.getMutedColor(iconDrawable.getIconColor(), 0.54f);
setIcon(iconDrawable);
applyLabel(info);
}
Aggregations