Search in sources :

Example 26 with LaunchTaskEvent

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

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 27 with LaunchTaskEvent

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

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 28 with LaunchTaskEvent

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

the class RecentsView method launchFocusedTask.

/** Launches the focused task from the first stack if possible */
public boolean launchFocusedTask(int logEvent) {
    if (mTaskStackView != null) {
        Task task = mTaskStackView.getFocusedTask();
        if (task != null) {
            TaskView taskView = mTaskStackView.getChildViewForTask(task);
            EventBus.getDefault().send(new LaunchTaskEvent(taskView, task, null, INVALID_STACK_ID, false));
            if (logEvent != 0) {
                MetricsLogger.action(getContext(), logEvent, task.key.getComponent().toString());
            }
            return true;
        }
    }
    return false;
}
Also used : Task(com.android.systemui.recents.model.Task) LaunchTaskEvent(com.android.systemui.recents.events.activity.LaunchTaskEvent)

Example 29 with LaunchTaskEvent

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

the class TaskView method screenPinning.

void screenPinning() {
    boolean screenPinningRequested = false;
    mActionButtonView.setTranslationZ(0f);
    screenPinningRequested = true;
    EventBus.getDefault().send(new LaunchTaskEvent(this, mTask, null, INVALID_STACK_ID, screenPinningRequested));
}
Also used : LaunchTaskEvent(com.android.systemui.recents.events.activity.LaunchTaskEvent)

Example 30 with LaunchTaskEvent

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

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 == mPinButton) {
        TaskView tv = Utilities.findParent(this, TaskView.class);
        tv.screenPinning();
    } 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)

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