FragmentAnimationProvider.java revision ebd3d9078dbaebd10a9506ca086435eb63e8a2d2
1/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 * in compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 * or implied. See the License for the specific language governing permissions and limitations under
12 * the License.
13 */
14package android.support.v17.leanback.widget;
15
16import android.animation.Animator;
17import android.support.annotation.NonNull;
18
19import java.util.List;
20
21/**
22 * FragmentAnimationProvider supplies animations for use during a fragment's onCreateAnimator
23 * callback. Animators added here will be added to an animation set and played together. This
24 * allows presenters used by a fragment to control their own fragment lifecycle animations.
25 */
26public interface FragmentAnimationProvider {
27
28    /**
29     * Animates the entry of the fragment in the case where the activity is first being presented.
30     * @param animators A list of animations to which this provider's animations should be added.
31     */
32    public abstract void onActivityEnter(@NonNull List<Animator> animators);
33
34    /**
35     * Animates the exit of the fragment in the case where the activity is about to pause.
36     * @param animators A list of animations to which this provider's animations should be added.
37     */
38    public abstract void onActivityExit(@NonNull List<Animator> animators);
39
40    /**
41     * Animates the entry of the fragment in the case where there is a previous step fragment
42     * participating in the animation. Entry occurs when the fragment is preparing to be shown
43     * as it is pushed onto the back stack.
44     * @param animators A list of animations to which this provider's animations should be added.
45     */
46    public abstract void onFragmentEnter(@NonNull List<Animator> animators);
47
48    /**
49     * Animates the exit of the fragment in the case where there is a previous step fragment
50     * participating in the animation. Exit occurs when the fragment is preparing to be removed,
51     * hidden, or detached due to pushing another fragment onto the back stack.
52     * @param animators A list of animations to which this provider's animations should be added.
53     */
54    public abstract void onFragmentExit(@NonNull List<Animator> animators);
55
56    /**
57     * Animates the re-entry of the fragment in the case where there is a previous step fragment
58     * participating in the animation. Re-entry occurs when the fragment is preparing to be shown
59     * due to popping the back stack.
60     * @param animators A list of animations to which this provider's animations should be added.
61     */
62    public abstract void onFragmentReenter(@NonNull List<Animator> animators);
63
64    /**
65     * Animates the return of the fragment in the case where there is a previous step fragment
66     * participating in the animation. Return occurs when the fragment is preparing to be removed,
67     * hidden, or detached due to popping the back stack.
68     * @param animators A list of animations to which this provider's animations should be added.
69     */
70    public abstract void onFragmentReturn(@NonNull List<Animator> animators);
71
72}
73