• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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 android.view;
18 
19 import android.view.WindowInsets.Type.InsetsType;
20 import android.view.WindowInsetsAnimation.Bounds;
21 
22 /**
23  * Provide an interface to let InsetsAnimationControlImpl and InsetsResizeAnimationRunner call back
24  * into its owner.
25  * @hide
26  */
27 public interface InsetsAnimationControlCallbacks {
28 
29     /**
30      * Executes the necessary code to start the animation in the correct order, including:
31      * <ul>
32      *     <li>Dispatch {@link WindowInsetsAnimation.Callback#onPrepare}</li>
33      *     <li>Update insets state and run layout according to {@code layoutDuringAnimation}</li>
34      *     <li>Dispatch {@link WindowInsetsAnimation.Callback#onStart}</li>
35      *     <li>Dispatch {@link WindowInsetsAnimationControlListener#onReady}</li>
36      * </ul>
37      */
38     <T extends InsetsAnimationControlRunner & InternalInsetsAnimationController>
startAnimation(T runner, WindowInsetsAnimationControlListener listener, int types, WindowInsetsAnimation animation, Bounds bounds)39     void startAnimation(T runner, WindowInsetsAnimationControlListener listener, int types,
40             WindowInsetsAnimation animation, Bounds bounds);
41 
42     /**
43      * Schedule the apply by posting the animation callback.
44      *
45      * @param runner The runner that requested applying insets
46      */
scheduleApplyChangeInsets(InsetsAnimationControlRunner runner)47     void scheduleApplyChangeInsets(InsetsAnimationControlRunner runner);
48 
49     /**
50      * Finish the final steps after the animation.
51      * @param runner The runner used to run the animation.
52      * @param shown {@code true} if the insets are shown.
53      */
notifyFinished(InsetsAnimationControlRunner runner, boolean shown)54     void notifyFinished(InsetsAnimationControlRunner runner, boolean shown);
55 
56     /**
57      * Post a message to release the Surface, guaranteed to happen after all
58      * previous calls to applySurfaceParams.
59      */
releaseSurfaceControlFromRt(SurfaceControl sc)60     void releaseSurfaceControlFromRt(SurfaceControl sc);
61 
62     /**
63      * Reports that the perceptibility of the given types has changed to the given value.
64      *
65      * A type is perceptible if it is not (almost) entirely off-screen and not (almost) entirely
66      * transparent.
67      *
68      * @param types the (public) types whose perceptibility has changed
69      * @param perceptible true, if the types are now perceptible, false if they are not perceptible
70      */
reportPerceptible(@nsetsType int types, boolean perceptible)71     void reportPerceptible(@InsetsType int types, boolean perceptible);
72 }
73