blob: a1ba49338c369c863e1417bf254a2ba23c875c8a [file] [log] [blame]
Winson Chung303e1ff2014-03-07 15:06:19 -08001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.systemui.recents.views;
18
Winson231bc9c2016-02-09 12:31:00 -080019import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
20
Winsonf24f2162016-01-05 12:11:55 -080021import android.animation.Animator;
Winson49df4202016-01-25 17:33:34 -080022import android.animation.ObjectAnimator;
Jorim Jaggi192086e2016-03-11 17:17:03 +010023import android.app.ActivityOptions.OnAnimationStartedListener;
Winson Chung303e1ff2014-03-07 15:06:19 -080024import android.content.Context;
Winson Chung303e1ff2014-03-07 15:06:19 -080025import android.graphics.Canvas;
Winson49df4202016-01-25 17:33:34 -080026import android.graphics.Color;
27import android.graphics.Outline;
Winson Chung303e1ff2014-03-07 15:06:19 -080028import android.graphics.Rect;
Winson49df4202016-01-25 17:33:34 -080029import android.graphics.drawable.ColorDrawable;
Winson4165d3362015-10-10 14:40:35 -070030import android.graphics.drawable.Drawable;
Winson882072b2015-10-12 11:26:33 -070031import android.util.ArraySet;
Winson Chung8e548f72014-06-24 14:40:53 -070032import android.util.AttributeSet;
Jorim Jaggic69bd222016-03-15 14:38:37 +010033import android.view.AppTransitionAnimationSpec;
34import android.view.IAppTransitionAnimationSpecsFuture;
Winson Chungecd9b302014-04-16 17:07:18 -070035import android.view.LayoutInflater;
Winsonbe7607a2015-10-01 17:24:51 -070036import android.view.MotionEvent;
Winsonc29ff002015-11-20 16:00:45 -080037import android.view.View;
Winson231bc9c2016-02-09 12:31:00 -080038import android.view.ViewDebug;
Winson49df4202016-01-25 17:33:34 -080039import android.view.ViewOutlineProvider;
Jorim Jaggi870ab5a2015-12-02 18:37:54 -080040import android.view.ViewPropertyAnimator;
Winson Chung653f70c22014-05-19 14:49:42 -070041import android.view.WindowInsets;
Winson Chung303e1ff2014-03-07 15:06:19 -080042import android.widget.FrameLayout;
Winson Chungde750de2015-12-11 10:26:06 -050043import android.widget.TextView;
Chris Wrenf6e9228b2016-01-26 18:04:35 -050044
Winsondc8de842016-01-06 15:21:41 -080045import com.android.internal.logging.MetricsLogger;
Chris Wrenf6e9228b2016-01-26 18:04:35 -050046import com.android.internal.logging.MetricsProto.MetricsEvent;
Winsonc0d70582016-01-29 10:24:39 -080047import com.android.systemui.Interpolators;
Winson Chungd16c5652015-01-26 16:11:07 -080048import com.android.systemui.R;
Winsone7f138c2015-10-22 16:15:21 -070049import com.android.systemui.recents.Recents;
Winsonbe7607a2015-10-01 17:24:51 -070050import com.android.systemui.recents.RecentsActivity;
Winsonb1e71d02015-11-23 12:40:23 -080051import com.android.systemui.recents.RecentsActivityLaunchState;
Winson Chung303e1ff2014-03-07 15:06:19 -080052import com.android.systemui.recents.RecentsConfiguration;
Winsonc29ff002015-11-20 16:00:45 -080053import com.android.systemui.recents.RecentsDebugFlags;
Winson2536c7e2015-10-01 15:49:31 -070054import com.android.systemui.recents.events.EventBus;
Winson412e1802015-10-20 16:57:57 -070055import com.android.systemui.recents.events.activity.DismissRecentsToHomeAnimationStarted;
Jorim Jaggi192086e2016-03-11 17:17:03 +010056import com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent;
Winson49df4202016-01-25 17:33:34 -080057import com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent;
Winson8f6ee482016-03-18 17:51:48 -070058import com.android.systemui.recents.events.activity.HideStackActionButtonEvent;
Winson Chung48f2cda2015-12-11 13:20:12 -050059import com.android.systemui.recents.events.activity.LaunchTaskEvent;
Winson8f6ee482016-03-18 17:51:48 -070060import com.android.systemui.recents.events.activity.ShowStackActionButtonEvent;
Jorim Jaggidd98d412015-11-18 15:57:38 -080061import com.android.systemui.recents.events.ui.DraggingInRecentsEndedEvent;
62import com.android.systemui.recents.events.ui.DraggingInRecentsEvent;
Winson49df4202016-01-25 17:33:34 -080063import com.android.systemui.recents.events.ui.ResetBackgroundScrimEvent;
64import com.android.systemui.recents.events.ui.UpdateBackgroundScrimEvent;
Winsoneca4ab62015-11-04 10:50:28 -080065import com.android.systemui.recents.events.ui.dragndrop.DragDropTargetChangedEvent;
Winsonbe7607a2015-10-01 17:24:51 -070066import com.android.systemui.recents.events.ui.dragndrop.DragEndEvent;
67import com.android.systemui.recents.events.ui.dragndrop.DragStartEvent;
Winson Chung9a742902015-12-11 10:25:40 -050068import com.android.systemui.recents.misc.ReferenceCountedTrigger;
Winson Chung1f24c7e2014-07-11 17:06:48 -070069import com.android.systemui.recents.misc.SystemServicesProxy;
Winsonc5fd3502016-01-18 15:18:37 -080070import com.android.systemui.recents.misc.Utilities;
Winson Chung303e1ff2014-03-07 15:06:19 -080071import com.android.systemui.recents.model.Task;
72import com.android.systemui.recents.model.TaskStack;
Jorim Jaggic69bd222016-03-15 14:38:37 +010073import com.android.systemui.recents.views.RecentsTransitionHelper.AnimationSpecComposer;
Jorim Jaggi870ab5a2015-12-02 18:37:54 -080074import com.android.systemui.stackdivider.WindowManagerProxy;
75import com.android.systemui.statusbar.FlingAnimationUtils;
Winson Chung303e1ff2014-03-07 15:06:19 -080076
77import java.util.ArrayList;
Winson Chung6ac8bd62015-01-07 16:38:35 -080078import java.util.List;
Winson Chung303e1ff2014-03-07 15:06:19 -080079
Winson Chung303e1ff2014-03-07 15:06:19 -080080/**
81 * This view is the the top level layout that contains TaskStacks (which are laid out according
82 * to their SpaceNode bounds.
83 */
Winson Chung48f2cda2015-12-11 13:20:12 -050084public class RecentsView extends FrameLayout {
Winson Chung47c4c692014-03-17 10:17:11 -070085
Winson3e874742016-01-07 10:08:17 -080086 private static final int DOCK_AREA_OVERLAY_TRANSITION_DURATION = 135;
Winson49df4202016-01-25 17:33:34 -080087 private static final int DEFAULT_UPDATE_SCRIM_DURATION = 200;
88 private static final float DEFAULT_SCRIM_ALPHA = 0.33f;
Jorim Jaggi6e18e002015-06-02 17:07:39 -070089
Winson Chung9a742902015-12-11 10:25:40 -050090 private TaskStack mStack;
91 private TaskStackView mTaskStackView;
Winson8f6ee482016-03-18 17:51:48 -070092 private TextView mStackActionButton;
Winson196e8612016-03-15 15:20:17 -070093 private TextView mEmptyView;
Winson49df4202016-01-25 17:33:34 -080094
Winson Chung9a742902015-12-11 10:25:40 -050095 private boolean mAwaitingFirstLayout = true;
96 private boolean mLastTaskLaunchedWasFreeform;
Winson231bc9c2016-02-09 12:31:00 -080097
98 @ViewDebug.ExportedProperty(category="recents")
Winson Chung9a742902015-12-11 10:25:40 -050099 private Rect mSystemInsets = new Rect();
Winson3e874742016-01-07 10:08:17 -0800100 private int mDividerSize;
Winsonbe7607a2015-10-01 17:24:51 -0700101
Winson49df4202016-01-25 17:33:34 -0800102 private ColorDrawable mBackgroundScrim = new ColorDrawable(Color.BLACK);
103 private Animator mBackgroundScrimAnimator;
104
Winson Chung9a742902015-12-11 10:25:40 -0500105 private RecentsTransitionHelper mTransitionHelper;
Winson231bc9c2016-02-09 12:31:00 -0800106 @ViewDebug.ExportedProperty(deepExport=true, prefix="touch_")
Winson Chung9a742902015-12-11 10:25:40 -0500107 private RecentsViewTouchHandler mTouchHandler;
Winson Chung9a742902015-12-11 10:25:40 -0500108 private final FlingAnimationUtils mFlingAnimationUtils;
Jorim Jaggi870ab5a2015-12-02 18:37:54 -0800109
Winson Chung303e1ff2014-03-07 15:06:19 -0800110 public RecentsView(Context context) {
Jorim Jaggi870ab5a2015-12-02 18:37:54 -0800111 this(context, null);
Winson Chung8e548f72014-06-24 14:40:53 -0700112 }
113
114 public RecentsView(Context context, AttributeSet attrs) {
115 this(context, attrs, 0);
116 }
117
118 public RecentsView(Context context, AttributeSet attrs, int defStyleAttr) {
119 this(context, attrs, defStyleAttr, 0);
120 }
121
122 public RecentsView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
123 super(context, attrs, defStyleAttr, defStyleRes);
Winsonbe7607a2015-10-01 17:24:51 -0700124 setWillNotDraw(false);
Winson3e874742016-01-07 10:08:17 -0800125
126 SystemServicesProxy ssp = Recents.getSystemServices();
Winsona1ededd2016-03-25 12:23:12 -0700127 mTransitionHelper = new RecentsTransitionHelper(getContext());
Winson3e874742016-01-07 10:08:17 -0800128 mDividerSize = ssp.getDockedDividerSize(context);
Winsonbe7607a2015-10-01 17:24:51 -0700129 mTouchHandler = new RecentsViewTouchHandler(this);
Jorim Jaggi870ab5a2015-12-02 18:37:54 -0800130 mFlingAnimationUtils = new FlingAnimationUtils(context, 0.3f);
Winsonc29ff002015-11-20 16:00:45 -0800131
132 LayoutInflater inflater = LayoutInflater.from(context);
Winson8f6ee482016-03-18 17:51:48 -0700133 if (RecentsDebugFlags.Static.EnableStackActionButton) {
Winsona1ededd2016-03-25 12:23:12 -0700134 float cornerRadius = context.getResources().getDimensionPixelSize(
135 R.dimen.recents_task_view_rounded_corners_radius);
136 mStackActionButton = (TextView) inflater.inflate(R.layout.recents_stack_action_button,
137 this, false);
Winson8f6ee482016-03-18 17:51:48 -0700138 mStackActionButton.setOnClickListener(new View.OnClickListener() {
Winson91b225d2016-02-16 15:18:07 -0800139 @Override
140 public void onClick(View v) {
Winson8f6ee482016-03-18 17:51:48 -0700141 // TODO: To be implemented
Winson91b225d2016-02-16 15:18:07 -0800142 }
143 });
Winson8f6ee482016-03-18 17:51:48 -0700144 addView(mStackActionButton);
145 mStackActionButton.setClipToOutline(true);
146 mStackActionButton.setOutlineProvider(new ViewOutlineProvider() {
Winson91b225d2016-02-16 15:18:07 -0800147 @Override
148 public void getOutline(View view, Outline outline) {
149 outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), cornerRadius);
150 }
151 });
152 }
Winson196e8612016-03-15 15:20:17 -0700153 mEmptyView = (TextView) inflater.inflate(R.layout.recents_empty, this, false);
Winson Chung9a742902015-12-11 10:25:40 -0500154 addView(mEmptyView);
Winson49df4202016-01-25 17:33:34 -0800155
156 setBackground(mBackgroundScrim);
Winson Chungd16c5652015-01-26 16:11:07 -0800157 }
158
Winsona1ededd2016-03-25 12:23:12 -0700159 /**
160 * Called from RecentsActivity when it is relaunched.
161 */
162 public void onReload(boolean isResumingFromVisible, boolean isTaskStackEmpty) {
Winson53ec42c2015-10-28 15:55:35 -0700163 RecentsConfiguration config = Recents.getConfiguration();
Winson Chung9a742902015-12-11 10:25:40 -0500164 RecentsActivityLaunchState launchState = config.getLaunchState();
Winson88737542016-02-17 13:27:33 -0800165
Winsona1ededd2016-03-25 12:23:12 -0700166 if (mTaskStackView == null) {
Winson88737542016-02-17 13:27:33 -0800167 isResumingFromVisible = false;
Winson88737542016-02-17 13:27:33 -0800168 mTaskStackView = new TaskStackView(getContext());
Winson59924fe2016-03-17 14:13:18 -0700169 mTaskStackView.setSystemInsets(mSystemInsets);
Winson147ecaf2015-09-16 16:49:55 -0700170 addView(mTaskStackView);
Winson Chung303e1ff2014-03-07 15:06:19 -0800171 }
Winson Chung9a742902015-12-11 10:25:40 -0500172
Winson88737542016-02-17 13:27:33 -0800173 // Reset the state
174 mAwaitingFirstLayout = !isResumingFromVisible;
175 mLastTaskLaunchedWasFreeform = false;
176
177 // Update the stack
Winsona1ededd2016-03-25 12:23:12 -0700178 mTaskStackView.onReload(isResumingFromVisible);
Winson88737542016-02-17 13:27:33 -0800179
180 if (isResumingFromVisible) {
181 // If we are already visible, then restore the background scrim
182 animateBackgroundScrim(DEFAULT_SCRIM_ALPHA, DEFAULT_UPDATE_SCRIM_DURATION);
Winson49df4202016-01-25 17:33:34 -0800183 } else {
Winson88737542016-02-17 13:27:33 -0800184 // If we are already occluded by the app, then set the final background scrim alpha now.
185 // Otherwise, defer until the enter animation completes to animate the scrim alpha with
186 // the tasks for the home animation.
187 if (launchState.launchedWhileDocking || launchState.launchedFromApp
Winsona1ededd2016-03-25 12:23:12 -0700188 || isTaskStackEmpty) {
Winson88737542016-02-17 13:27:33 -0800189 mBackgroundScrim.setAlpha((int) (DEFAULT_SCRIM_ALPHA * 255));
190 } else {
191 mBackgroundScrim.setAlpha(0);
192 }
Winson49df4202016-01-25 17:33:34 -0800193 }
Winsona1ededd2016-03-25 12:23:12 -0700194 }
195
196 /**
197 * Called from RecentsActivity when the task stack is updated.
198 */
199 public void updateStack(TaskStack stack) {
200 mStack = stack;
201 mTaskStackView.setTasks(stack, true /* allowNotifyStackChanges */);
Winson49df4202016-01-25 17:33:34 -0800202
Winson Chung9a742902015-12-11 10:25:40 -0500203 // Update the top level view's visibilities
Winson4b057c62016-01-12 15:01:52 -0800204 if (stack.getTaskCount() > 0) {
Winson Chung9a742902015-12-11 10:25:40 -0500205 hideEmptyView();
Winsonc29ff002015-11-20 16:00:45 -0800206 } else {
Winson196e8612016-03-15 15:20:17 -0700207 showEmptyView(R.string.recents_empty_message);
Winsonc29ff002015-11-20 16:00:45 -0800208 }
Winson Chung19fc1172014-07-31 18:40:03 -0700209 }
210
Winsonb1e71d02015-11-23 12:40:23 -0800211 /**
Winsona1ededd2016-03-25 12:23:12 -0700212 * Returns the current TaskStack.
213 */
214 public TaskStack getStack() {
215 return mStack;
216 }
217
218 /**
Winsonb1e71d02015-11-23 12:40:23 -0800219 * Returns whether the last task launched was in the freeform stack or not.
220 */
221 public boolean isLastTaskLaunchedFreeform() {
222 return mLastTaskLaunchedWasFreeform;
223 }
224
Winson Chung1e8d71b2014-05-16 17:05:22 -0700225 /** Launches the focused task from the first stack if possible */
Winson42329522016-02-05 10:39:46 -0800226 public boolean launchFocusedTask(int logEvent) {
Winson147ecaf2015-09-16 16:49:55 -0700227 if (mTaskStackView != null) {
Winson142af422015-11-09 10:39:57 -0800228 Task task = mTaskStackView.getFocusedTask();
229 if (task != null) {
230 TaskView taskView = mTaskStackView.getChildViewForTask(task);
Winson Chung48f2cda2015-12-11 13:20:12 -0500231 EventBus.getDefault().send(new LaunchTaskEvent(taskView, task, null,
232 INVALID_STACK_ID, false));
Winson42329522016-02-05 10:39:46 -0800233
234 if (logEvent != 0) {
235 MetricsLogger.action(getContext(), logEvent,
236 task.key.getComponent().toString());
237 }
Winson142af422015-11-09 10:39:57 -0800238 return true;
Winson Chung1e8d71b2014-05-16 17:05:22 -0700239 }
240 }
Winson Chung1e8d71b2014-05-16 17:05:22 -0700241 return false;
242 }
243
Winsona0731a12015-12-02 15:10:14 -0800244 /** Launches the task that recents was launched from if possible */
245 public boolean launchPreviousTask() {
246 if (mTaskStackView != null) {
247 TaskStack stack = mTaskStackView.getStack();
248 Task task = stack.getLaunchTarget();
249 if (task != null) {
250 TaskView taskView = mTaskStackView.getChildViewForTask(task);
Winson Chung48f2cda2015-12-11 13:20:12 -0500251 EventBus.getDefault().send(new LaunchTaskEvent(taskView, task, null,
252 INVALID_STACK_ID, false));
Winsona0731a12015-12-02 15:10:14 -0800253 return true;
254 }
255 }
256 return false;
257 }
258
Skuhne8aa7d162015-03-20 13:40:53 -0700259 /** Launches a given task. */
Filip Gruszczynskif48b5852015-10-13 10:28:22 -0700260 public boolean launchTask(Task task, Rect taskBounds, int destinationStack) {
Winson147ecaf2015-09-16 16:49:55 -0700261 if (mTaskStackView != null) {
Skuhne8aa7d162015-03-20 13:40:53 -0700262 // Iterate the stack views and try and find the given task.
Winson147ecaf2015-09-16 16:49:55 -0700263 List<TaskView> taskViews = mTaskStackView.getTaskViews();
Skuhne8aa7d162015-03-20 13:40:53 -0700264 int taskViewCount = taskViews.size();
265 for (int j = 0; j < taskViewCount; j++) {
266 TaskView tv = taskViews.get(j);
267 if (tv.getTask() == task) {
Winson Chung48f2cda2015-12-11 13:20:12 -0500268 EventBus.getDefault().send(new LaunchTaskEvent(tv, task, taskBounds,
269 destinationStack, false));
Skuhne8aa7d162015-03-20 13:40:53 -0700270 return true;
271 }
272 }
273 }
274 return false;
275 }
276
Winson Chung9a742902015-12-11 10:25:40 -0500277 /**
278 * Hides the task stack and shows the empty view.
279 */
Winson196e8612016-03-15 15:20:17 -0700280 public void showEmptyView(int msgResId) {
Winson Chung9a742902015-12-11 10:25:40 -0500281 mTaskStackView.setVisibility(View.INVISIBLE);
Winson196e8612016-03-15 15:20:17 -0700282 mEmptyView.setText(msgResId);
Winson Chung9a742902015-12-11 10:25:40 -0500283 mEmptyView.setVisibility(View.VISIBLE);
284 mEmptyView.bringToFront();
Winson8f6ee482016-03-18 17:51:48 -0700285 if (RecentsDebugFlags.Static.EnableStackActionButton) {
286 mStackActionButton.bringToFront();
Winson91b225d2016-02-16 15:18:07 -0800287 }
Winson Chung9a742902015-12-11 10:25:40 -0500288 }
289
290 /**
291 * Shows the task stack and hides the empty view.
292 */
293 public void hideEmptyView() {
294 mEmptyView.setVisibility(View.INVISIBLE);
295 mTaskStackView.setVisibility(View.VISIBLE);
Winson Chung9a742902015-12-11 10:25:40 -0500296 mTaskStackView.bringToFront();
Winson8f6ee482016-03-18 17:51:48 -0700297 if (RecentsDebugFlags.Static.EnableStackActionButton) {
298 mStackActionButton.bringToFront();
Winson91b225d2016-02-16 15:18:07 -0800299 }
Winson Chung772b6b12014-07-03 15:54:02 -0700300 }
301
Winsonbe7607a2015-10-01 17:24:51 -0700302 @Override
303 protected void onAttachedToWindow() {
304 EventBus.getDefault().register(this, RecentsActivity.EVENT_BUS_PRIORITY + 1);
Winsonc8a4cdc2016-01-19 11:30:51 -0800305 EventBus.getDefault().register(mTouchHandler, RecentsActivity.EVENT_BUS_PRIORITY + 2);
Winsonbe7607a2015-10-01 17:24:51 -0700306 super.onAttachedToWindow();
307 }
308
309 @Override
310 protected void onDetachedFromWindow() {
311 super.onDetachedFromWindow();
312 EventBus.getDefault().unregister(this);
313 EventBus.getDefault().unregister(mTouchHandler);
314 }
315
Winson Chungf7bca432014-04-30 17:11:13 -0700316 /**
317 * This is called with the full size of the window since we are handling our own insets.
318 */
Winson Chung303e1ff2014-03-07 15:06:19 -0800319 @Override
320 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
321 int width = MeasureSpec.getSize(widthMeasureSpec);
322 int height = MeasureSpec.getSize(heightMeasureSpec);
Winson Chungbd912972014-03-18 14:36:35 -0700323
Winson59924fe2016-03-17 14:13:18 -0700324 if (mTaskStackView.getVisibility() != GONE) {
Winson147ecaf2015-09-16 16:49:55 -0700325 mTaskStackView.measure(widthMeasureSpec, heightMeasureSpec);
Winson Chung303e1ff2014-03-07 15:06:19 -0800326 }
327
Winson49df4202016-01-25 17:33:34 -0800328 // Measure the empty view to the full size of the screen
329 if (mEmptyView.getVisibility() != GONE) {
Winson196e8612016-03-15 15:20:17 -0700330 measureChild(mEmptyView, MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST),
331 MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST));
Winson49df4202016-01-25 17:33:34 -0800332 }
Winson Chung9a742902015-12-11 10:25:40 -0500333
Winson8f6ee482016-03-18 17:51:48 -0700334 if (RecentsDebugFlags.Static.EnableStackActionButton) {
335 // Measure the stack action button within the constraints of the space above the stack
336 Rect actionButtonRect = mTaskStackView.mLayoutAlgorithm.mStackActionButtonRect;
337 measureChild(mStackActionButton,
338 MeasureSpec.makeMeasureSpec(actionButtonRect.width(), MeasureSpec.AT_MOST),
339 MeasureSpec.makeMeasureSpec(actionButtonRect.height(), MeasureSpec.AT_MOST));
Winson214f0f02016-01-26 13:37:37 -0800340 }
Winson Chung9a742902015-12-11 10:25:40 -0500341
Winson Chung303e1ff2014-03-07 15:06:19 -0800342 setMeasuredDimension(width, height);
343 }
344
Winson Chungf7bca432014-04-30 17:11:13 -0700345 /**
346 * This is called with the full size of the window since we are handling our own insets.
347 */
Winson Chung303e1ff2014-03-07 15:06:19 -0800348 @Override
349 protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
Winson59924fe2016-03-17 14:13:18 -0700350 if (mTaskStackView.getVisibility() != GONE) {
Winson147ecaf2015-09-16 16:49:55 -0700351 mTaskStackView.layout(left, top, left + getMeasuredWidth(), top + getMeasuredHeight());
Winson Chung303e1ff2014-03-07 15:06:19 -0800352 }
Winsonbe7607a2015-10-01 17:24:51 -0700353
Winson Chung9a742902015-12-11 10:25:40 -0500354 // Layout the empty view
Winson49df4202016-01-25 17:33:34 -0800355 if (mEmptyView.getVisibility() != GONE) {
Winson196e8612016-03-15 15:20:17 -0700356 int leftRightInsets = mSystemInsets.left + mSystemInsets.right;
357 int topBottomInsets = mSystemInsets.top + mSystemInsets.bottom;
358 int childWidth = mEmptyView.getMeasuredWidth();
359 int childHeight = mEmptyView.getMeasuredHeight();
360 int childLeft = left + Math.max(0, (right - left - leftRightInsets - childWidth)) / 2;
361 int childTop = top + Math.max(0, (bottom - top - topBottomInsets - childHeight)) / 2;
362 mEmptyView.layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight);
Winson49df4202016-01-25 17:33:34 -0800363 }
Winson Chung9a742902015-12-11 10:25:40 -0500364
Winson8f6ee482016-03-18 17:51:48 -0700365 if (RecentsDebugFlags.Static.EnableStackActionButton) {
366 // Layout the stack action button such that its drawable is start-aligned with the
367 // stack, vertically centered in the available space above the stack
368 Rect actionButtonRect = mTaskStackView.mLayoutAlgorithm.mStackActionButtonRect;
369 int buttonLeft = isLayoutRtl()
370 ? actionButtonRect.right + mStackActionButton.getPaddingStart()
371 - mStackActionButton.getMeasuredWidth()
372 : actionButtonRect.left - mStackActionButton.getPaddingStart();
373 int buttonTop = actionButtonRect.top +
374 (actionButtonRect.height() - mStackActionButton.getMeasuredHeight()) / 2;
375 mStackActionButton.layout(buttonLeft, buttonTop,
376 buttonLeft + mStackActionButton.getMeasuredWidth(),
377 buttonTop + mStackActionButton.getMeasuredHeight());
Winson214f0f02016-01-26 13:37:37 -0800378 }
379
Winsonb1e71d02015-11-23 12:40:23 -0800380 if (mAwaitingFirstLayout) {
381 mAwaitingFirstLayout = false;
382
383 // If launched via dragging from the nav bar, then we should translate the whole view
384 // down offscreen
385 RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
386 if (launchState.launchedViaDragGesture) {
387 setTranslationY(getMeasuredHeight());
Jorim Jaggi0ca88262015-12-07 17:15:16 -0800388 } else {
389 setTranslationY(0f);
Winsonb1e71d02015-11-23 12:40:23 -0800390 }
391 }
Winson Chung303e1ff2014-03-07 15:06:19 -0800392 }
393
Winson Chung8eaeb7d2014-06-25 15:10:59 -0700394 @Override
Winson Chung8eaeb7d2014-06-25 15:10:59 -0700395 public WindowInsets onApplyWindowInsets(WindowInsets insets) {
Winson35f30502015-09-28 11:24:36 -0700396 mSystemInsets.set(insets.getSystemWindowInsets());
Winson59924fe2016-03-17 14:13:18 -0700397 mTaskStackView.setSystemInsets(mSystemInsets);
Winson Chung8eaeb7d2014-06-25 15:10:59 -0700398 requestLayout();
Winsonc29ff002015-11-20 16:00:45 -0800399 return insets;
Winson Chung8eaeb7d2014-06-25 15:10:59 -0700400 }
401
Winsonbe7607a2015-10-01 17:24:51 -0700402 @Override
403 public boolean onInterceptTouchEvent(MotionEvent ev) {
404 return mTouchHandler.onInterceptTouchEvent(ev);
405 }
406
407 @Override
408 public boolean onTouchEvent(MotionEvent ev) {
409 return mTouchHandler.onTouchEvent(ev);
410 }
411
412 @Override
Winsonbe8e6962016-02-01 14:27:52 -0800413 public void onDrawForeground(Canvas canvas) {
414 super.onDrawForeground(canvas);
415
Winson036693c2016-01-14 17:16:06 -0800416 ArrayList<TaskStack.DockState> visDockStates = mTouchHandler.getVisibleDockStates();
417 for (int i = visDockStates.size() - 1; i >= 0; i--) {
418 Drawable d = visDockStates.get(i).viewState.dockAreaOverlay;
Winson882072b2015-10-12 11:26:33 -0700419 if (d.getAlpha() > 0) {
420 d.draw(canvas);
421 }
Winsonbe7607a2015-10-01 17:24:51 -0700422 }
423 }
424
Winson4165d3362015-10-10 14:40:35 -0700425 @Override
426 protected boolean verifyDrawable(Drawable who) {
Winson036693c2016-01-14 17:16:06 -0800427 ArrayList<TaskStack.DockState> visDockStates = mTouchHandler.getVisibleDockStates();
428 for (int i = visDockStates.size() - 1; i >= 0; i--) {
429 Drawable d = visDockStates.get(i).viewState.dockAreaOverlay;
Winson882072b2015-10-12 11:26:33 -0700430 if (d == who) {
431 return true;
432 }
433 }
434 return super.verifyDrawable(who);
Winson4165d3362015-10-10 14:40:35 -0700435 }
436
Winsonbe7607a2015-10-01 17:24:51 -0700437 /**** EventBus Events ****/
438
Winson Chung48f2cda2015-12-11 13:20:12 -0500439 public final void onBusEvent(LaunchTaskEvent event) {
440 mLastTaskLaunchedWasFreeform = event.task.isFreeformTask();
441 mTransitionHelper.launchTaskFromRecents(mStack, event.task, mTaskStackView, event.taskView,
442 event.screenPinningRequested, event.targetTaskBounds, event.targetTaskStack);
443 }
444
Winsonef064132016-01-05 12:11:31 -0800445 public final void onBusEvent(DismissRecentsToHomeAnimationStarted event) {
Winson50448632016-02-01 18:04:59 -0800446 int taskViewExitToHomeDuration = TaskStackAnimationHelper.EXIT_TO_HOME_TRANSLATION_DURATION;
Winson8f6ee482016-03-18 17:51:48 -0700447 if (RecentsDebugFlags.Static.EnableStackActionButton) {
448 // Hide the stack action button
449 hideStackActionButton(taskViewExitToHomeDuration, false /* translate */);
Winson91b225d2016-02-16 15:18:07 -0800450 }
Winson49df4202016-01-25 17:33:34 -0800451 animateBackgroundScrim(0f, taskViewExitToHomeDuration);
Winsonef064132016-01-05 12:11:31 -0800452 }
453
Winsonbe7607a2015-10-01 17:24:51 -0700454 public final void onBusEvent(DragStartEvent event) {
Winson882072b2015-10-12 11:26:33 -0700455 updateVisibleDockRegions(mTouchHandler.getDockStatesForCurrentOrientation(),
Winson3e874742016-01-07 10:08:17 -0800456 true /* isDefaultDockState */, TaskStack.DockState.NONE.viewState.dockAreaAlpha,
457 true /* animateAlpha */, false /* animateBounds */);
Winsonbe7607a2015-10-01 17:24:51 -0700458 }
459
Winsoneca4ab62015-11-04 10:50:28 -0800460 public final void onBusEvent(DragDropTargetChangedEvent event) {
461 if (event.dropTarget == null || !(event.dropTarget instanceof TaskStack.DockState)) {
Winson882072b2015-10-12 11:26:33 -0700462 updateVisibleDockRegions(mTouchHandler.getDockStatesForCurrentOrientation(),
Winson3e874742016-01-07 10:08:17 -0800463 true /* isDefaultDockState */, TaskStack.DockState.NONE.viewState.dockAreaAlpha,
464 true /* animateAlpha */, true /* animateBounds */);
Winson882072b2015-10-12 11:26:33 -0700465 } else {
Winsoneca4ab62015-11-04 10:50:28 -0800466 final TaskStack.DockState dockState = (TaskStack.DockState) event.dropTarget;
Winson3e874742016-01-07 10:08:17 -0800467 updateVisibleDockRegions(new TaskStack.DockState[] {dockState},
468 false /* isDefaultDockState */, -1, true /* animateAlpha */,
469 true /* animateBounds */);
Winson882072b2015-10-12 11:26:33 -0700470 }
Winsonbe7607a2015-10-01 17:24:51 -0700471 }
472
473 public final void onBusEvent(final DragEndEvent event) {
Winson479f7442015-11-25 15:16:27 -0800474 // Handle the case where we drop onto a dock region
475 if (event.dropTarget instanceof TaskStack.DockState) {
Winson3e874742016-01-07 10:08:17 -0800476 final TaskStack.DockState dockState = (TaskStack.DockState) event.dropTarget;
477
478 // Hide the dock region
479 updateVisibleDockRegions(null, false /* isDefaultDockState */, -1,
480 false /* animateAlpha */, false /* animateBounds */);
481
Winsonf24f2162016-01-05 12:11:55 -0800482 TaskStackLayoutAlgorithm stackLayout = mTaskStackView.getStackAlgorithm();
483 TaskStackViewScroller stackScroller = mTaskStackView.getScroller();
484 TaskViewTransform tmpTransform = new TaskViewTransform();
Winsoneca4ab62015-11-04 10:50:28 -0800485
Winson3e874742016-01-07 10:08:17 -0800486 // We translated the view but we need to animate it back from the current layout-space
487 // rect to its final layout-space rect
488 int x = (int) event.taskView.getTranslationX();
489 int y = (int) event.taskView.getTranslationY();
490 Rect taskViewRect = new Rect(event.taskView.getLeft(), event.taskView.getTop(),
491 event.taskView.getRight(), event.taskView.getBottom());
492 taskViewRect.offset(x, y);
493 event.taskView.setTranslationX(0);
494 event.taskView.setTranslationY(0);
495 event.taskView.setLeftTopRightBottom(taskViewRect.left, taskViewRect.top,
496 taskViewRect.right, taskViewRect.bottom);
497
Jorim Jaggi192086e2016-03-11 17:17:03 +0100498 final OnAnimationStartedListener startedListener = new OnAnimationStartedListener() {
499 @Override
500 public void onAnimationStarted() {
501 EventBus.getDefault().send(new DockedFirstAnimationFrameEvent());
502 mTaskStackView.getStack().removeTask(event.task, AnimationProps.IMMEDIATE,
503 true /* fromDockGesture */);
504 }
505 };
Jorim Jaggic69bd222016-03-15 14:38:37 +0100506
507 // Dock the task and launch it
508 SystemServicesProxy ssp = Recents.getSystemServices();
509 ssp.startTaskInDockedMode(event.task.key.id, dockState.createMode);
510 final Rect taskRect = getTaskRect(event.taskView);
511 IAppTransitionAnimationSpecsFuture future = mTransitionHelper.getAppTransitionFuture(
512 new AnimationSpecComposer() {
513 @Override
514 public List<AppTransitionAnimationSpec> composeSpecs() {
515 return mTransitionHelper.composeDockAnimationSpec(
516 event.taskView, taskRect);
517 }
518 });
519 ssp.overridePendingAppTransitionMultiThumbFuture(future,
520 mTransitionHelper.wrapStartedListener(startedListener),
521 true /* scaleUp */);
Winsona0a8ae42015-12-01 10:43:02 -0800522
Chris Wrenf6e9228b2016-01-26 18:04:35 -0500523 MetricsLogger.action(mContext, MetricsEvent.ACTION_WINDOW_DOCK_DRAG_DROP);
Winson3e874742016-01-07 10:08:17 -0800524 } else {
525 // Animate the overlay alpha back to 0
526 updateVisibleDockRegions(null, true /* isDefaultDockState */, -1,
527 true /* animateAlpha */, false /* animateBounds */);
Winsonbe7607a2015-10-01 17:24:51 -0700528 }
529 }
Winson4165d3362015-10-10 14:40:35 -0700530
Jorim Jaggic69bd222016-03-15 14:38:37 +0100531 private Rect getTaskRect(TaskView taskView) {
532 int[] location = taskView.getLocationOnScreen();
533 int viewX = location[0];
534 int viewY = location[1];
535 return new Rect(viewX, viewY,
536 (int) (viewX + taskView.getWidth() * taskView.getScaleX()),
537 (int) (viewY + taskView.getHeight() * taskView.getScaleY()));
538 }
539
Jorim Jaggidd98d412015-11-18 15:57:38 -0800540 public final void onBusEvent(DraggingInRecentsEvent event) {
Jorim Jaggi54b1a6d2015-11-24 17:48:26 -0800541 if (mTaskStackView.getTaskViews().size() > 0) {
542 setTranslationY(event.distanceFromTop - mTaskStackView.getTaskViews().get(0).getY());
543 }
Jorim Jaggidd98d412015-11-18 15:57:38 -0800544 }
545
546 public final void onBusEvent(DraggingInRecentsEndedEvent event) {
Jorim Jaggi870ab5a2015-12-02 18:37:54 -0800547 ViewPropertyAnimator animator = animate();
Jorim Jaggi8fccfe22015-12-03 16:58:08 -0800548 if (event.velocity > mFlingAnimationUtils.getMinVelocityPxPerSecond()) {
Jorim Jaggi870ab5a2015-12-02 18:37:54 -0800549 animator.translationY(getHeight());
550 animator.withEndAction(new Runnable() {
551 @Override
552 public void run() {
553 WindowManagerProxy.getInstance().maximizeDockedStack();
554 }
555 });
556 mFlingAnimationUtils.apply(animator, getTranslationY(), getHeight(), event.velocity);
557 } else {
558 animator.translationY(0f);
559 animator.setListener(null);
560 mFlingAnimationUtils.apply(animator, getTranslationY(), 0, event.velocity);
561 }
562 animator.start();
Jorim Jaggidd98d412015-11-18 15:57:38 -0800563 }
564
Winson49df4202016-01-25 17:33:34 -0800565 public final void onBusEvent(EnterRecentsWindowAnimationCompletedEvent event) {
566 RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
Winsone693aaf2016-03-01 12:05:59 -0800567 if (!launchState.launchedWhileDocking && !launchState.launchedFromApp
Jorim Jaggie161f082016-02-05 14:26:16 -0800568 && mStack.getTaskCount() > 0) {
Winson50448632016-02-01 18:04:59 -0800569 animateBackgroundScrim(DEFAULT_SCRIM_ALPHA,
570 TaskStackAnimationHelper.ENTER_FROM_HOME_TRANSLATION_DURATION);
Winson49df4202016-01-25 17:33:34 -0800571 }
572 }
573
574 public final void onBusEvent(UpdateBackgroundScrimEvent event) {
575 animateBackgroundScrim(event.alpha, DEFAULT_UPDATE_SCRIM_DURATION);
576 }
577
578 public final void onBusEvent(ResetBackgroundScrimEvent event) {
579 animateBackgroundScrim(DEFAULT_SCRIM_ALPHA, DEFAULT_UPDATE_SCRIM_DURATION);
580 }
581
Winson8f6ee482016-03-18 17:51:48 -0700582 public final void onBusEvent(ShowStackActionButtonEvent event) {
583 if (!RecentsDebugFlags.Static.EnableStackActionButton) {
Winson91b225d2016-02-16 15:18:07 -0800584 return;
585 }
586
Winson8f6ee482016-03-18 17:51:48 -0700587 showStackActionButton(150, event.translate);
Winson49df4202016-01-25 17:33:34 -0800588 }
589
Winson8f6ee482016-03-18 17:51:48 -0700590 public final void onBusEvent(HideStackActionButtonEvent event) {
591 if (!RecentsDebugFlags.Static.EnableStackActionButton) {
Winson91b225d2016-02-16 15:18:07 -0800592 return;
593 }
594
Winson8f6ee482016-03-18 17:51:48 -0700595 hideStackActionButton(100, true /* translate */);
Winson49df4202016-01-25 17:33:34 -0800596 }
597
Winsonc29ff002015-11-20 16:00:45 -0800598 /**
Winson8f6ee482016-03-18 17:51:48 -0700599 * Shows the stack action button.
Winsonc29ff002015-11-20 16:00:45 -0800600 */
Winson8f6ee482016-03-18 17:51:48 -0700601 private void showStackActionButton(final int duration, final boolean translate) {
602 if (!RecentsDebugFlags.Static.EnableStackActionButton) {
Winson91b225d2016-02-16 15:18:07 -0800603 return;
604 }
605
Winson49df4202016-01-25 17:33:34 -0800606 final ReferenceCountedTrigger postAnimationTrigger = new ReferenceCountedTrigger();
Winson8f6ee482016-03-18 17:51:48 -0700607 if (mStackActionButton.getVisibility() == View.INVISIBLE) {
608 mStackActionButton.setVisibility(View.VISIBLE);
609 mStackActionButton.setAlpha(0f);
Winson49df4202016-01-25 17:33:34 -0800610 if (translate) {
Winson8f6ee482016-03-18 17:51:48 -0700611 mStackActionButton.setTranslationY(-mStackActionButton.getMeasuredHeight() * 0.25f);
Winson214f0f02016-01-26 13:37:37 -0800612 } else {
Winson8f6ee482016-03-18 17:51:48 -0700613 mStackActionButton.setTranslationY(0f);
Winson49df4202016-01-25 17:33:34 -0800614 }
615 postAnimationTrigger.addLastDecrementRunnable(new Runnable() {
Winsonf24f2162016-01-05 12:11:55 -0800616 @Override
617 public void run() {
Winson49df4202016-01-25 17:33:34 -0800618 if (translate) {
Winson8f6ee482016-03-18 17:51:48 -0700619 mStackActionButton.animate()
Winson49df4202016-01-25 17:33:34 -0800620 .translationY(0f);
621 }
Winson8f6ee482016-03-18 17:51:48 -0700622 mStackActionButton.animate()
Winsonf24f2162016-01-05 12:11:55 -0800623 .alpha(1f)
624 .setDuration(duration)
Winsonc0d70582016-01-29 10:24:39 -0800625 .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
Winsonf24f2162016-01-05 12:11:55 -0800626 .withLayer()
627 .start();
628 }
629 });
630 }
Winson49df4202016-01-25 17:33:34 -0800631 postAnimationTrigger.flushLastDecrementRunnables();
Winsonc29ff002015-11-20 16:00:45 -0800632 }
633
634 /**
Winson8f6ee482016-03-18 17:51:48 -0700635 * Hides the stack action button.
Winsonc29ff002015-11-20 16:00:45 -0800636 */
Winson8f6ee482016-03-18 17:51:48 -0700637 private void hideStackActionButton(int duration, boolean translate) {
638 if (!RecentsDebugFlags.Static.EnableStackActionButton) {
Winson91b225d2016-02-16 15:18:07 -0800639 return;
640 }
641
Winson49df4202016-01-25 17:33:34 -0800642 final ReferenceCountedTrigger postAnimationTrigger = new ReferenceCountedTrigger();
Winson8f6ee482016-03-18 17:51:48 -0700643 hideStackActionButton(duration, translate, postAnimationTrigger);
Winson Chungaaeaac12015-12-16 16:49:36 -0500644 postAnimationTrigger.flushLastDecrementRunnables();
Winson Chung9a742902015-12-11 10:25:40 -0500645 }
646
Winson49df4202016-01-25 17:33:34 -0800647 /**
Winson8f6ee482016-03-18 17:51:48 -0700648 * Hides the stack action button.
Winson49df4202016-01-25 17:33:34 -0800649 */
Winson8f6ee482016-03-18 17:51:48 -0700650 private void hideStackActionButton(int duration, boolean translate,
651 final ReferenceCountedTrigger postAnimationTrigger) {
652 if (!RecentsDebugFlags.Static.EnableStackActionButton) {
Winson91b225d2016-02-16 15:18:07 -0800653 return;
654 }
655
Winson8f6ee482016-03-18 17:51:48 -0700656 if (mStackActionButton.getVisibility() == View.VISIBLE) {
Winson49df4202016-01-25 17:33:34 -0800657 if (translate) {
Winson8f6ee482016-03-18 17:51:48 -0700658 mStackActionButton.animate()
659 .translationY(-mStackActionButton.getMeasuredHeight() * 0.25f);
Winson49df4202016-01-25 17:33:34 -0800660 }
Winson8f6ee482016-03-18 17:51:48 -0700661 mStackActionButton.animate()
Winsonf24f2162016-01-05 12:11:55 -0800662 .alpha(0f)
663 .setDuration(duration)
Winsonc0d70582016-01-29 10:24:39 -0800664 .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
Winsonf24f2162016-01-05 12:11:55 -0800665 .withEndAction(new Runnable() {
666 @Override
667 public void run() {
Winson8f6ee482016-03-18 17:51:48 -0700668 mStackActionButton.setVisibility(View.INVISIBLE);
Winson49df4202016-01-25 17:33:34 -0800669 postAnimationTrigger.decrement();
Winsonf24f2162016-01-05 12:11:55 -0800670 }
671 })
672 .withLayer()
673 .start();
Winson49df4202016-01-25 17:33:34 -0800674 postAnimationTrigger.increment();
Winsonf24f2162016-01-05 12:11:55 -0800675 }
Winsonc29ff002015-11-20 16:00:45 -0800676 }
677
Winson4165d3362015-10-10 14:40:35 -0700678 /**
679 * Updates the dock region to match the specified dock state.
680 */
Winson3e874742016-01-07 10:08:17 -0800681 private void updateVisibleDockRegions(TaskStack.DockState[] newDockStates,
682 boolean isDefaultDockState, int overrideAlpha, boolean animateAlpha,
683 boolean animateBounds) {
Winsonc5fd3502016-01-18 15:18:37 -0800684 ArraySet<TaskStack.DockState> newDockStatesSet = Utilities.arrayToSet(newDockStates,
685 new ArraySet<TaskStack.DockState>());
Winson036693c2016-01-14 17:16:06 -0800686 ArrayList<TaskStack.DockState> visDockStates = mTouchHandler.getVisibleDockStates();
687 for (int i = visDockStates.size() - 1; i >= 0; i--) {
688 TaskStack.DockState dockState = visDockStates.get(i);
Winson882072b2015-10-12 11:26:33 -0700689 TaskStack.DockState.ViewState viewState = dockState.viewState;
690 if (newDockStates == null || !newDockStatesSet.contains(dockState)) {
691 // This is no longer visible, so hide it
Winson3e874742016-01-07 10:08:17 -0800692 viewState.startAnimation(null, 0, DOCK_AREA_OVERLAY_TRANSITION_DURATION,
Winsonc0d70582016-01-29 10:24:39 -0800693 Interpolators.ALPHA_OUT, animateAlpha, animateBounds);
Winson882072b2015-10-12 11:26:33 -0700694 } else {
695 // This state is now visible, update the bounds and show it
696 int alpha = (overrideAlpha != -1 ? overrideAlpha : viewState.dockAreaAlpha);
Winson3e874742016-01-07 10:08:17 -0800697 Rect bounds = isDefaultDockState
698 ? dockState.getPreDockedBounds(getMeasuredWidth(), getMeasuredHeight())
699 : dockState.getDockedBounds(getMeasuredWidth(), getMeasuredHeight(),
700 mDividerSize, mSystemInsets, getResources());
701 if (viewState.dockAreaOverlay.getCallback() != this) {
702 viewState.dockAreaOverlay.setCallback(this);
703 viewState.dockAreaOverlay.setBounds(bounds);
704 }
705 viewState.startAnimation(bounds, alpha, DOCK_AREA_OVERLAY_TRANSITION_DURATION,
Winsonc0d70582016-01-29 10:24:39 -0800706 Interpolators.ALPHA_IN, animateAlpha, animateBounds);
Winson882072b2015-10-12 11:26:33 -0700707 }
Winson4165d3362015-10-10 14:40:35 -0700708 }
Winson4165d3362015-10-10 14:40:35 -0700709 }
Filip Gruszczynski14b4e572015-11-03 15:53:55 -0800710
Winson49df4202016-01-25 17:33:34 -0800711 /**
712 * Animates the background scrim to the given {@param alpha}.
713 */
714 private void animateBackgroundScrim(float alpha, int duration) {
715 Utilities.cancelAnimationWithoutCallbacks(mBackgroundScrimAnimator);
716 int alphaInt = (int) (alpha * 255);
717 mBackgroundScrimAnimator = ObjectAnimator.ofInt(mBackgroundScrim, Utilities.DRAWABLE_ALPHA,
718 mBackgroundScrim.getAlpha(), alphaInt);
719 mBackgroundScrimAnimator.setDuration(duration);
720 mBackgroundScrimAnimator.setInterpolator(alphaInt > mBackgroundScrim.getAlpha()
Winsonc0d70582016-01-29 10:24:39 -0800721 ? Interpolators.ALPHA_OUT
722 : Interpolators.ALPHA_IN);
Winson49df4202016-01-25 17:33:34 -0800723 mBackgroundScrimAnimator.start();
Filip Gruszczynski14b4e572015-11-03 15:53:55 -0800724 }
Winson Chung303e1ff2014-03-07 15:06:19 -0800725}