use of com.android.launcher3.BubbleTextView in project Neo-Launcher by NeoApplications.
the class FolderPagedView method createNewView.
@SuppressLint("InflateParams")
public View createNewView(WorkspaceItemInfo item) {
if (item == null) {
return null;
}
int layout = mFolder.isInAppDrawer() ? R.layout.all_apps_folder_application : R.layout.folder_application;
final BubbleTextView textView = mViewCache.getView(layout, getContext(), null);
textView.applyFromWorkspaceItem(item);
textView.setOnClickListener(ItemClickHandler.INSTANCE);
textView.setOnLongClickListener(mFolder);
textView.setOnFocusChangeListener(mFocusIndicatorHelper);
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) textView.getLayoutParams();
if (lp == null) {
textView.setLayoutParams(new CellLayout.LayoutParams(item.cellX, item.cellY, item.spanX, item.spanY));
} else {
lp.cellX = item.cellX;
lp.cellY = item.cellY;
lp.cellHSpan = lp.cellVSpan = 1;
}
return textView;
}
use of com.android.launcher3.BubbleTextView in project Neo-Launcher by NeoApplications.
the class FolderPagedView method verifyVisibleHighResIcons.
/**
* Ensures that all the icons on the given page are of high-res
*/
public void verifyVisibleHighResIcons(int pageNo) {
CellLayout page = getPageAt(pageNo);
if (page != null) {
ShortcutAndWidgetContainer parent = page.getShortcutsAndWidgets();
for (int i = parent.getChildCount() - 1; i >= 0; i--) {
BubbleTextView icon = ((BubbleTextView) parent.getChildAt(i));
icon.verifyHighRes();
// Set the callback back to the actual icon, in case
// it was captured by the FolderIcon
Drawable d = icon.getCompoundDrawables()[1];
if (d != null) {
d.setCallback(icon);
}
}
}
}
use of com.android.launcher3.BubbleTextView in project Neo-Launcher by NeoApplications.
the class DragPreviewProvider method createDragBitmap.
/**
* Returns a new bitmap to show when the {@link #mView} is being dragged around.
* Responsibility for the bitmap is transferred to the caller.
*/
public Bitmap createDragBitmap() {
int width = mView.getWidth();
int height = mView.getHeight();
if (mView instanceof BubbleTextView) {
Drawable d = ((BubbleTextView) mView).getIcon();
Rect bounds = getDrawableBounds(d);
width = bounds.width();
height = bounds.height();
} else if (mView instanceof LauncherAppWidgetHostView) {
float scale = ((LauncherAppWidgetHostView) mView).getScaleToFit();
width = (int) (mView.getWidth() * scale);
height = (int) (mView.getHeight() * scale);
if (mView instanceof PendingAppWidgetHostView) {
// Use hardware renderer as the icon for the pending app widget may be a hw bitmap
return BitmapRenderer.createHardwareBitmap(width + blurSizeOutline, height + blurSizeOutline, (c) -> drawDragView(c, scale));
} else {
// Use software renderer for widgets as we know that they already work
return BitmapRenderer.createSoftwareBitmap(width + blurSizeOutline, height + blurSizeOutline, (c) -> drawDragView(c, scale));
}
}
return BitmapRenderer.createHardwareBitmap(width + blurSizeOutline, height + blurSizeOutline, (c) -> drawDragView(c, 1));
}
use of com.android.launcher3.BubbleTextView in project Neo-Launcher by NeoApplications.
the class DragPreviewProvider method drawDragView.
/**
* Draws the {@link #mView} into the given {@param destCanvas}.
*/
protected void drawDragView(Canvas destCanvas, float scale) {
destCanvas.save();
destCanvas.scale(scale, scale);
if (mView instanceof BubbleTextView) {
Drawable d = ((BubbleTextView) mView).getIcon();
Rect bounds = getDrawableBounds(d);
destCanvas.translate(blurSizeOutline / 2 - bounds.left, blurSizeOutline / 2 - bounds.top);
if (d instanceof FastBitmapDrawable) {
((FastBitmapDrawable) d).setScale(1);
}
d.draw(destCanvas);
} else {
final Rect clipRect = mTempRect;
mView.getDrawingRect(clipRect);
boolean textVisible = false;
if (mView instanceof FolderIcon) {
// hide the text completely (which can't be achieved by clipping).
if (((FolderIcon) mView).getTextVisible()) {
((FolderIcon) mView).setTextVisible(false);
textVisible = true;
}
}
destCanvas.translate(-mView.getScrollX() + blurSizeOutline / 2, -mView.getScrollY() + blurSizeOutline / 2);
destCanvas.clipRect(clipRect);
mView.draw(destCanvas);
// Restore text visibility of FolderIcon if necessary
if (textVisible) {
((FolderIcon) mView).setTextVisible(true);
}
}
destCanvas.restore();
}
use of com.android.launcher3.BubbleTextView in project Neo-Launcher by NeoApplications.
the class PopupContainerWithArrow method populateAndShow.
@TargetApi(Build.VERSION_CODES.P)
protected void populateAndShow(final BubbleTextView originalIcon, int shortcutCount, final List<NotificationKeyData> notificationKeys, List<SystemShortcut> systemShortcuts) {
mNumNotifications = notificationKeys.size();
mOriginalIcon = originalIcon;
// Add views
if (mNumNotifications > 0) {
// Add notification entries
View.inflate(getContext(), R.layout.notification_content, this);
mNotificationItemView = new NotificationItemView(this);
if (mNumNotifications == 1) {
mNotificationItemView.removeFooter();
}
updateNotificationHeader();
}
int viewsToFlip = getChildCount();
mSystemShortcutContainer = this;
if (shortcutCount > 0) {
if (mNotificationItemView != null) {
mNotificationItemView.addGutter();
}
for (int i = shortcutCount; i > 0; i--) {
mShortcuts.add(inflateAndAdd(R.layout.deep_shortcut, this));
}
updateHiddenShortcuts();
if (!systemShortcuts.isEmpty()) {
mSystemShortcutContainer = inflateAndAdd(R.layout.system_shortcut_icons, this);
for (SystemShortcut shortcut : systemShortcuts) {
initializeSystemShortcut(R.layout.system_shortcut_icon_only, mSystemShortcutContainer, shortcut);
}
}
} else if (!systemShortcuts.isEmpty()) {
if (mNotificationItemView != null) {
mNotificationItemView.addGutter();
}
for (SystemShortcut shortcut : systemShortcuts) {
initializeSystemShortcut(R.layout.system_shortcut, this, shortcut);
}
}
reorderAndShow(viewsToFlip);
ItemInfo originalItemInfo = (ItemInfo) originalIcon.getTag();
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
setAccessibilityPaneTitle(getTitleForAccessibility());
}
mLauncher.getDragController().addDragListener(this);
mOriginalIcon.setForceHideDot(true);
// All views are added. Animate layout from now on.
setLayoutTransition(new LayoutTransition());
// Load the shortcuts on a background thread and update the container as it animates.
MODEL_EXECUTOR.getHandler().postAtFrontOfQueue(PopupPopulator.createUpdateRunnable(mLauncher, originalItemInfo, new Handler(Looper.getMainLooper()), this, mShortcuts, notificationKeys));
}
Aggregations