Search in sources :

Example 16 with LaunchTaskEvent

use of com.android.systemui.recents.events.activity.LaunchTaskEvent in project android_frameworks_base by AOSPA.

the class RecentsView method launchTask.

/** Launches a given task. */
public boolean launchTask(Task task, Rect taskBounds, int destinationStack) {
    if (mTaskStackView != null) {
        // Iterate the stack views and try and find the given task.
        List<TaskView> taskViews = mTaskStackView.getTaskViews();
        int taskViewCount = taskViews.size();
        for (int j = 0; j < taskViewCount; j++) {
            TaskView tv = taskViews.get(j);
            if (tv.getTask() == task) {
                EventBus.getDefault().send(new LaunchTaskEvent(tv, task, taskBounds, destinationStack, false));
                return true;
            }
        }
    }
    return false;
}
Also used : LaunchTaskEvent(com.android.systemui.recents.events.activity.LaunchTaskEvent)

Example 17 with LaunchTaskEvent

use of com.android.systemui.recents.events.activity.LaunchTaskEvent in project android_frameworks_base by AOSPA.

the class TaskViewHeader method onClick.

@Override
public void onClick(View v) {
    if (v == mIconView) {
        // In accessibility, a single click on the focused app info button will show it
        EventBus.getDefault().send(new ShowApplicationInfoEvent(mTask));
    } else if (v == mDismissButton) {
        TaskView tv = Utilities.findParent(this, TaskView.class);
        if (!Recents.sLockedTasks.contains(tv.getTask())) {
            tv.dismissTask();
            // Keep track of deletions by the dismiss button
            MetricsLogger.histogram(getContext(), "overview_task_dismissed_source", Constants.Metrics.DismissSourceHeaderButton);
        }
    } else if (v == mMoveTaskButton) {
        TaskView tv = Utilities.findParent(this, TaskView.class);
        EventBus.getDefault().send(new LaunchTaskEvent(tv, mTask, null, mMoveTaskTargetStackId, false));
    } else if (v == mAppInfoView) {
        EventBus.getDefault().send(new ShowApplicationInfoEvent(mTask));
    } else if (v == mAppIconView) {
        hideAppOverlay(false);
    } else if (v == mLockTaskButton) {
        if (Recents.sLockedTasks.contains(mTask)) {
            Recents.sLockedTasks.remove(mTask);
        } else {
            Recents.sLockedTasks.add(mTask);
        }
        updateLockTaskDrawable();
    }
}
Also used : LaunchTaskEvent(com.android.systemui.recents.events.activity.LaunchTaskEvent) ShowApplicationInfoEvent(com.android.systemui.recents.events.ui.ShowApplicationInfoEvent)

Example 18 with LaunchTaskEvent

use of com.android.systemui.recents.events.activity.LaunchTaskEvent in project android_frameworks_base by crdroidandroid.

the class TaskStackView method launchTask.

private void launchTask(Task task) {
    // Stop all animations
    cancelAllTaskViewAnimations();
    float curScroll = mStackScroller.getStackScroll();
    float targetScroll = mLayoutAlgorithm.getStackScrollForTaskAtInitialOffset(task);
    float absScrollDiff = Math.abs(targetScroll - curScroll);
    if (getChildViewForTask(task) == null || absScrollDiff > 0.35f) {
        int duration = (int) (LAUNCH_NEXT_SCROLL_BASE_DURATION + absScrollDiff * LAUNCH_NEXT_SCROLL_INCR_DURATION);
        mStackScroller.animateScroll(targetScroll, duration, new Runnable() {

            @Override
            public void run() {
                EventBus.getDefault().send(new LaunchTaskEvent(getChildViewForTask(task), task, null, INVALID_STACK_ID, false));
            }
        });
    } else {
        EventBus.getDefault().send(new LaunchTaskEvent(getChildViewForTask(task), task, null, INVALID_STACK_ID, false));
    }
}
Also used : LaunchTaskEvent(com.android.systemui.recents.events.activity.LaunchTaskEvent)

Example 19 with LaunchTaskEvent

use of com.android.systemui.recents.events.activity.LaunchTaskEvent in project android_frameworks_base by crdroidandroid.

the class TaskView method onClick.

/**** View.OnClickListener Implementation ****/
@Override
public void onClick(final View v) {
    if (mIsDisabledInSafeMode) {
        Context context = getContext();
        String msg = context.getString(R.string.recents_launch_disabled_message, mTask.title);
        if (mDisabledAppToast != null) {
            mDisabledAppToast.cancel();
        }
        mDisabledAppToast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
        mDisabledAppToast.show();
        return;
    }
    boolean screenPinningRequested = false;
    if (v == mActionButtonView) {
        // Reset the translation of the action button before we animate it out
        mActionButtonView.setTranslationZ(0f);
        screenPinningRequested = true;
    }
    EventBus.getDefault().send(new LaunchTaskEvent(this, mTask, null, INVALID_STACK_ID, screenPinningRequested));
    MetricsLogger.action(v.getContext(), MetricsEvent.ACTION_OVERVIEW_SELECT, mTask.key.getComponent().toString());
}
Also used : Context(android.content.Context) LaunchTaskEvent(com.android.systemui.recents.events.activity.LaunchTaskEvent)

Example 20 with LaunchTaskEvent

use of com.android.systemui.recents.events.activity.LaunchTaskEvent in project platform_frameworks_base by android.

the class RecentsView method launchTask.

/** Launches a given task. */
public boolean launchTask(Task task, Rect taskBounds, int destinationStack) {
    if (mTaskStackView != null) {
        // Iterate the stack views and try and find the given task.
        List<TaskView> taskViews = mTaskStackView.getTaskViews();
        int taskViewCount = taskViews.size();
        for (int j = 0; j < taskViewCount; j++) {
            TaskView tv = taskViews.get(j);
            if (tv.getTask() == task) {
                EventBus.getDefault().send(new LaunchTaskEvent(tv, task, taskBounds, destinationStack, false));
                return true;
            }
        }
    }
    return false;
}
Also used : LaunchTaskEvent(com.android.systemui.recents.events.activity.LaunchTaskEvent)

Aggregations

LaunchTaskEvent (com.android.systemui.recents.events.activity.LaunchTaskEvent)32 Task (com.android.systemui.recents.model.Task)11 Context (android.content.Context)5 ShowApplicationInfoEvent (com.android.systemui.recents.events.ui.ShowApplicationInfoEvent)5 Rect (android.graphics.Rect)1 HideRecentsEvent (com.android.systemui.recents.events.activity.HideRecentsEvent)1 LockTaskStateChangedEvent (com.android.systemui.recents.events.ui.LockTaskStateChangedEvent)1 TaskStack (com.android.systemui.recents.model.TaskStack)1