Search in sources :

Example 71 with SystemServicesProxy

use of com.android.systemui.recents.misc.SystemServicesProxy in project android_frameworks_base by ResurrectionRemix.

the class TaskStackViewTouchHandler method maybeHideRecentsFromBackgroundTap.

/** Hides recents if the up event at (x, y) is a tap on the background area. */
void maybeHideRecentsFromBackgroundTap(int x, int y) {
    // Ignore the up event if it's too far from its start position. The user might have been
    // trying to scroll or swipe.
    int dx = Math.abs(mDownX - x);
    int dy = Math.abs(mDownY - y);
    if (dx > mScrollTouchSlop || dy > mScrollTouchSlop) {
        return;
    }
    // Shift the tap position toward the center of the task stack and check to see if it would
    // have hit a view. The user might have tried to tap on a task and missed slightly.
    int shiftedX = x;
    if (x > (mSv.getRight() - mSv.getLeft()) / 2) {
        shiftedX -= mWindowTouchSlop;
    } else {
        shiftedX += mWindowTouchSlop;
    }
    if (findViewAtPoint(shiftedX, y) != null) {
        return;
    }
    // Disallow tapping above and below the stack to dismiss recents
    if (x > mSv.mLayoutAlgorithm.mStackRect.left && x < mSv.mLayoutAlgorithm.mStackRect.right) {
        return;
    }
    // If tapping on the freeform workspace background, just launch the first freeform task
    SystemServicesProxy ssp = Recents.getSystemServices();
    if (ssp.hasFreeformWorkspaceSupport()) {
        Rect freeformRect = mSv.mLayoutAlgorithm.mFreeformRect;
        if (freeformRect.top <= y && y <= freeformRect.bottom) {
            if (mSv.launchFreeformTasks()) {
                // TODO: Animate Recents away as we launch the freeform tasks
                return;
            }
        }
    }
    // The user intentionally tapped on the background, which is like a tap on the "desktop".
    // Hide recents and transition to the launcher.
    EventBus.getDefault().send(new HideRecentsEvent(false, true));
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Rect(android.graphics.Rect) HideRecentsEvent(com.android.systemui.recents.events.activity.HideRecentsEvent)

Example 72 with SystemServicesProxy

use of com.android.systemui.recents.misc.SystemServicesProxy 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 73 with SystemServicesProxy

use of com.android.systemui.recents.misc.SystemServicesProxy in project android_frameworks_base by ResurrectionRemix.

the class TaskViewHeader method onFinishInflate.

@Override
protected void onFinishInflate() {
    SystemServicesProxy ssp = Recents.getSystemServices();
    // Initialize the icon and description views
    mIconView = (ImageView) findViewById(R.id.icon);
    mIconView.setOnLongClickListener(this);
    mTitleView = (TextView) findViewById(R.id.title);
    mDismissButton = (ImageView) findViewById(R.id.dismiss_task);
    mLockTaskButton = (ImageView) findViewById(R.id.lock_task);
    if (ssp.hasFreeformWorkspaceSupport()) {
        mMoveTaskButton = (ImageView) findViewById(R.id.move_task);
    }
    onConfigurationChanged();
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy)

Example 74 with SystemServicesProxy

use of com.android.systemui.recents.misc.SystemServicesProxy in project android_frameworks_base by ResurrectionRemix.

the class TaskStackView method onBusEvent.

public final void onBusEvent(DragStartInitializeDropTargetsEvent event) {
    SystemServicesProxy ssp = Recents.getSystemServices();
    if (ssp.hasFreeformWorkspaceSupport()) {
        event.handler.registerDropTargetForCurrentDrag(mStackDropTarget);
        event.handler.registerDropTargetForCurrentDrag(mFreeformWorkspaceDropTarget);
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy)

Example 75 with SystemServicesProxy

use of com.android.systemui.recents.misc.SystemServicesProxy in project android_frameworks_base by ResurrectionRemix.

the class TaskStackView method onDraw.

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    // Draw the freeform workspace background
    SystemServicesProxy ssp = Recents.getSystemServices();
    if (ssp.hasFreeformWorkspaceSupport()) {
        if (mFreeformWorkspaceBackground.getAlpha() > 0) {
            mFreeformWorkspaceBackground.draw(canvas);
        }
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy)

Aggregations

SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)243 Rect (android.graphics.Rect)45 ActivityManager (android.app.ActivityManager)35 ActivityInfo (android.content.pm.ActivityInfo)34 RecentsTaskLoader (com.android.systemui.recents.model.RecentsTaskLoader)30 TaskStack (com.android.systemui.recents.model.TaskStack)30 Task (com.android.systemui.recents.model.Task)25 Drawable (android.graphics.drawable.Drawable)19 Point (android.graphics.Point)16 ActivityOptions (android.app.ActivityOptions)15 ComponentName (android.content.ComponentName)15 RemoteException (android.os.RemoteException)15 MutableBoolean (android.util.MutableBoolean)15 RecentsActivityLaunchState (com.android.systemui.recents.RecentsActivityLaunchState)15 RecentsConfiguration (com.android.systemui.recents.RecentsConfiguration)15 Bitmap (android.graphics.Bitmap)14 ArrayList (java.util.ArrayList)14 BitmapDrawable (android.graphics.drawable.BitmapDrawable)12 ActivityNotFoundException (android.content.ActivityNotFoundException)10 Intent (android.content.Intent)10