+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!-- Extends Framelayout -->
-<com.android.systemui.statusbar.DismissView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="@dimen/recents_dismiss_all_button_size"
- android:visibility="gone"
- android:clipChildren="false"
- android:clipToPadding="false">
- <com.android.systemui.statusbar.DismissViewButton
- android:id="@+id/dismiss_text"
- android:layout_width="@dimen/recents_dismiss_all_button_size"
- android:layout_height="@dimen/recents_dismiss_all_button_size"
- android:layout_gravity="end"
- android:alpha="1.0"
- android:background="@drawable/recents_button_bg"
- android:contentDescription="@string/recents_dismiss_all_message"/>
-</com.android.systemui.statusbar.DismissView>
<!-- The duration in seconds to wait before the dismiss buttons are shown. -->
<integer name="recents_task_bar_dismiss_delay_seconds">1000</integer>
- <!-- The min animation duration for animating views that are currently visible. -->
- <integer name="recents_filter_animate_current_views_duration">250</integer>
-
- <!-- The min animation duration for animating views that are newly visible. -->
- <integer name="recents_filter_animate_new_views_duration">250</integer>
-
<!-- The duration of the window transition when coming to Recents from an app.
In order to defer the in-app animations until after the transition is complete,
we also need to use this value as the starting delay when animating the first
<string name="recents_search_bar_label">search</string>
<!-- Recents: Launch error string. [CHAR LIMIT=NONE] -->
<string name="recents_launch_error_message">Could not start <xliff:g id="app" example="Calendar">%s</xliff:g>.</string>
- <!-- Recents: Dismiss all button. [CHAR LIMIT=NONE] -->
- <string name="recents_dismiss_all_message">Dismiss all applications</string>
<!-- Recents: MultiStack add stack split horizontal radio button. [CHAR LIMIT=NONE] -->
<string name="recents_multistack_add_stack_dialog_split_horizontal">Split Horizontal</string>
import com.android.systemui.recents.events.activity.ToggleRecentsEvent;
import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent;
import com.android.systemui.recents.events.component.ScreenPinningRequestEvent;
+import com.android.systemui.recents.events.ui.AllTaskViewsDismissedEvent;
import com.android.systemui.recents.events.ui.DismissTaskViewEvent;
import com.android.systemui.recents.events.ui.ResizeTaskEvent;
import com.android.systemui.recents.events.ui.ShowApplicationInfoEvent;
/**
* The main Recents activity that is started from AlternateRecentsComponent.
*/
-public class RecentsActivity extends Activity implements RecentsView.RecentsViewCallbacks,
- ViewTreeObserver.OnPreDrawListener {
+public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreDrawListener {
private final static String TAG = "RecentsActivity";
private final static boolean DEBUG = false;
DozeTrigger mIterateTrigger = new DozeTrigger(500, new Runnable() {
@Override
public void run() {
- dismissRecentsToFocusedTask(false);
+ dismissRecentsToFocusedTask();
}
});
/**
* Dismisses recents if we are already visible and the intent is to toggle the recents view.
*/
- boolean dismissRecentsToFocusedTask(boolean checkFilteredStackState) {
+ boolean dismissRecentsToFocusedTask() {
SystemServicesProxy ssp = Recents.getSystemServices();
if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) {
- // If we currently have filtered stacks, then unfilter those first
- if (checkFilteredStackState &&
- mRecentsView.unfilterFilteredStacks()) return true;
// If we have a focused Task, launch that Task now
if (mRecentsView.launchFocusedTask()) return true;
}
/**
* Dismisses recents if we are already visible and the intent is to toggle the recents view.
*/
- boolean dismissRecentsToFocusedTaskOrHome(boolean checkFilteredStackState) {
+ boolean dismissRecentsToFocusedTaskOrHome() {
SystemServicesProxy ssp = Recents.getSystemServices();
if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) {
- // If we currently have filtered stacks, then unfilter those first
- if (checkFilteredStackState &&
- mRecentsView.unfilterFilteredStacks()) return true;
// If we have a focused Task, launch that Task now
if (mRecentsView.launchFocusedTask()) return true;
// If none of the other cases apply, then just go Home
// Set the Recents layout
setContentView(R.layout.recents);
mRecentsView = (RecentsView) findViewById(R.id.recents_view);
- mRecentsView.setCallbacks(this);
mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
@Override
public void onBackPressed() {
// Dismiss Recents to the focused Task or Home
- dismissRecentsToFocusedTaskOrHome(true);
+ dismissRecentsToFocusedTaskOrHome();
}
/**** RecentsResizeTaskDialog ****/
return mResizeTaskDebugDialog;
}
- /**** RecentsView.RecentsViewCallbacks Implementation ****/
-
- @Override
- public void onAllTaskViewsDismissed() {
- mFinishLaunchHomeRunnable.run();
- }
-
/**** EventBus events ****/
public final void onBusEvent(ToggleRecentsEvent event) {
- dismissRecentsToFocusedTaskOrHome(true /* checkFilteredStackState */);
+ dismissRecentsToFocusedTaskOrHome();
}
public final void onBusEvent(IterateRecentsEvent event) {
public final void onBusEvent(HideRecentsEvent event) {
if (event.triggeredFromAltTab) {
// If we are hiding from releasing Alt-Tab, dismiss Recents to the focused app
- dismissRecentsToFocusedTaskOrHome(false /* checkFilteredStackState */);
+ dismissRecentsToFocusedTaskOrHome();
} else if (event.triggeredFromHomeKey) {
// Otherwise, dismiss Recents to Home
- dismissRecentsToHome(true /* checkFilteredStackState */);
+ dismissRecentsToHome(true /* animated */);
} else {
// Do nothing
}
ssp.removeTask(event.task.key.id);
}
+ public final void onBusEvent(AllTaskViewsDismissedEvent event) {
+ // Just go straight home (no animation necessary because there are no more task views)
+ dismissRecentsToHome(false /* animated */);
+
+ // Keep track of all-deletions
+ MetricsLogger.count(this, "overview_task_all_dismissed", 1);
+ }
+
public final void onBusEvent(ResizeTaskEvent event) {
getResizeTaskDebugDialog().showResizeTaskDialog(event.task, mRecentsView);
}
--- /dev/null
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.recents.events.ui;
+
+import com.android.systemui.recents.events.EventBus;
+
+/**
+ * This is sent whenever all the task views in a stack have been dismissed.
+ */
+public class AllTaskViewsDismissedEvent extends EventBus.Event {
+ // Simple event
+}
/** Task stack callbacks */
public interface TaskStackCallbacks {
/* Notifies when a task has been added to the stack */
- public void onStackTaskAdded(TaskStack stack, Task t);
+ void onStackTaskAdded(TaskStack stack, Task t);
/* Notifies when a task has been removed from the stack */
- public void onStackTaskRemoved(TaskStack stack, Task removedTask, boolean wasFrontMostTask,
+ void onStackTaskRemoved(TaskStack stack, Task removedTask, boolean wasFrontMostTask,
Task newFrontMostTask);
- /* Notifies when all task has been removed from the stack */
- public void onStackAllTasksRemoved(TaskStack stack, ArrayList<Task> removedTasks);
- /** Notifies when the stack was filtered */
- public void onStackFiltered(TaskStack newStack, ArrayList<Task> curTasks, Task t);
- /** Notifies when the stack was un-filtered */
- public void onStackUnfiltered(TaskStack newStack, ArrayList<Task> curTasks);
}
}
}
- /** Removes all tasks */
- public void removeAllTasks() {
- ArrayList<Task> taskList = new ArrayList<Task>(mTaskList.getTasks());
- int taskCount = taskList.size();
- for (int i = taskCount - 1; i >= 0; i--) {
- Task t = taskList.get(i);
- removeTaskImpl(t);
- }
- if (mCb != null) {
- // Notify that all tasks have been removed
- mCb.onStackAllTasksRemoved(this, taskList);
- }
- }
-
/** Sets a few tasks in one go */
public void setTasks(List<Task> tasks) {
ArrayList<Task> taskList = mTaskList.getTasks();
return false;
}
- /******** Filtering ********/
-
- /** Filters the stack into tasks similar to the one specified */
- public void filterTasks(final Task t) {
- ArrayList<Task> oldStack = new ArrayList<Task>(mTaskList.getTasks());
-
- // Set the task list filter
- boolean filtered = mTaskList.setFilter(new TaskFilter() {
- @Override
- public boolean acceptTask(Task at, int i) {
- return t.key.getComponent().getPackageName().equals(
- at.key.getComponent().getPackageName());
- }
- });
- if (filtered && mCb != null) {
- mCb.onStackFiltered(this, oldStack, t);
- }
- }
-
- /** Unfilters the current stack */
- public void unfilterTasks() {
- ArrayList<Task> oldStack = new ArrayList<Task>(mTaskList.getTasks());
-
- // Unset the filter, then update the virtual scroll
- mTaskList.removeFilter();
- if (mCb != null) {
- mCb.onStackUnfiltered(this, oldStack);
- }
- }
-
- /** Returns whether tasks are currently filtered */
- public boolean hasFilteredTasks() {
- return mTaskList.hasFilter();
- }
-
/******** Grouping ********/
/** Adds a group to the set */
private int mStackViewVisibility = View.VISIBLE;
- /** The RecentsView callbacks */
- public interface RecentsViewCallbacks {
- public void onAllTaskViewsDismissed();
- }
-
LayoutInflater mInflater;
Handler mHandler;
ArrayList<TaskStack> mStacks;
TaskStackView mTaskStackView;
RecentsAppWidgetHostView mSearchBar;
- RecentsViewCallbacks mCb;
RecentsTransitionHelper mTransitionHelper;
RecentsViewTouchHandler mTouchHandler;
mTouchHandler = new RecentsViewTouchHandler(this);
}
- /** Sets the callbacks */
- public void setCallbacks(RecentsViewCallbacks cb) {
- mCb = cb;
- }
-
/** Set/get the bsp root node */
public void setTaskStack(TaskStack stack) {
RecentsConfiguration config = Recents.getConfiguration();
return super.verifyDrawable(who);
}
- /** Unfilters any filtered stacks */
- public boolean unfilterFilteredStacks() {
- if (mStacks != null) {
- // Check if there are any filtered stacks and unfilter them before we back out of Recents
- boolean stacksUnfiltered = false;
- int numStacks = mStacks.size();
- for (int i = 0; i < numStacks; i++) {
- TaskStack stack = mStacks.get(i);
- if (stack.hasFilteredTasks()) {
- stack.unfilterTasks();
- stacksUnfiltered = true;
- }
- }
- return stacksUnfiltered;
- }
- return false;
- }
-
public void disableLayersForOneFrame() {
if (mTaskStackView != null) {
mTaskStackView.disableLayersForOneFrame();
destinationStack);
}
- @Override
- public void onAllTaskViewsDismissed(ArrayList<Task> removedTasks) {
- /* TODO: Not currently enabled
- if (removedTasks != null) {
- int taskCount = removedTasks.size();
- for (int i = 0; i < taskCount; i++) {
- onTaskViewDismissed(removedTasks.get(i));
- }
- }
- */
-
- mCb.onAllTaskViewsDismissed();
-
- // Keep track of all-deletions
- MetricsLogger.count(getContext(), "overview_task_all_dismissed", 1);
- }
-
- @Override
- public void onTaskStackFilterTriggered() {
- // Hide the search bar
- if (mSearchBar != null) {
- int filterDuration = getResources().getInteger(
- R.integer.recents_filter_animate_current_views_duration);
- mSearchBar.animate()
- .alpha(0f)
- .setStartDelay(0)
- .setInterpolator(mFastOutSlowInInterpolator)
- .setDuration(filterDuration)
- .withLayer()
- .start();
- }
- }
-
- @Override
- public void onTaskStackUnfilterTriggered() {
- // Show the search bar
- if (mSearchBar != null) {
- int filterDuration = getResources().getInteger(
- R.integer.recents_filter_animate_new_views_duration);
- mSearchBar.animate()
- .alpha(1f)
- .setStartDelay(0)
- .setInterpolator(mFastOutSlowInInterpolator)
- .setDuration(filterDuration)
- .withLayer()
- .start();
- }
- }
-
/**** EventBus Events ****/
public final void onBusEvent(DragStartEvent event) {
import com.android.systemui.recents.events.activity.IterateRecentsEvent;
import com.android.systemui.recents.events.activity.PackagesChangedEvent;
import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent;
+import com.android.systemui.recents.events.ui.AllTaskViewsDismissedEvent;
import com.android.systemui.recents.events.ui.DismissTaskViewEvent;
import com.android.systemui.recents.events.ui.StackViewScrolledEvent;
import com.android.systemui.recents.events.ui.UserInteractionEvent;
interface TaskStackViewCallbacks {
public void onTaskViewClicked(TaskStackView stackView, TaskView tv, TaskStack stack, Task t,
boolean lockToTask, Rect bounds, int destinationStack);
- public void onAllTaskViewsDismissed(ArrayList<Task> removedTasks);
- public void onTaskStackFilterTriggered();
- public void onTaskStackUnfilterTriggered();
}
TaskStack mStack;
TaskStackLayoutAlgorithm mLayoutAlgorithm;
- TaskStackViewFilterAlgorithm mFilterAlgorithm;
TaskStackViewScroller mStackScroller;
TaskStackViewTouchHandler mTouchHandler;
TaskStackViewCallbacks mCb;
mViewPool = new ViewPool<>(context, this);
mInflater = LayoutInflater.from(context);
mLayoutAlgorithm = new TaskStackLayoutAlgorithm(context, this);
- mFilterAlgorithm = new TaskStackViewFilterAlgorithm(this, mViewPool);
mStackScroller = new TaskStackViewScroller(context, mLayoutAlgorithm);
mStackScroller.setCallbacks(this);
mTouchHandler = new TaskStackViewTouchHandler(context, this, mStackScroller);
}
}
- /** Requests this task stack to start it's dismiss-all animation. */
- public void startDismissAllAnimation(final Runnable postAnimationRunnable) {
- // Clear the focused task
- resetFocusedTask();
- List<TaskView> taskViews = getTaskViews();
- int taskViewCount = taskViews.size();
- int count = 0;
- for (int i = taskViewCount - 1; i >= 0; i--) {
- TaskView tv = taskViews.get(i);
- tv.startDeleteTaskAnimation(i > 0 ? null : postAnimationRunnable, count * 50);
- count++;
- }
- }
-
/** Animates a task view in this stack as it launches. */
public void startLaunchTaskAnimation(TaskView tv, Runnable r, boolean lockToTask) {
Task launchTargetTask = tv.getTask();
}
}
- // If there are no remaining tasks, then either unfilter the current stack, or just close
- // the activity if there are no filtered stacks
+ // If there are no remaining tasks, then just close recents
if (mStack.getTaskCount() == 0) {
- boolean shouldFinishActivity = true;
- if (mStack.hasFilteredTasks()) {
- mStack.unfilterTasks();
- shouldFinishActivity = (mStack.getTaskCount() == 0);
- }
+ boolean shouldFinishActivity = (mStack.getTaskCount() == 0);
if (shouldFinishActivity) {
- mCb.onAllTaskViewsDismissed(null);
+ EventBus.getDefault().send(new AllTaskViewsDismissedEvent());
}
}
}
- @Override
- public void onStackAllTasksRemoved(TaskStack stack, final ArrayList<Task> removedTasks) {
- // Announce for accessibility
- String msg = getContext().getString(R.string.accessibility_recents_all_items_dismissed);
- announceForAccessibility(msg);
-
- startDismissAllAnimation(new Runnable() {
- @Override
- public void run() {
- // Notify that all tasks have been removed
- mCb.onAllTaskViewsDismissed(removedTasks);
- }
- });
- }
-
- @Override
- public void onStackFiltered(TaskStack newStack, final ArrayList<Task> curTasks,
- Task filteredTask) {
- /*
- // Stash the scroll and filtered task for us to restore to when we unfilter
- mStashedScroll = getStackScroll();
-
- // Calculate the current task transforms
- ArrayList<TaskViewTransform> curTaskTransforms =
- getStackTransforms(curTasks, getStackScroll(), null, true);
-
- // Update the task offsets
- mLayoutAlgorithm.updateTaskOffsets(mStack.getTasks());
-
- // Scroll the item to the top of the stack (sans-peek) rect so that we can see it better
- updateLayout(false);
- float overlapHeight = mLayoutAlgorithm.getTaskOverlapHeight();
- setStackScrollRaw((int) (newStack.indexOfTask(filteredTask) * overlapHeight));
- boundScrollRaw();
-
- // Compute the transforms of the items in the new stack after setting the new scroll
- final ArrayList<Task> tasks = mStack.getTasks();
- final ArrayList<TaskViewTransform> taskTransforms =
- getStackTransforms(mStack.getTasks(), getStackScroll(), null, true);
-
- // Animate
- mFilterAlgorithm.startFilteringAnimation(curTasks, curTaskTransforms, tasks, taskTransforms);
-
- // Notify any callbacks
- mCb.onTaskStackFilterTriggered();
- */
- }
-
- @Override
- public void onStackUnfiltered(TaskStack newStack, final ArrayList<Task> curTasks) {
- /*
- // Calculate the current task transforms
- final ArrayList<TaskViewTransform> curTaskTransforms =
- getStackTransforms(curTasks, getStackScroll(), null, true);
-
- // Update the task offsets
- mLayoutAlgorithm.updateTaskOffsets(mStack.getTasks());
-
- // Restore the stashed scroll
- updateLayout(false);
- setStackScrollRaw(mStashedScroll);
- boundScrollRaw();
-
- // Compute the transforms of the items in the new stack after restoring the stashed scroll
- final ArrayList<Task> tasks = mStack.getTasks();
- final ArrayList<TaskViewTransform> taskTransforms =
- getStackTransforms(tasks, getStackScroll(), null, true);
-
- // Animate
- mFilterAlgorithm.startFilteringAnimation(curTasks, curTaskTransforms, tasks, taskTransforms);
-
- // Clear the saved vars
- mStashedScroll = 0;
-
- // Notify any callbacks
- mCb.onTaskStackUnfilterTriggered();
- */
- }
-
/**** ViewPoolConsumer Implementation ****/
@Override
+++ /dev/null
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.recents.views;
-
-import com.android.systemui.R;
-import com.android.systemui.recents.model.Task;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-/* The layout logic for a TaskStackView */
-public class TaskStackViewFilterAlgorithm {
-
- TaskStackView mStackView;
- ViewPool<TaskView, Task> mViewPool;
-
- public TaskStackViewFilterAlgorithm(TaskStackView stackView, ViewPool<TaskView, Task> viewPool) {
- mStackView = stackView;
- mViewPool = viewPool;
- }
-
- /** Orchestrates the animations of the current child views and any new views. */
- void startFilteringAnimation(ArrayList<Task> curTasks,
- ArrayList<TaskViewTransform> curTaskTransforms,
- final ArrayList<Task> tasks,
- final ArrayList<TaskViewTransform> taskTransforms) {
- // Calculate the transforms to animate out all the existing views if they are not in the
- // new visible range (or to their final positions in the stack if they are)
- final ArrayList<TaskView> childrenToRemove = new ArrayList<TaskView>();
- final HashMap<TaskView, TaskViewTransform> childViewTransforms =
- new HashMap<TaskView, TaskViewTransform>();
- int duration = getExitTransformsForFilterAnimation(curTasks, curTaskTransforms, tasks,
- taskTransforms, childViewTransforms, childrenToRemove);
-
- // If all the current views are in the visible range of the new stack, then don't wait for
- // views to animate out and animate all the new views into their place
- final boolean unifyNewViewAnimation = childrenToRemove.isEmpty();
- if (unifyNewViewAnimation) {
- int inDuration = getEnterTransformsForFilterAnimation(tasks, taskTransforms,
- childViewTransforms);
- duration = Math.max(duration, inDuration);
- }
-
- // Animate all the views to their final transforms
- for (final TaskView tv : childViewTransforms.keySet()) {
- TaskViewTransform t = childViewTransforms.get(tv);
- tv.animate().cancel();
- tv.animate()
- .withEndAction(new Runnable() {
- @Override
- public void run() {
- childViewTransforms.remove(tv);
- if (childViewTransforms.isEmpty()) {
- // Return all the removed children to the view pool
- for (TaskView tv : childrenToRemove) {
- mViewPool.returnViewToPool(tv);
- }
-
- if (!unifyNewViewAnimation) {
- // For views that are not already visible, animate them in
- childViewTransforms.clear();
- int duration = getEnterTransformsForFilterAnimation(tasks,
- taskTransforms, childViewTransforms);
- for (final TaskView tv : childViewTransforms.keySet()) {
- TaskViewTransform t = childViewTransforms.get(tv);
- tv.updateViewPropertiesToTaskTransform(t, duration);
- }
- }
- }
- }
- });
- tv.updateViewPropertiesToTaskTransform(t, duration);
- }
- }
-
- /**
- * Creates the animations for all the children views that need to be animated in when we are
- * un/filtering a stack, and returns the duration for these animations.
- */
- int getEnterTransformsForFilterAnimation(ArrayList<Task> tasks,
- ArrayList<TaskViewTransform> taskTransforms,
- HashMap<TaskView, TaskViewTransform> childViewTransformsOut) {
- int offset = 0;
- int movement = 0;
- int taskCount = tasks.size();
- for (int i = taskCount - 1; i >= 0; i--) {
- Task task = tasks.get(i);
- TaskViewTransform toTransform = taskTransforms.get(i);
- if (toTransform.visible) {
- TaskView tv = mStackView.getChildViewForTask(task);
- if (tv == null) {
- // For views that are not already visible, animate them in
- tv = mViewPool.pickUpViewFromPool(task, task);
-
- // Compose a new transform to fade and slide the new task in
- TaskViewTransform fromTransform = new TaskViewTransform(toTransform);
- tv.prepareTaskTransformForFilterTaskHidden(fromTransform);
- tv.updateViewPropertiesToTaskTransform(fromTransform, 0);
-
- toTransform.startDelay = offset * 25;
- childViewTransformsOut.put(tv, toTransform);
-
- // Use the movement of the new views to calculate the duration of the animation
- movement = Math.max(movement,
- Math.abs(toTransform.translationY - fromTransform.translationY));
- offset++;
- }
- }
- }
- return mStackView.getResources().getInteger(
- R.integer.recents_filter_animate_new_views_duration);
- }
-
- /**
- * Creates the animations for all the children views that need to be removed or to move views
- * to their un/filtered position when we are un/filtering a stack, and returns the duration
- * for these animations.
- */
- int getExitTransformsForFilterAnimation(ArrayList<Task> curTasks,
- ArrayList<TaskViewTransform> curTaskTransforms,
- ArrayList<Task> tasks, ArrayList<TaskViewTransform> taskTransforms,
- HashMap<TaskView, TaskViewTransform> childViewTransformsOut,
- ArrayList<TaskView> childrenToRemoveOut) {
- // Animate all of the existing views out of view (if they are not in the visible range in
- // the new stack) or to their final positions in the new stack
- int offset = 0;
- int movement = 0;
- List<TaskView> taskViews = mStackView.getTaskViews();
- int taskViewCount = taskViews.size();
- for (int i = 0; i < taskViewCount; i++) {
- TaskView tv = taskViews.get(i);
- Task task = tv.getTask();
- int taskIndex = tasks.indexOf(task);
- TaskViewTransform toTransform;
-
- // If the view is no longer visible, then we should just animate it out
- boolean willBeInvisible = taskIndex < 0 || !taskTransforms.get(taskIndex).visible;
- if (willBeInvisible) {
- if (taskIndex < 0) {
- toTransform = curTaskTransforms.get(curTasks.indexOf(task));
- } else {
- toTransform = new TaskViewTransform(taskTransforms.get(taskIndex));
- }
- tv.prepareTaskTransformForFilterTaskVisible(toTransform);
- childrenToRemoveOut.add(tv);
- } else {
- toTransform = taskTransforms.get(taskIndex);
- // Use the movement of the visible views to calculate the duration of the animation
- movement = Math.max(movement, Math.abs(toTransform.translationY -
- (int) tv.getTranslationY()));
- }
-
- toTransform.startDelay = offset * 25;
- childViewTransformsOut.put(tv, toTransform);
- offset++;
- }
- return mStackView.getResources().getInteger(
- R.integer.recents_filter_animate_current_views_duration);
- }
-
-}
\ No newline at end of file
ctx.postAnimationTrigger.increment();
}
- /** Animates this task view away when dismissing all tasks. */
- void startDismissAllAnimation() {
- dismissTask();
- }
-
/** Animates this task view as it exits recents */
void startLaunchTaskAnimation(final Runnable postAnimRunnable, boolean isLaunchingTask,
boolean occludesLaunchTarget, boolean lockToTask) {