Search in sources :

Example 1 with DragStartEvent

use of com.android.systemui.recents.events.ui.dragndrop.DragStartEvent in project android_frameworks_base by ResurrectionRemix.

the class TaskView method onLongClick.

/**** View.OnLongClickListener Implementation ****/
@Override
public boolean onLongClick(View v) {
    SystemServicesProxy ssp = Recents.getSystemServices();
    boolean inBounds = false;
    Rect clipBounds = new Rect(mViewBounds.mClipBounds);
    if (!clipBounds.isEmpty()) {
        // If we are clipping the view to the bounds, manually do the hit test.
        clipBounds.scale(getScaleX());
        inBounds = clipBounds.contains(mDownTouchPos.x, mDownTouchPos.y);
    } else {
        // Otherwise just make sure we're within the view's bounds.
        inBounds = mDownTouchPos.x <= getWidth() && mDownTouchPos.y <= getHeight();
    }
    if (v == this && inBounds && !ssp.hasDockedTask()) {
        // Start listening for drag events
        setClipViewInStack(false);
        mDownTouchPos.x += ((1f - getScaleX()) * getWidth()) / 2;
        mDownTouchPos.y += ((1f - getScaleY()) * getHeight()) / 2;
        EventBus.getDefault().register(this, RecentsActivity.EVENT_BUS_PRIORITY + 1);
        EventBus.getDefault().send(new DragStartEvent(mTask, this, mDownTouchPos));
        return true;
    }
    return false;
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Rect(android.graphics.Rect) DragStartEvent(com.android.systemui.recents.events.ui.dragndrop.DragStartEvent)

Example 2 with DragStartEvent

use of com.android.systemui.recents.events.ui.dragndrop.DragStartEvent in project android_frameworks_base by AOSPA.

the class TaskView method onLongClick.

/**** View.OnLongClickListener Implementation ****/
@Override
public boolean onLongClick(View v) {
    SystemServicesProxy ssp = Recents.getSystemServices();
    boolean inBounds = false;
    Rect clipBounds = new Rect(mViewBounds.mClipBounds);
    if (!clipBounds.isEmpty()) {
        // If we are clipping the view to the bounds, manually do the hit test.
        clipBounds.scale(getScaleX());
        inBounds = clipBounds.contains(mDownTouchPos.x, mDownTouchPos.y);
    } else {
        // Otherwise just make sure we're within the view's bounds.
        inBounds = mDownTouchPos.x <= getWidth() && mDownTouchPos.y <= getHeight();
    }
    if (v == this && inBounds && !ssp.hasDockedTask()) {
        // Start listening for drag events
        setClipViewInStack(false);
        mDownTouchPos.x += ((1f - getScaleX()) * getWidth()) / 2;
        mDownTouchPos.y += ((1f - getScaleY()) * getHeight()) / 2;
        EventBus.getDefault().register(this, RecentsActivity.EVENT_BUS_PRIORITY + 1);
        EventBus.getDefault().send(new DragStartEvent(mTask, this, mDownTouchPos));
        return true;
    }
    return false;
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Rect(android.graphics.Rect) DragStartEvent(com.android.systemui.recents.events.ui.dragndrop.DragStartEvent)

Example 3 with DragStartEvent

use of com.android.systemui.recents.events.ui.dragndrop.DragStartEvent in project platform_frameworks_base by android.

the class TaskView method onLongClick.

/**** View.OnLongClickListener Implementation ****/
@Override
public boolean onLongClick(View v) {
    SystemServicesProxy ssp = Recents.getSystemServices();
    // Since we are clipping the view to the bounds, manually do the hit test
    Rect clipBounds = new Rect(mViewBounds.mClipBounds);
    clipBounds.scale(getScaleX());
    boolean inBounds = clipBounds.contains(mDownTouchPos.x, mDownTouchPos.y);
    if (v == this && inBounds && !ssp.hasDockedTask()) {
        // Start listening for drag events
        setClipViewInStack(false);
        mDownTouchPos.x += ((1f - getScaleX()) * getWidth()) / 2;
        mDownTouchPos.y += ((1f - getScaleY()) * getHeight()) / 2;
        EventBus.getDefault().register(this, RecentsActivity.EVENT_BUS_PRIORITY + 1);
        EventBus.getDefault().send(new DragStartEvent(mTask, this, mDownTouchPos));
        return true;
    }
    return false;
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Rect(android.graphics.Rect) DragStartEvent(com.android.systemui.recents.events.ui.dragndrop.DragStartEvent)

Example 4 with DragStartEvent

use of com.android.systemui.recents.events.ui.dragndrop.DragStartEvent in project android_frameworks_base by DirtyUnicorns.

the class TaskView method onLongClick.

/**** View.OnLongClickListener Implementation ****/
@Override
public boolean onLongClick(View v) {
    SystemServicesProxy ssp = Recents.getSystemServices();
    boolean inBounds = false;
    Rect clipBounds = new Rect(mViewBounds.mClipBounds);
    if (!clipBounds.isEmpty()) {
        // If we are clipping the view to the bounds, manually do the hit test.
        clipBounds.scale(getScaleX());
        inBounds = clipBounds.contains(mDownTouchPos.x, mDownTouchPos.y);
    } else {
        // Otherwise just make sure we're within the view's bounds.
        inBounds = mDownTouchPos.x <= getWidth() && mDownTouchPos.y <= getHeight();
    }
    if (v == this && inBounds && !ssp.hasDockedTask()) {
        // Start listening for drag events
        setClipViewInStack(false);
        mDownTouchPos.x += ((1f - getScaleX()) * getWidth()) / 2;
        mDownTouchPos.y += ((1f - getScaleY()) * getHeight()) / 2;
        EventBus.getDefault().register(this, RecentsActivity.EVENT_BUS_PRIORITY + 1);
        EventBus.getDefault().send(new DragStartEvent(mTask, this, mDownTouchPos));
        return true;
    }
    return false;
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Rect(android.graphics.Rect) DragStartEvent(com.android.systemui.recents.events.ui.dragndrop.DragStartEvent)

Example 5 with DragStartEvent

use of com.android.systemui.recents.events.ui.dragndrop.DragStartEvent in project android_frameworks_base by crdroidandroid.

the class TaskView method onLongClick.

/**** View.OnLongClickListener Implementation ****/
@Override
public boolean onLongClick(View v) {
    SystemServicesProxy ssp = Recents.getSystemServices();
    boolean inBounds = false;
    Rect clipBounds = new Rect(mViewBounds.mClipBounds);
    if (!clipBounds.isEmpty()) {
        // If we are clipping the view to the bounds, manually do the hit test.
        clipBounds.scale(getScaleX());
        inBounds = clipBounds.contains(mDownTouchPos.x, mDownTouchPos.y);
    } else {
        // Otherwise just make sure we're within the view's bounds.
        inBounds = mDownTouchPos.x <= getWidth() && mDownTouchPos.y <= getHeight();
    }
    if (v == this && inBounds && !ssp.hasDockedTask()) {
        // Start listening for drag events
        setClipViewInStack(false);
        mDownTouchPos.x += ((1f - getScaleX()) * getWidth()) / 2;
        mDownTouchPos.y += ((1f - getScaleY()) * getHeight()) / 2;
        EventBus.getDefault().register(this, RecentsActivity.EVENT_BUS_PRIORITY + 1);
        EventBus.getDefault().send(new DragStartEvent(mTask, this, mDownTouchPos));
        return true;
    }
    return false;
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Rect(android.graphics.Rect) DragStartEvent(com.android.systemui.recents.events.ui.dragndrop.DragStartEvent)

Aggregations

Rect (android.graphics.Rect)5 DragStartEvent (com.android.systemui.recents.events.ui.dragndrop.DragStartEvent)5 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)5