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);
}
}
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;
}
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());
}
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);
}
}
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;
}
Aggregations