1 /*
2  * Copyright (C) 2021 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.settingslib.transition;
18 
19 import android.app.Activity;
20 
21 import androidx.annotation.IntDef;
22 import androidx.fragment.app.Fragment;
23 
24 import java.lang.annotation.Retention;
25 import java.lang.annotation.RetentionPolicy;
26 
27 /**
28  * A helper class to apply Settings Transition
29  */
30 public class SettingsTransitionHelper {
31 
32     /**
33      * Flags indicating the type of the transition.
34      */
35     @IntDef({
36             TransitionType.TRANSITION_NONE,
37             TransitionType.TRANSITION_SHARED_AXIS,
38             TransitionType.TRANSITION_SLIDE,
39             TransitionType.TRANSITION_FADE
40     })
41     @Retention(RetentionPolicy.SOURCE)
42     public @interface TransitionType {
43         int TRANSITION_NONE = -1;
44         int TRANSITION_SHARED_AXIS = 0;
45         int TRANSITION_SLIDE = 1;
46         int TRANSITION_FADE = 2;
47     }
48 
49     public static final String EXTRA_PAGE_TRANSITION_TYPE = "page_transition_type";
50 
51     private static final String TAG = "SettingsTransitionHelper";
52 
53     /**
54      * Apply the forward transition to the {@link Activity}, including Exit Transition and Enter
55      * Transition.
56      *
57      * The Exit Transition takes effect when leaving the page, while the Enter Transition is
58      * triggered when the page is launched/entering.
59      */
applyForwardTransition(Activity activity)60     public static void applyForwardTransition(Activity activity) {}
61 
62     /**
63      * Apply the forward transition to the {@link Fragment}, including Exit Transition and Enter
64      * Transition.
65      *
66      * The Exit Transition takes effect when leaving the page, while the Enter Transition is
67      * triggered when the page is launched/entering.
68      */
applyForwardTransition(Fragment fragment)69     public static void applyForwardTransition(Fragment fragment) {}
70 
71     /**
72      * Apply the backward transition to the {@link Activity}, including Return Transition and
73      * Reenter Transition.
74      *
75      * Return Transition will be used to move Views out of the scene when the Window is preparing
76      * to close. Reenter Transition will be used to move Views in to the scene when returning from a
77      * previously-started Activity.
78      */
applyBackwardTransition(Activity activity)79     public static void applyBackwardTransition(Activity activity) {}
80 
81     /**
82      * Apply the backward transition to the {@link Fragment}, including Return Transition and
83      * Reenter Transition.
84      *
85      * Return Transition will be used to move Views out of the scene when the Window is preparing
86      * to close. Reenter Transition will be used to move Views in to the scene when returning from a
87      * previously-started Fragment.
88      */
applyBackwardTransition(Fragment fragment)89     public static void applyBackwardTransition(Fragment fragment) {}
90 }
91