Search in sources :

Example 61 with BubbleTextView

use of com.android.launcher3.BubbleTextView in project android_packages_apps_Launcher3 by ArrowOS.

the class SecondaryDragLayer method onIconLongClicked.

private boolean onIconLongClicked(View v) {
    if (!(v instanceof BubbleTextView)) {
        return false;
    }
    if (PopupContainerWithArrow.getOpen(mActivity) != null) {
        // There is already an items container open, so don't open this one.
        v.clearFocus();
        return false;
    }
    ItemInfo item = (ItemInfo) v.getTag();
    if (!ShortcutUtil.supportsShortcuts(item)) {
        return false;
    }
    final PopupContainerWithArrow container = (PopupContainerWithArrow) mActivity.getLayoutInflater().inflate(R.layout.popup_container, mActivity.getDragLayer(), false);
    container.populateAndShow((BubbleTextView) v, mActivity.getPopupDataProvider().getShortcutCountForItem(item), Collections.emptyList(), Arrays.asList(mPinnedAppsAdapter.getSystemShortcut(item), APP_INFO.getShortcut(mActivity, item)));
    v.getParent().requestDisallowInterceptTouchEvent(true);
    return true;
}
Also used : ItemInfo(com.android.launcher3.model.data.ItemInfo) PopupContainerWithArrow(com.android.launcher3.popup.PopupContainerWithArrow) BubbleTextView(com.android.launcher3.BubbleTextView)

Example 62 with BubbleTextView

use of com.android.launcher3.BubbleTextView in project android_packages_apps_Launcher3 by ArrowOS.

the class PreviewItemManager method prepareCreateAnimation.

Drawable prepareCreateAnimation(final View destView) {
    Drawable animateDrawable = ((BubbleTextView) destView).getIcon();
    computePreviewDrawingParams(animateDrawable.getIntrinsicWidth(), destView.getMeasuredWidth());
    mReferenceDrawable = animateDrawable;
    return animateDrawable;
}
Also used : Drawable(android.graphics.drawable.Drawable) PreloadIconDrawable(com.android.launcher3.graphics.PreloadIconDrawable) BubbleTextView(com.android.launcher3.BubbleTextView)

Example 63 with BubbleTextView

use of com.android.launcher3.BubbleTextView in project android_packages_apps_Launcher3 by ArrowOS.

the class FolderPagedView method createNewView.

@SuppressLint("InflateParams")
public View createNewView(WorkspaceItemInfo item) {
    if (item == null) {
        return null;
    }
    final BubbleTextView textView = mViewCache.getView(R.layout.folder_application, 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;
}
Also used : CellLayout(com.android.launcher3.CellLayout) BubbleTextView(com.android.launcher3.BubbleTextView) SuppressLint(android.annotation.SuppressLint)

Example 64 with BubbleTextView

use of com.android.launcher3.BubbleTextView in project android_packages_apps_Launcher3 by ArrowOS.

the class FolderPagedView method arrangeChildren.

/**
 * Updates position and rank of all the children in the view.
 * It essentially removes all views from all the pages and then adds them again in appropriate
 * page.
 *
 * @param list the ordered list of children.
 */
@SuppressLint("RtlHardcoded")
public void arrangeChildren(List<View> list) {
    int itemCount = list.size();
    ArrayList<CellLayout> pages = new ArrayList<>();
    for (int i = 0; i < getChildCount(); i++) {
        CellLayout page = (CellLayout) getChildAt(i);
        page.removeAllViews();
        pages.add(page);
    }
    mOrganizer.setFolderInfo(mFolder.getInfo());
    setupContentDimensions(itemCount);
    Iterator<CellLayout> pageItr = pages.iterator();
    CellLayout currentPage = null;
    int position = 0;
    int rank = 0;
    for (int i = 0; i < itemCount; i++) {
        View v = list.size() > i ? list.get(i) : null;
        if (currentPage == null || position >= mOrganizer.getMaxItemsPerPage()) {
            // Next page
            if (pageItr.hasNext()) {
                currentPage = pageItr.next();
            } else {
                currentPage = createAndAddNewPage();
            }
            position = 0;
        }
        if (v != null) {
            CellLayout.LayoutParams lp = (CellLayout.LayoutParams) v.getLayoutParams();
            ItemInfo info = (ItemInfo) v.getTag();
            lp.setCellXY(mOrganizer.getPosForRank(rank));
            currentPage.addViewToCellLayout(v, -1, info.getViewId(), lp, true);
            if (mOrganizer.isItemInPreview(rank) && v instanceof BubbleTextView) {
                ((BubbleTextView) v).verifyHighRes();
            }
        }
        rank++;
        position++;
    }
    // Remove extra views.
    boolean removed = false;
    while (pageItr.hasNext()) {
        removeView(pageItr.next());
        removed = true;
    }
    if (removed) {
        setCurrentPage(0);
    }
    setEnableOverscroll(getPageCount() > 1);
    // Update footer
    mPageIndicator.setVisibility(getPageCount() > 1 ? View.VISIBLE : View.GONE);
    // Set the gravity as LEFT or RIGHT instead of START, as START depends on the actual text.
    mFolder.mFolderName.setGravity(getPageCount() > 1 ? (mIsRtl ? Gravity.RIGHT : Gravity.LEFT) : Gravity.CENTER_HORIZONTAL);
}
Also used : CellLayout(com.android.launcher3.CellLayout) ItemInfo(com.android.launcher3.model.data.ItemInfo) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) ArrayList(java.util.ArrayList) BubbleTextView(com.android.launcher3.BubbleTextView) ClipPathView(com.android.launcher3.views.ClipPathView) BubbleTextView(com.android.launcher3.BubbleTextView) View(android.view.View) PagedView(com.android.launcher3.PagedView) AbstractFloatingView(com.android.launcher3.AbstractFloatingView) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Example 65 with BubbleTextView

use of com.android.launcher3.BubbleTextView in project android_packages_apps_Launcher3 by ArrowOS.

the class BaseDraggingActivity method getActivityLaunchOptions.

@NonNull
public ActivityOptionsWrapper getActivityLaunchOptions(View v, @Nullable ItemInfo item) {
    int left = 0, top = 0;
    int width = v.getMeasuredWidth(), height = v.getMeasuredHeight();
    if (v instanceof BubbleTextView) {
        // Launch from center of icon, not entire view
        Drawable icon = ((BubbleTextView) v).getIcon();
        if (icon != null) {
            Rect bounds = icon.getBounds();
            left = (width - bounds.width()) / 2;
            top = v.getPaddingTop();
            width = bounds.width();
            height = bounds.height();
        }
    }
    ActivityOptions options = ActivityOptions.makeClipRevealAnimation(v, left, top, width, height);
    RunnableList callback = new RunnableList();
    addOnResumeCallback(callback::executeAllAndDestroy);
    return new ActivityOptionsWrapper(options, callback);
}
Also used : Rect(android.graphics.Rect) ActivityOptionsWrapper(com.android.launcher3.util.ActivityOptionsWrapper) Drawable(android.graphics.drawable.Drawable) RunnableList(com.android.launcher3.util.RunnableList) Point(android.graphics.Point) ActivityOptions(android.app.ActivityOptions) NonNull(androidx.annotation.NonNull)

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