ViewAnimation.java revision ffa2ec664479bff6b4b61d4c349d9db2cb37ca16
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.misc.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        FullscreenTransitionOverlayView 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        // A trigger to run some logic when all the animations complete.  This works around the fact
42        // that it is difficult to coordinate ViewPropertyAnimators
43        ReferenceCountedTrigger postAnimationTrigger;
44
45        public TaskViewEnterContext(FullscreenTransitionOverlayView fss, ReferenceCountedTrigger t) {
46            fullScreenshot = fss;
47            postAnimationTrigger = t;
48        }
49    }
50
51    /* The animation context for a task view animation out of Recents */
52    public static class TaskViewExitContext {
53        // A trigger to run some logic when all the animations complete.  This works around the fact
54        // that it is difficult to coordinate ViewPropertyAnimators
55        ReferenceCountedTrigger postAnimationTrigger;
56        // The translationY to apply to a TaskView to move it off screen
57        int offscreenTranslationY;
58
59        public TaskViewExitContext(ReferenceCountedTrigger t) {
60            postAnimationTrigger = t;
61        }
62    }
63
64}
65