• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 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 com.android.systemui.statusbar;
18 
19 /**
20  * Common interface for a UI element controlled by
21  * {@link com.android.systemui.statusbar.phone.AutoHideController}. These UI elements  automatically
22  * hidden by {@link com.android.systemui.statusbar.phone.AutoHideController} when in some transient
23  * state.
24  */
25 public interface AutoHideUiElement {
26 
27     /**
28      * Ensures that the {@link AutoHideUiElement} reflects the current expected state. This
29      * method will be posted as a {@link Runnable} in the main thread.
30      */
synchronizeState()31     void synchronizeState();
32 
33     /**
34      * The {@link com.android.systemui.statusbar.phone.AutoHideController} is responsible for
35      * automatically hiding ui elements that are only shown transiently. This method determines
36      * whether a manual touch should also hide the ui elements that are temporarily visible.
37      *
38      * Note that all {@link AutoHideUiElement} instances should return true for a manual touch to
39      * trigger {@link #hide()} on the ui elements.
40      */
shouldHideOnTouch()41     default boolean shouldHideOnTouch() {
42         return true;
43     }
44 
45     /** Returns true if the {@link AutoHideUiElement} is visible. */
isVisible()46     boolean isVisible();
47 
48     /**
49      * Called to hide the {@link AutoHideUiElement} through the
50      * {@link com.android.systemui.statusbar.phone.AutoHideController}.
51      */
hide()52     void hide();
53 }
54