1 /* 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 17 package com.android.systemui.recents.views; 18 19 import android.animation.ValueAnimator; 20 import android.graphics.Rect; 21 import com.android.systemui.recents.misc.ReferenceCountedTrigger; 22 23 /* Common code related to view animations */ 24 public class ViewAnimation { 25 26 /* The animation context for a task view animation into Recents */ 27 public static class TaskViewEnterContext { 28 // A trigger to run some logic when all the animations complete. This works around the fact 29 // that it is difficult to coordinate ViewPropertyAnimators 30 ReferenceCountedTrigger postAnimationTrigger; 31 // An update listener to notify as the enter animation progresses (used for the home transition) 32 ValueAnimator.AnimatorUpdateListener updateListener; 33 34 // These following properties are updated for each task view we start the enter animation on 35 36 // Whether or not the current task occludes the launch target 37 boolean currentTaskOccludesLaunchTarget; 38 // The task rect for the current stack 39 Rect currentTaskRect; 40 // The transform of the current task view 41 TaskViewTransform currentTaskTransform; 42 // The view index of the current task view 43 int currentStackViewIndex; 44 // The total number of task views 45 int currentStackViewCount; 46 TaskViewEnterContext(ReferenceCountedTrigger t)47 public TaskViewEnterContext(ReferenceCountedTrigger t) { 48 postAnimationTrigger = t; 49 } 50 } 51 52 /* The animation context for a task view animation out of Recents */ 53 public static class TaskViewExitContext { 54 // A trigger to run some logic when all the animations complete. This works around the fact 55 // that it is difficult to coordinate ViewPropertyAnimators 56 ReferenceCountedTrigger postAnimationTrigger; 57 58 // The translationY to apply to a TaskView to move it off the bottom of the task stack 59 int offscreenTranslationY; 60 TaskViewExitContext(ReferenceCountedTrigger t)61 public TaskViewExitContext(ReferenceCountedTrigger t) { 62 postAnimationTrigger = t; 63 } 64 } 65 66 } 67