Search in sources :

Example 6 with DeepShortcutView

use of com.android.launcher3.shortcuts.DeepShortcutView in project android_packages_apps_Launcher3 by AOSPA.

the class PopupContainerWithArrow method updateHiddenShortcuts.

private void updateHiddenShortcuts() {
    int allowedCount = mNotificationContainer != null ? MAX_SHORTCUTS_IF_NOTIFICATIONS : MAX_SHORTCUTS;
    int total = mShortcuts.size();
    for (int i = 0; i < total; i++) {
        DeepShortcutView view = mShortcuts.get(i);
        view.setVisibility(i >= allowedCount ? GONE : VISIBLE);
    }
}
Also used : Point(android.graphics.Point) DeepShortcutView(com.android.launcher3.shortcuts.DeepShortcutView)

Example 7 with DeepShortcutView

use of com.android.launcher3.shortcuts.DeepShortcutView in project android_packages_apps_Launcher3 by AOSPA.

the class OptionsPopupView method show.

public static OptionsPopupView show(Launcher launcher, RectF targetRect, List<OptionItem> items, boolean shouldAddArrow, int width) {
    OptionsPopupView popup = (OptionsPopupView) launcher.getLayoutInflater().inflate(R.layout.longpress_options_menu, launcher.getDragLayer(), false);
    popup.mTargetRect = targetRect;
    popup.setShouldAddArrow(shouldAddArrow);
    for (OptionItem item : items) {
        DeepShortcutView view = (DeepShortcutView) popup.inflateAndAdd(R.layout.system_shortcut, popup);
        if (width > 0) {
            view.getLayoutParams().width = width;
        }
        view.getIconView().setBackgroundDrawable(item.icon);
        view.getBubbleText().setText(item.label);
        view.setOnClickListener(popup);
        view.setOnLongClickListener(popup);
        popup.mItemMap.put(view, item);
    }
    popup.addPreDrawForColorExtraction(launcher);
    popup.show();
    return popup;
}
Also used : DeepShortcutView(com.android.launcher3.shortcuts.DeepShortcutView)

Example 8 with DeepShortcutView

use of com.android.launcher3.shortcuts.DeepShortcutView in project android_packages_apps_Trebuchet by LineageOS.

the class OptionsPopupView method show.

public static void show(Launcher launcher, RectF targetRect, List<OptionItem> items) {
    OptionsPopupView popup = (OptionsPopupView) launcher.getLayoutInflater().inflate(R.layout.longpress_options_menu, launcher.getDragLayer(), false);
    popup.mTargetRect = targetRect;
    for (OptionItem item : items) {
        DeepShortcutView view = (DeepShortcutView) popup.inflateAndAdd(R.layout.system_shortcut, popup);
        view.getIconView().setBackgroundResource(item.mIconRes);
        view.getBubbleText().setText(item.mLabelRes);
        view.setDividerVisibility(View.INVISIBLE);
        view.setOnClickListener(popup);
        view.setOnLongClickListener(popup);
        popup.mItemMap.put(view, item);
    }
    popup.reorderAndShow(popup.getChildCount());
}
Also used : DeepShortcutView(com.android.launcher3.shortcuts.DeepShortcutView)

Example 9 with DeepShortcutView

use of com.android.launcher3.shortcuts.DeepShortcutView in project android_packages_apps_Trebuchet by LineageOS.

the class PopupContainerWithArrow method updateHiddenShortcuts.

private void updateHiddenShortcuts() {
    int allowedCount = mNotificationItemView != null ? MAX_SHORTCUTS_IF_NOTIFICATIONS : MAX_SHORTCUTS;
    int originalHeight = getResources().getDimensionPixelSize(R.dimen.bg_popup_item_height);
    int itemHeight = mNotificationItemView != null ? getResources().getDimensionPixelSize(R.dimen.bg_popup_item_condensed_height) : originalHeight;
    float iconScale = ((float) itemHeight) / originalHeight;
    int total = mShortcuts.size();
    for (int i = 0; i < total; i++) {
        DeepShortcutView view = mShortcuts.get(i);
        view.setVisibility(i >= allowedCount ? GONE : VISIBLE);
        view.getLayoutParams().height = itemHeight;
        view.getIconView().setScaleX(iconScale);
        view.getIconView().setScaleY(iconScale);
    }
}
Also used : Point(android.graphics.Point) DeepShortcutView(com.android.launcher3.shortcuts.DeepShortcutView)

Example 10 with DeepShortcutView

use of com.android.launcher3.shortcuts.DeepShortcutView in project Neo-Launcher by NeoApplications.

the class PopupContainerWithArrow method onLongClick.

@Override
public boolean onLongClick(View v) {
    if (!ItemLongClickListener.canStartDrag(mLauncher))
        return false;
    // Return early if not the correct view
    if (!(v.getParent() instanceof DeepShortcutView))
        return false;
    // Long clicked on a shortcut.
    DeepShortcutView sv = (DeepShortcutView) v.getParent();
    sv.setWillDrawIcon(false);
    // Move the icon to align with the center-top of the touch point
    Point iconShift = new Point();
    iconShift.x = mIconLastTouchPos.x - sv.getIconCenter().x;
    iconShift.y = mIconLastTouchPos.y - mLauncher.getDeviceProfile().iconSizePx;
    DragView dv = mLauncher.getWorkspace().beginDragShared(sv.getIconView(), this, sv.getFinalInfo(), new ShortcutDragPreviewProvider(sv.getIconView(), iconShift), new DragOptions());
    dv.animateShift(-iconShift.x, -iconShift.y);
    // TODO: support dragging from within folder without having to close it
    AbstractFloatingView.closeOpenContainer(mLauncher, AbstractFloatingView.TYPE_FOLDER);
    return false;
}
Also used : DragOptions(com.android.launcher3.dragndrop.DragOptions) DragView(com.android.launcher3.dragndrop.DragView) ShortcutDragPreviewProvider(com.android.launcher3.shortcuts.ShortcutDragPreviewProvider) Point(android.graphics.Point) DeepShortcutView(com.android.launcher3.shortcuts.DeepShortcutView)

Aggregations

DeepShortcutView (com.android.launcher3.shortcuts.DeepShortcutView)57 Point (android.graphics.Point)19 BubbleTextView (com.android.launcher3.BubbleTextView)19 ImageView (android.widget.ImageView)18 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)18 ItemInfo (com.android.launcher3.model.data.ItemInfo)13 Handler (android.os.Handler)12 View (android.view.View)12 AbstractFloatingView (com.android.launcher3.AbstractFloatingView)12 DragView (com.android.launcher3.dragndrop.DragView)12 Drawable (android.graphics.drawable.Drawable)9 ArrayList (java.util.ArrayList)9 DraggableView (com.android.launcher3.dragndrop.DraggableView)8 ComponentName (android.content.ComponentName)7 ShortcutInfo (android.content.pm.ShortcutInfo)7 AdaptiveIconDrawable (android.graphics.drawable.AdaptiveIconDrawable)7 UserHandle (android.os.UserHandle)7 WorkerThread (androidx.annotation.WorkerThread)7 Utilities.getFullDrawable (com.android.launcher3.Utilities.getFullDrawable)7 NotificationInfo (com.android.launcher3.notification.NotificationInfo)7