• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
5  * except in compliance with the License. You may obtain a copy of the License at
6  *
7  *      http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software distributed under the
10  * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11  * KIND, either express or implied. See the License for the specific language governing
12  * permissions and limitations under the License.
13  */
14 
15 package com.android.systemui.plugins.qs;
16 
17 import android.view.View;
18 import android.view.View.OnClickListener;
19 import android.view.ViewGroup;
20 
21 import com.android.systemui.plugins.FragmentBase;
22 import com.android.systemui.plugins.annotations.DependsOn;
23 import com.android.systemui.plugins.annotations.ProvidesInterface;
24 import com.android.systemui.plugins.qs.QS.HeightListener;
25 
26 import java.util.function.Consumer;
27 
28 /**
29  * Fragment that contains QS in the notification shade.  Most of the interface is for
30  * handling the expand/collapsing of the view interaction.
31  */
32 @ProvidesInterface(action = QS.ACTION, version = QS.VERSION)
33 @DependsOn(target = HeightListener.class)
34 public interface QS extends FragmentBase {
35 
36     String ACTION = "com.android.systemui.action.PLUGIN_QS";
37 
38     int VERSION = 11;
39 
40     String TAG = "QS";
41 
setPanelView(HeightListener notificationPanelView)42     void setPanelView(HeightListener notificationPanelView);
43 
hideImmediately()44     void hideImmediately();
getQsMinExpansionHeight()45     int getQsMinExpansionHeight();
getDesiredHeight()46     int getDesiredHeight();
setHeightOverride(int desiredHeight)47     void setHeightOverride(int desiredHeight);
setHeaderClickable(boolean qsExpansionEnabled)48     void setHeaderClickable(boolean qsExpansionEnabled);
isCustomizing()49     boolean isCustomizing();
setOverscrolling(boolean overscrolling)50     void setOverscrolling(boolean overscrolling);
setExpanded(boolean qsExpanded)51     void setExpanded(boolean qsExpanded);
setListening(boolean listening)52     void setListening(boolean listening);
isShowingDetail()53     boolean isShowingDetail();
closeDetail()54     void closeDetail();
animateHeaderSlidingOut()55     void animateHeaderSlidingOut();
setQsExpansion(float qsExpansionFraction, float headerTranslation)56     void setQsExpansion(float qsExpansionFraction, float headerTranslation);
setHeaderListening(boolean listening)57     void setHeaderListening(boolean listening);
notifyCustomizeChanged()58     void notifyCustomizeChanged();
setContainer(ViewGroup container)59     void setContainer(ViewGroup container);
setExpandClickListener(OnClickListener onClickListener)60     void setExpandClickListener(OnClickListener onClickListener);
61 
getHeader()62     View getHeader();
63 
setHasNotifications(boolean hasNotifications)64     default void setHasNotifications(boolean hasNotifications) {
65     }
66 
67     /**
68      * Should touches from the notification panel be disallowed?
69      * The notification panel might grab any touches rom QS at any time to collapse the shade.
70      * We should disallow that in case we are showing the detail panel.
71      */
disallowPanelTouches()72     default boolean disallowPanelTouches() {
73         return isShowingDetail();
74     }
75 
76     /**
77      * If QS should translate as we pull it down, or if it should be static.
78      */
setTranslateWhileExpanding(boolean shouldTranslate)79     void setTranslateWhileExpanding(boolean shouldTranslate);
80 
81     /**
82      * Set the amount of pixels we have currently dragged down if we're transitioning to the full
83      * shade. 0.0f means we're not transitioning yet.
84      */
setTransitionToFullShadeAmount(float pxAmount, boolean animated)85     default void setTransitionToFullShadeAmount(float pxAmount, boolean animated) {}
86 
87     /**
88      * A rounded corner clipping that makes QS feel as if it were behind everything.
89      */
setFancyClipping(int top, int bottom, int cornerRadius, boolean visible)90     void setFancyClipping(int top, int bottom, int cornerRadius, boolean visible);
91 
92     /**
93      * @return if quick settings is fully collapsed currently
94      */
isFullyCollapsed()95     default boolean isFullyCollapsed() {
96         return true;
97     }
98 
99     /**
100      * Add a listener for when the collapsed media visibility changes.
101      */
setCollapsedMediaVisibilityChangedListener(Consumer<Boolean> listener)102     void setCollapsedMediaVisibilityChangedListener(Consumer<Boolean> listener);
103 
104     /**
105      * Set a scroll listener for the QSPanel container
106      */
setScrollListener(ScrollListener scrollListener)107     default void setScrollListener(ScrollListener scrollListener) {}
108 
109     /**
110      * Callback for when QSPanel container is scrolled
111      */
112     @ProvidesInterface(version = ScrollListener.VERSION)
113     interface ScrollListener {
114         int VERSION = 1;
onQsPanelScrollChanged(int scrollY)115         void onQsPanelScrollChanged(int scrollY);
116     }
117 
118     @ProvidesInterface(version = HeightListener.VERSION)
119     interface HeightListener {
120         int VERSION = 1;
onQsHeightChanged()121         void onQsHeightChanged();
122     }
123 
124 }
125