Search in sources :

Example 31 with BubbleTextView

use of com.android.launcher3.BubbleTextView in project android_packages_apps_Trebuchet by LineageOS.

the class AllAppsGridAdapter method onCreateViewHolder.

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    switch(viewType) {
        case VIEW_TYPE_ICON:
            BubbleTextView icon = (BubbleTextView) mLayoutInflater.inflate(R.layout.all_apps_icon, parent, false);
            icon.setOnClickListener(mOnIconClickListener);
            icon.setOnLongClickListener(mOnIconLongClickListener);
            icon.setLongPressTimeoutFactor(1f);
            icon.setOnFocusChangeListener(mIconFocusListener);
            // Ensure the all apps icon height matches the workspace icons in portrait mode.
            icon.getLayoutParams().height = mLauncher.getDeviceProfile().allAppsCellHeightPx;
            return new ViewHolder(icon);
        case VIEW_TYPE_EMPTY_SEARCH:
            return new ViewHolder(mLayoutInflater.inflate(R.layout.all_apps_empty_search, parent, false));
        case VIEW_TYPE_SEARCH_MARKET:
            View searchMarketView = mLayoutInflater.inflate(R.layout.all_apps_search_market, parent, false);
            searchMarketView.setOnClickListener(v -> mLauncher.startActivitySafely(v, mMarketSearchIntent, null, AppLaunchTracker.CONTAINER_SEARCH));
            return new ViewHolder(searchMarketView);
        case VIEW_TYPE_ALL_APPS_DIVIDER:
            return new ViewHolder(mLayoutInflater.inflate(R.layout.all_apps_divider, parent, false));
        default:
            throw new RuntimeException("Unexpected view type");
    }
}
Also used : BubbleTextView(com.android.launcher3.BubbleTextView) BubbleTextView(com.android.launcher3.BubbleTextView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView)

Example 32 with BubbleTextView

use of com.android.launcher3.BubbleTextView in project android_packages_apps_Trebuchet by LineageOS.

the class AllAppsStore method updateAllIcons.

private void updateAllIcons(Consumer<BubbleTextView> action) {
    for (int i = mIconContainers.size() - 1; i >= 0; i--) {
        ViewGroup parent = mIconContainers.get(i);
        int childCount = parent.getChildCount();
        for (int j = 0; j < childCount; j++) {
            View child = parent.getChildAt(j);
            if (child instanceof BubbleTextView) {
                action.accept((BubbleTextView) child);
            }
        }
    }
}
Also used : ViewGroup(android.view.ViewGroup) BubbleTextView(com.android.launcher3.BubbleTextView) BubbleTextView(com.android.launcher3.BubbleTextView) View(android.view.View)

Example 33 with BubbleTextView

use of com.android.launcher3.BubbleTextView in project android_packages_apps_Trebuchet by LineageOS.

the class Folder method getItemsOnPage.

public List<BubbleTextView> getItemsOnPage(int page) {
    ArrayList<View> allItems = getIconsInReadingOrder();
    int lastPage = mContent.getPageCount() - 1;
    int totalItemsInFolder = allItems.size();
    int itemsPerPage = mContent.itemsPerPage();
    int numItemsOnCurrentPage = page == lastPage ? totalItemsInFolder - (itemsPerPage * page) : itemsPerPage;
    int startIndex = page * itemsPerPage;
    int endIndex = Math.min(startIndex + numItemsOnCurrentPage, allItems.size());
    List<BubbleTextView> itemsOnCurrentPage = new ArrayList<>(numItemsOnCurrentPage);
    for (int i = startIndex; i < endIndex; ++i) {
        itemsOnCurrentPage.add((BubbleTextView) allItems.get(i));
    }
    return itemsOnCurrentPage;
}
Also used : ArrayList(java.util.ArrayList) BubbleTextView(com.android.launcher3.BubbleTextView) ClipPathView(com.android.launcher3.views.ClipPathView) BubbleTextView(com.android.launcher3.BubbleTextView) View(android.view.View) TextView(android.widget.TextView) AppWidgetHostView(android.appwidget.AppWidgetHostView) PagedView(com.android.launcher3.PagedView) AbstractFloatingView(com.android.launcher3.AbstractFloatingView) SuppressLint(android.annotation.SuppressLint)

Example 34 with BubbleTextView

use of com.android.launcher3.BubbleTextView in project android_packages_apps_Trebuchet by LineageOS.

the class PopupContainerWithArrow method showForIcon.

/**
 * Shows the notifications and deep shortcuts associated with {@param icon}.
 * @return the container if shown or null.
 */
public static PopupContainerWithArrow showForIcon(BubbleTextView icon) {
    Launcher launcher = Launcher.getLauncher(icon.getContext());
    if (getOpen(launcher) != null) {
        // There is already an items container open, so don't open this one.
        icon.clearFocus();
        return null;
    }
    ItemInfo item = (ItemInfo) icon.getTag();
    if (!canShow(icon, item)) {
        return null;
    }
    final PopupContainerWithArrow container = (PopupContainerWithArrow) launcher.getLayoutInflater().inflate(R.layout.popup_container, launcher.getDragLayer(), false);
    container.configureForLauncher(launcher);
    PopupDataProvider popupDataProvider = launcher.getPopupDataProvider();
    container.populateAndShow(icon, popupDataProvider.getShortcutCountForItem(item), popupDataProvider.getNotificationKeysForItem(item), launcher.getSupportedShortcuts().map(s -> s.getShortcut(launcher, item)).filter(Objects::nonNull).collect(Collectors.toList()));
    launcher.refreshAndBindWidgetsForPackageUser(PackageUserKey.fromItemInfo(item));
    return container;
}
Also used : Rect(android.graphics.Rect) PointF(android.graphics.PointF) NOTIFICATION_ITEM_INFO(com.android.launcher3.notification.NotificationMainView.NOTIFICATION_ITEM_INFO) ImageView(android.widget.ImageView) DraggableView(com.android.launcher3.dragndrop.DraggableView) BubbleTextView(com.android.launcher3.BubbleTextView) LayoutTransition(android.animation.LayoutTransition) AttributeSet(android.util.AttributeSet) Handler(android.os.Handler) Looper(android.os.Looper) Map(java.util.Map) Target(com.android.launcher3.userevent.nano.LauncherLogProto.Target) View(android.view.View) ItemType(com.android.launcher3.userevent.nano.LauncherLogProto.ItemType) TargetApi(android.annotation.TargetApi) MAX_SHORTCUTS_IF_NOTIFICATIONS(com.android.launcher3.popup.PopupPopulator.MAX_SHORTCUTS_IF_NOTIFICATIONS) Utilities(com.android.launcher3.Utilities) ShortcutMenuAccessibilityDelegate(com.android.launcher3.accessibility.ShortcutMenuAccessibilityDelegate) Launcher(com.android.launcher3.Launcher) ShortcutDragPreviewProvider(com.android.launcher3.shortcuts.ShortcutDragPreviewProvider) Predicate(java.util.function.Predicate) Collectors(java.util.stream.Collectors) ViewGroup(android.view.ViewGroup) LauncherAccessibilityDelegate(com.android.launcher3.accessibility.LauncherAccessibilityDelegate) NotificationInfo(com.android.launcher3.notification.NotificationInfo) DragOptions(com.android.launcher3.dragndrop.DragOptions) Objects(java.util.Objects) List(java.util.List) ShortcutUtil(com.android.launcher3.util.ShortcutUtil) Context(android.content.Context) MODEL_EXECUTOR(com.android.launcher3.util.Executors.MODEL_EXECUTOR) ItemInfo(com.android.launcher3.model.data.ItemInfo) Utilities.squaredTouchSlop(com.android.launcher3.Utilities.squaredTouchSlop) NotificationKeyData(com.android.launcher3.notification.NotificationKeyData) ArrayList(java.util.ArrayList) BaseDragLayer(com.android.launcher3.views.BaseDragLayer) ItemLongClickListener(com.android.launcher3.touch.ItemLongClickListener) Utilities.squaredHypot(com.android.launcher3.Utilities.squaredHypot) MAX_SHORTCUTS(com.android.launcher3.popup.PopupPopulator.MAX_SHORTCUTS) MotionEvent(android.view.MotionEvent) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) DragObject(com.android.launcher3.DropTarget.DragObject) AnimatorSet(android.animation.AnimatorSet) Build(android.os.Build) DragSource(com.android.launcher3.DragSource) NotificationItemView(com.android.launcher3.notification.NotificationItemView) ContainerType(com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType) DropTarget(com.android.launcher3.DropTarget) PopupDataChangeListener(com.android.launcher3.popup.PopupDataProvider.PopupDataChangeListener) CONTAINER_SHORTCUTS(com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SHORTCUTS) DragController(com.android.launcher3.dragndrop.DragController) PackageUserKey(com.android.launcher3.util.PackageUserKey) Point(android.graphics.Point) DeepShortcutView(com.android.launcher3.shortcuts.DeepShortcutView) BaseDraggingActivity(com.android.launcher3.BaseDraggingActivity) R(com.android.launcher3.R) LoggerUtils.newContainerTarget(com.android.launcher3.logging.LoggerUtils.newContainerTarget) AbstractFloatingView(com.android.launcher3.AbstractFloatingView) DragView(com.android.launcher3.dragndrop.DragView) DotInfo(com.android.launcher3.dot.DotInfo) ItemInfoWithIcon(com.android.launcher3.model.data.ItemInfoWithIcon) ItemInfo(com.android.launcher3.model.data.ItemInfo) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) Objects(java.util.Objects) Launcher(com.android.launcher3.Launcher)

Example 35 with BubbleTextView

use of com.android.launcher3.BubbleTextView in project android_packages_apps_Trebuchet by LineageOS.

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);
            }
        }
    }
}
Also used : CellLayout(com.android.launcher3.CellLayout) ShortcutAndWidgetContainer(com.android.launcher3.ShortcutAndWidgetContainer) Drawable(android.graphics.drawable.Drawable) BubbleTextView(com.android.launcher3.BubbleTextView) SuppressLint(android.annotation.SuppressLint)

Aggregations

BubbleTextView (com.android.launcher3.BubbleTextView)157 View (android.view.View)82 Rect (android.graphics.Rect)62 Point (android.graphics.Point)61 Drawable (android.graphics.drawable.Drawable)60 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)57 ItemInfo (com.android.launcher3.model.data.ItemInfo)56 SuppressLint (android.annotation.SuppressLint)48 ArrayList (java.util.ArrayList)43 CellLayout (com.android.launcher3.CellLayout)39 Animator (android.animation.Animator)36 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)36 DragView (com.android.launcher3.dragndrop.DragView)34 FolderIcon (com.android.launcher3.folder.FolderIcon)34 Handler (android.os.Handler)33 ViewGroup (android.view.ViewGroup)30 DraggableView (com.android.launcher3.dragndrop.DraggableView)30 PreloadIconDrawable (com.android.launcher3.graphics.PreloadIconDrawable)30 AbstractFloatingView (com.android.launcher3.AbstractFloatingView)28 Folder (com.android.launcher3.folder.Folder)28