Debian Codegraph @

core/java/android/window/OnBackAnimationCallback.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2022 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.window;
18
19 import android.annotation.NonNull;
20 import android.app.Activity;
21 import android.app.Dialog;
22 import android.view.View;
23
24 /**
25 * Interface for applications to register back animation callbacks along their custom back
26 * handling.
27 * <p>
28 * This allows the client to customize various back behaviors by overriding the corresponding
29 * callback methods.
30 * <p>
31 * Callback instances can be added to and removed from {@link OnBackInvokedDispatcher}, held
32 * by classes that implement {@link OnBackInvokedDispatcherOwner} (such as {@link Activity},
33 * {@link Dialog} and {@link View}).
34 * <p>
35 * When back is triggered, callbacks on the in-focus window are invoked in reverse order in which
36 * they are added within the same priority. Between different priorities, callbacks with higher
37 * priority are invoked first.
38 * <p>
39 * @see OnBackInvokedCallback
40 * @hide
41 */
42 public interface OnBackAnimationCallback extends OnBackInvokedCallback {
43 /**
44 * Called when a back gesture has been started, or back button has been pressed down.
45 *
46 * @param backEvent An {@link BackEvent} object describing the progress event.
47 */
48 default void onBackStarted(@NonNull BackEvent backEvent) {}
49
50 /**
51 * Called on back gesture progress.
52 *
53 * @param backEvent An {@link BackEvent} object describing the progress event.
54 *
55 * @see BackEvent
56 */
57 default void onBackProgressed(@NonNull BackEvent backEvent) { }
58
59 /**
60 * Called when a back gesture or back button press has been cancelled.
61 */
62 default void onBackCancelled() { }
63 }