• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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.quickstep.util;
18 
19 import static com.android.launcher3.anim.Interpolators.LINEAR;
20 
21 import android.view.animation.Interpolator;
22 
23 /**
24  * An interface that supports the centralization of timing information for splitscreen animations.
25  */
26 public interface SplitAnimationTimings {
27     int TABLET_ENTER_DURATION = 866;
28     int TABLET_CONFIRM_DURATION = 500;
29 
30     int PHONE_ENTER_DURATION = 517;
31     int PHONE_CONFIRM_DURATION = 333;
32 
33     int ABORT_DURATION = 500;
34 
35     SplitAnimationTimings TABLET_OVERVIEW_TO_SPLIT = new TabletOverviewToSplitTimings();
36     SplitAnimationTimings TABLET_HOME_TO_SPLIT = new TabletHomeToSplitTimings();
37     SplitAnimationTimings TABLET_SPLIT_TO_CONFIRM = new TabletSplitToConfirmTimings();
38 
39     SplitAnimationTimings PHONE_OVERVIEW_TO_SPLIT = new PhoneOverviewToSplitTimings();
40     SplitAnimationTimings PHONE_SPLIT_TO_CONFIRM = new PhoneSplitToConfirmTimings();
41 
42     // Shared methods
getDuration()43     int getDuration();
getPlaceholderFadeInStart()44     int getPlaceholderFadeInStart();
getPlaceholderFadeInEnd()45     int getPlaceholderFadeInEnd();
getPlaceholderIconFadeInStart()46     int getPlaceholderIconFadeInStart();
getPlaceholderIconFadeInEnd()47     int getPlaceholderIconFadeInEnd();
getStagedRectSlideStart()48     int getStagedRectSlideStart();
getStagedRectSlideEnd()49     int getStagedRectSlideEnd();
getStagedRectXInterpolator()50     Interpolator getStagedRectXInterpolator();
getStagedRectYInterpolator()51     Interpolator getStagedRectYInterpolator();
getStagedRectScaleXInterpolator()52     Interpolator getStagedRectScaleXInterpolator();
getStagedRectScaleYInterpolator()53     Interpolator getStagedRectScaleYInterpolator();
getPlaceholderFadeInStartOffset()54     default float getPlaceholderFadeInStartOffset() {
55         return (float) getPlaceholderFadeInStart() / getDuration();
56     }
getPlaceholderFadeInEndOffset()57     default float getPlaceholderFadeInEndOffset() {
58         return (float) getPlaceholderFadeInEnd() / getDuration();
59     }
getPlaceholderIconFadeInStartOffset()60     default float getPlaceholderIconFadeInStartOffset() {
61         return (float) getPlaceholderIconFadeInStart() / getDuration();
62     }
getPlaceholderIconFadeInEndOffset()63     default float getPlaceholderIconFadeInEndOffset() {
64         return (float) getPlaceholderIconFadeInEnd() / getDuration();
65     }
getStagedRectSlideStartOffset()66     default float getStagedRectSlideStartOffset() {
67         return (float) getStagedRectSlideStart() / getDuration();
68     }
getStagedRectSlideEndOffset()69     default float getStagedRectSlideEndOffset() {
70         return (float) getStagedRectSlideEnd() / getDuration();
71     }
72 
73     // Defaults for OverviewToSplit
getGridSlideStartOffset()74     default float getGridSlideStartOffset() { return 0; }
getGridSlideStaggerOffset()75     default float getGridSlideStaggerOffset() { return 0; }
getGridSlideDurationOffset()76     default float getGridSlideDurationOffset() { return 0; }
getActionsFadeStartOffset()77     default float getActionsFadeStartOffset() { return 0; }
getActionsFadeEndOffset()78     default float getActionsFadeEndOffset() { return 0; }
getIconFadeStartOffset()79     default float getIconFadeStartOffset() { return 0; }
getIconFadeEndOffset()80     default float getIconFadeEndOffset() { return 0; }
getInstructionsContainerFadeInStartOffset()81     default float getInstructionsContainerFadeInStartOffset() { return 0; }
getInstructionsContainerFadeInEndOffset()82     default float getInstructionsContainerFadeInEndOffset() { return 0; }
getInstructionsTextFadeInStartOffset()83     default float getInstructionsTextFadeInStartOffset() { return 0; }
getInstructionsTextFadeInEndOffset()84     default float getInstructionsTextFadeInEndOffset() { return 0; }
getInstructionsUnfoldStartOffset()85     default float getInstructionsUnfoldStartOffset() { return 0; }
getInstructionsUnfoldEndOffset()86     default float getInstructionsUnfoldEndOffset() { return 0; }
getGridSlidePrimaryInterpolator()87     default Interpolator getGridSlidePrimaryInterpolator() { return LINEAR; }
getGridSlideSecondaryInterpolator()88     default Interpolator getGridSlideSecondaryInterpolator() { return LINEAR; }
89 
90     // Defaults for HomeToSplit
getScrimFadeInStartOffset()91     default float getScrimFadeInStartOffset() { return 0; }
getScrimFadeInEndOffset()92     default float getScrimFadeInEndOffset() { return 0; }
93 
94     // Defaults for SplitToConfirm
getInstructionsFadeStartOffset()95     default float getInstructionsFadeStartOffset() { return 0; }
getInstructionsFadeEndOffset()96     default float getInstructionsFadeEndOffset() { return 0; }
97 }
98 
99