• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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.shared.rotation;
18 
19 import android.graphics.drawable.Drawable;
20 import android.view.View;
21 
22 /**
23  * Interface of a rotation button that interacts {@link RotationButtonController}.
24  * This interface exists because of the two different styles of rotation button in Sysui,
25  * one in contextual for 3 button nav and a floating rotation button for gestural.
26  */
27 public interface RotationButton {
setRotationButtonController(RotationButtonController rotationButtonController)28     default void setRotationButtonController(RotationButtonController rotationButtonController) { }
setUpdatesCallback(RotationButtonUpdatesCallback updatesCallback)29     default void setUpdatesCallback(RotationButtonUpdatesCallback updatesCallback) { }
30 
getCurrentView()31     default View getCurrentView() {
32         return null;
33     }
show()34     default boolean show() { return false; }
hide()35     default boolean hide() { return false; }
isVisible()36     default boolean isVisible() {
37         return false;
38     }
onTaskbarStateChanged(boolean taskbarVisible, boolean taskbarStashed)39     default void onTaskbarStateChanged(boolean taskbarVisible, boolean taskbarStashed) {}
updateIcon(int lightIconColor, int darkIconColor)40     default void updateIcon(int lightIconColor, int darkIconColor) { }
setOnClickListener(View.OnClickListener onClickListener)41     default void setOnClickListener(View.OnClickListener onClickListener) { }
setOnHoverListener(View.OnHoverListener onHoverListener)42     default void setOnHoverListener(View.OnHoverListener onHoverListener) { }
getImageDrawable()43     default Drawable getImageDrawable() {
44         return null;
45     }
setDarkIntensity(float darkIntensity)46     default void setDarkIntensity(float darkIntensity) { }
acceptRotationProposal()47     default boolean acceptRotationProposal() {
48         return getCurrentView() != null;
49     }
50 
51     /**
52      * Callback for updates provided by a rotation button
53      */
54     interface RotationButtonUpdatesCallback {
onVisibilityChanged(boolean isVisible)55         default void onVisibilityChanged(boolean isVisible) {};
onPositionChanged()56         default void onPositionChanged() {};
57     }
58 }
59