Search in sources :

Example 1 with OptionsPopupView

use of com.android.launcher3.views.OptionsPopupView in project android_packages_apps_Launcher3 by crdroidandroid.

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)

Aggregations

DeepShortcutView (com.android.launcher3.shortcuts.DeepShortcutView)1