Search in sources :

Example 1 with TAP

use of com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP in project android_packages_apps_Trebuchet by LineageOS.

the class DeleteDropTarget method completeDrop.

@Override
public void completeDrop(DragObject d) {
    ItemInfo item = d.dragInfo;
    if (canRemove(item)) {
        int itemPage = mLauncher.getWorkspace().getCurrentPage();
        onAccessibilityDrop(null, item);
        ModelWriter modelWriter = mLauncher.getModelWriter();
        Runnable onUndoClicked = () -> {
            mLauncher.setPageToBindSynchronously(itemPage);
            modelWriter.abortDelete();
            mLauncher.getUserEventDispatcher().logActionOnControl(TAP, UNDO);
        };
        Snackbar.show(mLauncher, R.string.item_removed, R.string.undo, modelWriter::commitDelete, onUndoClicked);
    }
}
Also used : ItemInfo(com.android.launcher3.model.data.ItemInfo) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) ModelWriter(com.android.launcher3.model.ModelWriter)

Example 2 with TAP

use of com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP in project android_packages_apps_Trebuchet by LineageOS.

the class PopupContainerWithArrow method onControllerInterceptTouchEvent.

@Override
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
    if (ev.getAction() == MotionEvent.ACTION_DOWN) {
        BaseDragLayer dl = getPopupContainer();
        if (!dl.isEventOverView(this, ev)) {
            mLauncher.getUserEventDispatcher().logActionTapOutside(newContainerTarget(ContainerType.DEEPSHORTCUTS));
            close(true);
            // the app with one tap if they don't find a shortcut they want.
            return mOriginalIcon == null || !dl.isEventOverView(mOriginalIcon, ev);
        }
    }
    return false;
}
Also used : BaseDragLayer(com.android.launcher3.views.BaseDragLayer)

Example 3 with TAP

use of com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP in project Neo-Launcher by NeoApplications.

the class SmartspaceCard method click.

void click(View view) {
    if (this.dI.cG == null) {
        Log.e("SmartspaceCard", "no tap action available: " + this);
        return;
    }
    Intent intent = new Intent(this.getIntent());
    Launcher launcher = Launcher.getLauncher(view.getContext());
    switch(this.dI.cG.cY) {
        default:
            {
                Log.w("SmartspaceCard", "unrecognized tap action: " + this);
                break;
            }
        case 1:
            {
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                intent.setSourceBounds(launcher.getViewBounds(view));
                intent.setPackage(FeedBridge.Companion.getInstance(mContext).resolveSmartspace());
                view.getContext().sendBroadcast(intent);
                break;
            }
        case 2:
            {
                launcher.startActivitySafely(view, intent, null, null);
                break;
            }
    }
}
Also used : Launcher(com.android.launcher3.Launcher) Intent(android.content.Intent)

Example 4 with TAP

use of com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP in project Neo-Launcher by NeoApplications.

the class PopupContainerWithArrow method onControllerInterceptTouchEvent.

@Override
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
    if (ev.getAction() == MotionEvent.ACTION_DOWN) {
        BaseDragLayer dl = getPopupContainer();
        if (!dl.isEventOverView(this, ev)) {
            mLauncher.getUserEventDispatcher().logActionTapOutside(LoggerUtils.newContainerTarget(ContainerType.DEEPSHORTCUTS));
            close(true);
            // the app with one tap if they don't find a shortcut they want.
            return mOriginalIcon == null || !dl.isEventOverView(mOriginalIcon, ev);
        }
    }
    return false;
}
Also used : BaseDragLayer(com.android.launcher3.views.BaseDragLayer)

Example 5 with TAP

use of com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP in project Neo-Launcher by NeoApplications.

the class DeleteDropTarget method completeDrop.

@Override
public void completeDrop(DragObject d) {
    ItemInfo item = d.dragInfo;
    if (canRemove(item)) {
        int itemPage = mLauncher.getWorkspace().getCurrentPage();
        onAccessibilityDrop(null, item);
        ModelWriter modelWriter = mLauncher.getModelWriter();
        Runnable onUndoClicked = () -> {
            modelWriter.abortDelete(itemPage);
            mLauncher.getUserEventDispatcher().logActionOnControl(TAP, UNDO);
        };
        Snackbar.show(mLauncher, R.string.item_removed, R.string.undo, modelWriter::commitDelete, onUndoClicked);
    }
}
Also used : ModelWriter(com.android.launcher3.model.ModelWriter)

Aggregations

LoggerUtils.newLauncherEvent (com.android.launcher3.logging.LoggerUtils.newLauncherEvent)2 ModelWriter (com.android.launcher3.model.ModelWriter)2 LauncherEvent (com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent)2 BaseDragLayer (com.android.launcher3.views.BaseDragLayer)2 Intent (android.content.Intent)1 Launcher (com.android.launcher3.Launcher)1 ItemInfo (com.android.launcher3.model.data.ItemInfo)1 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)1