Skuhne | b816087 | 2015-09-22 09:51:39 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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.graphics.Rect; |
| 20 | |
| 21 | /** |
| 22 | * These callbacks are used to communicate window configuration changes while the user is performing |
| 23 | * window changes. |
Skuhne | 980ee47 | 2015-10-06 11:31:31 -0700 | [diff] [blame] | 24 | * Note: Note that at the time of onWindowDragResizeStart the content size isn't known. A consumer |
| 25 | * should therfore not draw anything before the additional onContentDraw call has arrived. |
Skuhne | b816087 | 2015-09-22 09:51:39 -0700 | [diff] [blame] | 26 | * @hide |
| 27 | */ |
| 28 | public interface WindowCallbacks { |
| 29 | /** |
| 30 | * Called by the system when the window got changed by the user, before the layouter got called. |
Jorim Jaggi | 9511b0f | 2016-01-29 19:12:44 -0800 | [diff] [blame] | 31 | * It also gets called when the insets changed, or when the window switched between a fullscreen |
| 32 | * layout or a non-fullscreen layout. It can be used to perform a "quick and dirty" resize which |
| 33 | * should never take more then 4ms to complete. |
Skuhne | b816087 | 2015-09-22 09:51:39 -0700 | [diff] [blame] | 34 | * |
| 35 | * <p>At the time the layouting has not happened yet. |
| 36 | * |
| 37 | * @param newBounds The new window frame bounds. |
Jorim Jaggi | 9511b0f | 2016-01-29 19:12:44 -0800 | [diff] [blame] | 38 | * @param fullscreen Whether the window is currently drawing in fullscreen. |
| 39 | * @param systemInsets The current visible system insets for the window. |
| 40 | * @param stableInsets The stable insets for the window. |
Skuhne | b816087 | 2015-09-22 09:51:39 -0700 | [diff] [blame] | 41 | */ |
Jorim Jaggi | 9511b0f | 2016-01-29 19:12:44 -0800 | [diff] [blame] | 42 | void onWindowSizeIsChanging(Rect newBounds, boolean fullscreen, Rect systemInsets, |
| 43 | Rect stableInsets); |
Skuhne | b816087 | 2015-09-22 09:51:39 -0700 | [diff] [blame] | 44 | |
| 45 | /** |
| 46 | * Called when a drag resize starts. |
Jorim Jaggi | 9511b0f | 2016-01-29 19:12:44 -0800 | [diff] [blame] | 47 | * |
Skuhne | b816087 | 2015-09-22 09:51:39 -0700 | [diff] [blame] | 48 | * @param initialBounds The initial bounds where the window will be. |
Jorim Jaggi | 9511b0f | 2016-01-29 19:12:44 -0800 | [diff] [blame] | 49 | * @param fullscreen Whether the window is currently drawing in fullscreen. |
| 50 | * @param systemInsets The current visible system insets for the window. |
| 51 | * @param stableInsets The stable insets for the window. |
Skuhne | b816087 | 2015-09-22 09:51:39 -0700 | [diff] [blame] | 52 | */ |
Jorim Jaggi | 9511b0f | 2016-01-29 19:12:44 -0800 | [diff] [blame] | 53 | void onWindowDragResizeStart(Rect initialBounds, boolean fullscreen, Rect systemInsets, |
| 54 | Rect stableInsets); |
Skuhne | b816087 | 2015-09-22 09:51:39 -0700 | [diff] [blame] | 55 | |
| 56 | /** |
| 57 | * Called when a drag resize ends. |
| 58 | */ |
| 59 | void onWindowDragResizeEnd(); |
Skuhne | 980ee47 | 2015-10-06 11:31:31 -0700 | [diff] [blame] | 60 | |
| 61 | /** |
Chong Zhang | 8dbd9ad | 2015-10-09 10:06:11 -0700 | [diff] [blame] | 62 | * The content will now be drawn to these bounds. Returns true if |
| 63 | * a draw should be requested after the next content draw. |
Skuhne | 980ee47 | 2015-10-06 11:31:31 -0700 | [diff] [blame] | 64 | */ |
Chong Zhang | 8dbd9ad | 2015-10-09 10:06:11 -0700 | [diff] [blame] | 65 | boolean onContentDrawn(int offsetX, int offsetY, int sizeX, int sizeY); |
| 66 | |
| 67 | /** |
| 68 | * Called to request the window to draw one frame. |
| 69 | * @param reportNextDraw Whether it should report when the requested draw finishes. |
| 70 | */ |
| 71 | void onRequestDraw(boolean reportNextDraw); |
Skuhne | b816087 | 2015-09-22 09:51:39 -0700 | [diff] [blame] | 72 | } |