blob: b27a23da61b76e6051bd8b4c3cdef6913b79ca65 [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;
20import android.view.WindowInsets.Type.InsetType;
21import 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.
35 * @param types The {@link InsetType}s it was able to gain control over. Note that this may be
36 * 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 */
41 void onReady(@NonNull WindowInsetsAnimationController controller, @InsetType int types);
42
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}