Yunfan Chen | 02abf55 | 2019-12-05 14:51:09 +0900 | [diff] [blame] | 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 | |
Adrian Roos | db5b0c2 | 2020-02-12 15:05:27 -0800 | [diff] [blame] | 19 | import android.view.WindowInsetsAnimation.Bounds; |
Jorim Jaggi | a51168a | 2019-12-27 15:17:44 +0100 | [diff] [blame] | 20 | |
Yunfan Chen | 02abf55 | 2019-12-05 14:51:09 +0900 | [diff] [blame] | 21 | /** |
| 22 | * Provide an interface to let InsetsAnimationControlImpl call back into its owner. |
| 23 | * @hide |
| 24 | */ |
| 25 | public interface InsetsAnimationControlCallbacks { |
Jorim Jaggi | a51168a | 2019-12-27 15:17:44 +0100 | [diff] [blame] | 26 | |
Yunfan Chen | 02abf55 | 2019-12-05 14:51:09 +0900 | [diff] [blame] | 27 | /** |
Jorim Jaggi | a51168a | 2019-12-27 15:17:44 +0100 | [diff] [blame] | 28 | * Executes the necessary code to start the animation in the correct order, including: |
| 29 | * <ul> |
Adrian Roos | db5b0c2 | 2020-02-12 15:05:27 -0800 | [diff] [blame] | 30 | * <li>Dispatch {@link WindowInsetsAnimation.Callback#onPrepare}</li> |
Jorim Jaggi | a51168a | 2019-12-27 15:17:44 +0100 | [diff] [blame] | 31 | * <li>Update insets state and run layout according to {@code layoutDuringAnimation}</li> |
Adrian Roos | db5b0c2 | 2020-02-12 15:05:27 -0800 | [diff] [blame] | 32 | * <li>Dispatch {@link WindowInsetsAnimation.Callback#onStart}</li> |
Jorim Jaggi | a51168a | 2019-12-27 15:17:44 +0100 | [diff] [blame] | 33 | * <li>Dispatch {@link WindowInsetsAnimationControlListener#onReady}</li> |
| 34 | * </ul> |
Yunfan Chen | 02abf55 | 2019-12-05 14:51:09 +0900 | [diff] [blame] | 35 | */ |
Jorim Jaggi | a51168a | 2019-12-27 15:17:44 +0100 | [diff] [blame] | 36 | void startAnimation(InsetsAnimationControlImpl controller, |
Adrian Roos | db5b0c2 | 2020-02-12 15:05:27 -0800 | [diff] [blame] | 37 | WindowInsetsAnimationControlListener listener, int types, |
| 38 | WindowInsetsAnimation animation, |
Jorim Jaggi | 6d5c801 | 2020-02-28 01:40:27 +0100 | [diff] [blame] | 39 | Bounds bounds); |
Yunfan Chen | 02abf55 | 2019-12-05 14:51:09 +0900 | [diff] [blame] | 40 | |
| 41 | /** |
| 42 | * Schedule the apply by posting the animation callback. |
Adrian Roos | 6a4448f | 2020-04-01 15:01:08 +0200 | [diff] [blame] | 43 | * |
| 44 | * @param runner The runner that requested applying insets |
Yunfan Chen | 02abf55 | 2019-12-05 14:51:09 +0900 | [diff] [blame] | 45 | */ |
Adrian Roos | 6a4448f | 2020-04-01 15:01:08 +0200 | [diff] [blame] | 46 | void scheduleApplyChangeInsets(InsetsAnimationControlRunner runner); |
Yunfan Chen | 02abf55 | 2019-12-05 14:51:09 +0900 | [diff] [blame] | 47 | |
| 48 | /** |
| 49 | * Finish the final steps after the animation. |
Jorim Jaggi | 6d5c801 | 2020-02-28 01:40:27 +0100 | [diff] [blame] | 50 | * @param runner The runner used to run the animation. |
Yunfan Chen | 02abf55 | 2019-12-05 14:51:09 +0900 | [diff] [blame] | 51 | * @param shown {@code true} if the insets are shown. |
| 52 | */ |
Jorim Jaggi | 6d5c801 | 2020-02-28 01:40:27 +0100 | [diff] [blame] | 53 | void notifyFinished(InsetsAnimationControlRunner runner, boolean shown); |
Yunfan Chen | 02abf55 | 2019-12-05 14:51:09 +0900 | [diff] [blame] | 54 | |
| 55 | /** |
Yunfan Chen | 02abf55 | 2019-12-05 14:51:09 +0900 | [diff] [blame] | 56 | * Apply the new params to the surface. |
| 57 | * @param params The {@link android.view.SyncRtSurfaceTransactionApplier.SurfaceParams} to |
| 58 | * apply. |
| 59 | */ |
| 60 | void applySurfaceParams(SyncRtSurfaceTransactionApplier.SurfaceParams... params); |
Rob Carr | 3a367c4 | 2020-03-10 15:51:35 -0700 | [diff] [blame] | 61 | |
| 62 | /** |
| 63 | * Post a message to release the Surface, guaranteed to happen after all |
| 64 | * previous calls to applySurfaceParams. |
| 65 | */ |
| 66 | void releaseSurfaceControlFromRt(SurfaceControl sc); |
Yunfan Chen | 02abf55 | 2019-12-05 14:51:09 +0900 | [diff] [blame] | 67 | } |