Search in sources :

Example 6 with DeleteTaskDataEvent

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

the class TaskStackView method onBusEvent.

public final void onBusEvent(final DismissAllTaskViewsEvent event) {
    // Keep track of the tasks which will have their data removed
    ArrayList<Task> tasks = new ArrayList<>(mStack.getStackTasks());
    ArrayList<TaskView> deletedTasks = new ArrayList<>();
    ArrayList<TaskView> taskViews = new ArrayList<>(getTaskViews());
    for (TaskView t : taskViews) {
        if (Recents.sLockedTasks.contains(t.getTask())) {
            deletedTasks.add(t);
        }
    }
    taskViews.removeAll(deletedTasks);
    mAnimationHelper.startDeleteAllTasksAnimation(taskViews, useGridLayout(), event.getAnimationTrigger());
    event.addPostAnimationCallback(new Runnable() {

        @Override
        public void run() {
            // Announce for accessibility
            announceForAccessibility(getContext().getString(R.string.accessibility_recents_all_items_dismissed));
            // Remove all tasks and delete the task data for all tasks
            mStack.removeAllTasks();
            for (int i = tasks.size() - 1; i >= 0; i--) {
                Task t = tasks.get(i);
                if (Recents.sLockedTasks.contains(t))
                    continue;
                EventBus.getDefault().send(new DeleteTaskDataEvent(t));
            }
            MetricsLogger.action(getContext(), MetricsEvent.OVERVIEW_DISMISS_ALL);
        }
    });
}
Also used : Task(com.android.systemui.recents.model.Task) GridTaskView(com.android.systemui.recents.views.grid.GridTaskView) ArrayList(java.util.ArrayList) DeleteTaskDataEvent(com.android.systemui.recents.events.ui.DeleteTaskDataEvent)

Example 7 with DeleteTaskDataEvent

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

the class TaskStackView method onBusEvent.

public final void onBusEvent(final DismissAllTaskViewsEvent event) {
    // Keep track of the tasks which will have their data removed
    ArrayList<Task> tasks = new ArrayList<>(mStack.getStackTasks());
    ArrayList<TaskView> deletedTasks = new ArrayList<>();
    ArrayList<TaskView> taskViews = new ArrayList<>(getTaskViews());
    for (TaskView t : taskViews) {
        if (Recents.sLockedTasks.contains(t.getTask())) {
            deletedTasks.add(t);
        }
    }
    mAnimationHelper.startDeleteAllTasksAnimation(taskViews, useGridLayout(), event.getAnimationTrigger());
    event.addPostAnimationCallback(new Runnable() {

        @Override
        public void run() {
            // Announce for accessibility
            announceForAccessibility(getContext().getString(R.string.accessibility_recents_all_items_dismissed));
            // Remove all tasks and delete the task data for all tasks
            mStack.removeAllTasks();
            for (int i = tasks.size() - 1; i >= 0; i--) {
                Task t = tasks.get(i);
                if (Recents.sLockedTasks.contains(t))
                    continue;
                EventBus.getDefault().send(new DeleteTaskDataEvent(t));
            }
            MetricsLogger.action(getContext(), MetricsEvent.OVERVIEW_DISMISS_ALL);
        }
    });
}
Also used : Task(com.android.systemui.recents.model.Task) GridTaskView(com.android.systemui.recents.views.grid.GridTaskView) ArrayList(java.util.ArrayList) DeleteTaskDataEvent(com.android.systemui.recents.events.ui.DeleteTaskDataEvent)

Example 8 with DeleteTaskDataEvent

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

the class TaskStackView method onBusEvent.

public final void onBusEvent(TaskViewDismissedEvent event) {
    // Announce for accessibility
    announceForAccessibility(getContext().getString(R.string.accessibility_recents_item_dismissed, event.task.title));
    if (useGridLayout() && event.animation != null) {
        event.animation.setListener(new AnimatorListenerAdapter() {

            public void onAnimationEnd(Animator animator) {
                if (mTaskViewFocusFrame != null) {
                    // Resize the grid layout task view focus frame
                    mTaskViewFocusFrame.resize();
                }
            }
        });
    }
    // Remove the task from the stack
    mStack.removeTask(event.task, event.animation, false);
    EventBus.getDefault().send(new DeleteTaskDataEvent(event.task));
    MetricsLogger.action(getContext(), MetricsEvent.OVERVIEW_DISMISS, event.task.key.getComponent().toString());
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) DeleteTaskDataEvent(com.android.systemui.recents.events.ui.DeleteTaskDataEvent)

Example 9 with DeleteTaskDataEvent

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

the class RecentsTvActivity method onResume.

@Override
public void onResume() {
    super.onResume();
    mPipRecentsOverlayManager.onRecentsResumed();
    // Update the recent tasks
    updateRecentsTasks();
    // If this is a new instance from a configuration change, then we have to manually trigger
    // the enter animation state, or if recents was relaunched by AM, without going through
    // the normal mechanisms
    RecentsConfiguration config = Recents.getConfiguration();
    RecentsActivityLaunchState launchState = config.getLaunchState();
    boolean wasLaunchedByAm = !launchState.launchedFromHome && !launchState.launchedFromApp;
    if (wasLaunchedByAm) {
        EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
    }
    // Notify that recents is now visible
    SystemServicesProxy ssp = Recents.getSystemServices();
    EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, true));
    if (mTaskStackHorizontalGridView.getStack().getTaskCount() > 1 && !mLaunchedFromHome) {
        // If there are 2 or more tasks, and we are not launching from home
        // set the selected position to the 2nd task to allow for faster app switching
        mTaskStackHorizontalGridView.setSelectedPosition(1);
    } else {
        mTaskStackHorizontalGridView.setSelectedPosition(0);
    }
    mRecentsView.getViewTreeObserver().addOnPreDrawListener(this);
    View dismissPlaceholder = findViewById(R.id.dismiss_placeholder);
    mTalkBackEnabled = ssp.isTouchExplorationEnabled();
    if (mTalkBackEnabled) {
        dismissPlaceholder.setAccessibilityTraversalBefore(R.id.task_list);
        dismissPlaceholder.setAccessibilityTraversalAfter(R.id.dismiss_placeholder);
        mTaskStackHorizontalGridView.setAccessibilityTraversalAfter(R.id.dismiss_placeholder);
        mTaskStackHorizontalGridView.setAccessibilityTraversalBefore(R.id.pip);
        dismissPlaceholder.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                mTaskStackHorizontalGridView.requestFocus();
                mTaskStackHorizontalGridView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
                Task focusedTask = mTaskStackHorizontalGridView.getFocusedTask();
                if (focusedTask != null) {
                    mTaskStackViewAdapter.removeTask(focusedTask);
                    EventBus.getDefault().send(new DeleteTaskDataEvent(focusedTask));
                }
            }
        });
    }
    // Initialize PIP UI
    if (mPipManager.isPipShown()) {
        if (mTalkBackEnabled) {
            // If talkback is on, use the mPipView to handle focus changes
            // between recents row and PIP controls.
            mPipView.setVisibility(View.VISIBLE);
        } else {
            mPipView.setVisibility(View.GONE);
        }
        // When PIP view has focus, recents overlay view will takes the focus
        // as if it's the part of the Recents UI.
        mPipRecentsOverlayManager.requestFocus(mTaskStackViewAdapter.getItemCount() > 0);
    } else {
        mPipView.setVisibility(View.GONE);
        mPipRecentsOverlayManager.removePipRecentsOverlayView();
    }
}
Also used : EnterRecentsWindowAnimationCompletedEvent(com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent) SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Task(com.android.systemui.recents.model.Task) RecentsActivityLaunchState(com.android.systemui.recents.RecentsActivityLaunchState) RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration) RecentsVisibilityChangedEvent(com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent) DeleteTaskDataEvent(com.android.systemui.recents.events.ui.DeleteTaskDataEvent) RecentsTvView(com.android.systemui.recents.tv.views.RecentsTvView) TaskCardView(com.android.systemui.recents.tv.views.TaskCardView) TaskStackHorizontalGridView(com.android.systemui.recents.tv.views.TaskStackHorizontalGridView) View(android.view.View)

Example 10 with DeleteTaskDataEvent

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

the class TaskStackView method onBusEvent.

public final void onBusEvent(TaskViewDismissedEvent event) {
    // Announce for accessibility
    announceForAccessibility(getContext().getString(R.string.accessibility_recents_item_dismissed, event.task.title));
    if (useGridLayout() && event.animation != null) {
        event.animation.setListener(new AnimatorListenerAdapter() {

            public void onAnimationEnd(Animator animator) {
                if (mTaskViewFocusFrame != null) {
                    // Resize the grid layout task view focus frame
                    mTaskViewFocusFrame.resize();
                }
            }
        });
    }
    // Remove the task from the stack
    mStack.removeTask(event.task, event.animation, false);
    EventBus.getDefault().send(new LockTaskStateChangedEvent(true));
    EventBus.getDefault().send(new DeleteTaskDataEvent(event.task));
    MetricsLogger.action(getContext(), MetricsEvent.OVERVIEW_DISMISS, event.task.key.getComponent().toString());
}
Also used : LockTaskStateChangedEvent(com.android.systemui.recents.events.ui.LockTaskStateChangedEvent) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) DeleteTaskDataEvent(com.android.systemui.recents.events.ui.DeleteTaskDataEvent)

Aggregations

DeleteTaskDataEvent (com.android.systemui.recents.events.ui.DeleteTaskDataEvent)13 Task (com.android.systemui.recents.model.Task)8 View (android.view.View)5 RecentsActivityLaunchState (com.android.systemui.recents.RecentsActivityLaunchState)5 RecentsConfiguration (com.android.systemui.recents.RecentsConfiguration)5 EnterRecentsWindowAnimationCompletedEvent (com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent)5 RecentsVisibilityChangedEvent (com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent)5 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)5 RecentsTvView (com.android.systemui.recents.tv.views.RecentsTvView)5 TaskCardView (com.android.systemui.recents.tv.views.TaskCardView)5 TaskStackHorizontalGridView (com.android.systemui.recents.tv.views.TaskStackHorizontalGridView)5 Animator (android.animation.Animator)4 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)4 ObjectAnimator (android.animation.ObjectAnimator)4 ValueAnimator (android.animation.ValueAnimator)4 GridTaskView (com.android.systemui.recents.views.grid.GridTaskView)3 ArrayList (java.util.ArrayList)3 LockTaskStateChangedEvent (com.android.systemui.recents.events.ui.LockTaskStateChangedEvent)1