ViewAnimation.java revision d42a6cfe2bf632222617450a1ed340268e82f06c
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
17package com.android.systemui.recents.views;
18
19import android.graphics.Rect;
20import com.android.systemui.recents.ReferenceCountedTrigger;
21
22/* Common code related to view animations */
23public class ViewAnimation {
24
25    /* The animation context for a task view animation into Recents */
26    public static class TaskViewEnterContext {
27        // The full screenshot view that we are animating down
28        FullScreenTransitionView fullScreenshot;
29        // The transform of the current task view
30        TaskViewTransform transform;
31        // The stack rect that the transform is relative to
32        Rect stackRectSansPeek;
33        // The task rect
34        Rect taskRect;
35        // The view index of the current task view
36        int stackViewIndex;
37        // The total number of task views
38        int stackViewCount;
39        // Whether this is the front most task view
40        boolean isFrontMost;
41
42        public TaskViewEnterContext(FullScreenTransitionView fss) {
43            fullScreenshot = fss;
44        }
45    }
46
47    /* The animation context for a task view animation out of Recents */
48    public static class TaskViewExitContext {
49        // A trigger to run some logic when all the animations complete.  This works around the fact
50        // that it is difficult to coordinate ViewPropertyAnimators
51        ReferenceCountedTrigger postAnimationTrigger;
52        // The translationY to apply to a TaskView to move it off screen
53        int offscreenTranslationY;
54
55        public TaskViewExitContext(ReferenceCountedTrigger t) {
56            postAnimationTrigger = t;
57        }
58    }
59
60}
61