blob: 33fb327121c0ab409085cb055bbcce7f473eb9db [file] [log] [blame]
Jorim Jaggi5bb571d2018-11-06 14:42:04 +01001/*
2 * Copyright (C) 2018 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
17package android.view;
18
19import android.annotation.NonNull;
Tiger Huang332793b2019-10-29 23:21:27 +080020import android.view.WindowInsets.Type.InsetsType;
Jorim Jaggi5bb571d2018-11-06 14:42:04 +010021import android.view.inputmethod.EditorInfo;
22
23/**
24 * Interface that informs the client about {@link WindowInsetsAnimationController} state changes.
25 * @hide pending unhide
26 */
27public interface WindowInsetsAnimationControlListener {
28
29 /**
30 * Gets called as soon as the animation is ready to be controlled. This may be
31 * delayed when the IME needs to redraw because of an {@link EditorInfo} change, or when the
32 * window is starting up.
33 *
34 * @param controller The controller to control the inset animation.
Tiger Huang332793b2019-10-29 23:21:27 +080035 * @param types The {@link InsetsType}s it was able to gain control over. Note that this may be
Jorim Jaggi5bb571d2018-11-06 14:42:04 +010036 * different than the types passed into
37 * {@link WindowInsetsController#controlWindowInsetsAnimation} in case the window
38 * wasn't able to gain the controls because it wasn't the IME target or not
39 * currently the window that's controlling the system bars.
40 */
Tiger Huang332793b2019-10-29 23:21:27 +080041 void onReady(@NonNull WindowInsetsAnimationController controller, @InsetsType int types);
Jorim Jaggi5bb571d2018-11-06 14:42:04 +010042
43 /**
44 * Called when the window no longer has control over the requested types. If it loses control
45 * over one type, the whole control will be cancelled. If none of the requested types were
46 * available when requesting the control, the animation control will be cancelled immediately
47 * without {@link #onReady} being called.
48 */
49 void onCancelled();
50}