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.MotionEvent; 18 import android.view.View; 19 import android.view.View.OnClickListener; 20 import android.view.ViewGroup; 21 22 import com.android.systemui.plugins.FragmentBase; 23 import com.android.systemui.plugins.annotations.DependsOn; 24 import com.android.systemui.plugins.annotations.ProvidesInterface; 25 import com.android.systemui.plugins.qs.QS.HeightListener; 26 27 /** 28 * Fragment that contains QS in the notification shade. Most of the interface is for 29 * handling the expand/collapsing of the view interaction. 30 */ 31 @ProvidesInterface(action = QS.ACTION, version = QS.VERSION) 32 @DependsOn(target = HeightListener.class) 33 public interface QS extends FragmentBase { 34 35 String ACTION = "com.android.systemui.action.PLUGIN_QS"; 36 37 int VERSION = 7; 38 39 String TAG = "QS"; 40 setPanelView(HeightListener notificationPanelView)41 void setPanelView(HeightListener notificationPanelView); 42 hideImmediately()43 void hideImmediately(); getQsMinExpansionHeight()44 int getQsMinExpansionHeight(); getDesiredHeight()45 int getDesiredHeight(); setHeightOverride(int desiredHeight)46 void setHeightOverride(int desiredHeight); setHeaderClickable(boolean qsExpansionEnabled)47 void setHeaderClickable(boolean qsExpansionEnabled); isCustomizing()48 boolean isCustomizing(); setOverscrolling(boolean overscrolling)49 void setOverscrolling(boolean overscrolling); setExpanded(boolean qsExpanded)50 void setExpanded(boolean qsExpanded); setListening(boolean listening)51 void setListening(boolean listening); isShowingDetail()52 boolean isShowingDetail(); closeDetail()53 void closeDetail(); setShowCollapsedOnKeyguard(boolean showCollapsedOnKeyguard)54 default void setShowCollapsedOnKeyguard(boolean showCollapsedOnKeyguard) {} animateHeaderSlidingIn(long delay)55 void animateHeaderSlidingIn(long delay); animateHeaderSlidingOut()56 void animateHeaderSlidingOut(); setQsExpansion(float qsExpansionFraction, float headerTranslation)57 void setQsExpansion(float qsExpansionFraction, float headerTranslation); setHeaderListening(boolean listening)58 void setHeaderListening(boolean listening); notifyCustomizeChanged()59 void notifyCustomizeChanged(); 60 setContainer(ViewGroup container)61 void setContainer(ViewGroup container); setExpandClickListener(OnClickListener onClickListener)62 void setExpandClickListener(OnClickListener onClickListener); 63 getHeader()64 View getHeader(); 65 setHasNotifications(boolean hasNotifications)66 default void setHasNotifications(boolean hasNotifications) { 67 } 68 69 /** 70 * We need this to handle nested scrolling for QS.. 71 * Normally we would do this with requestDisallowInterceptTouchEvent, but when both the 72 * scroll containers are using the same touch slop, they try to start scrolling at the 73 * same time and NotificationPanelView wins, this lets QS win. 74 * 75 * TODO: Do this using NestedScroll capabilities. 76 */ onInterceptTouchEvent(MotionEvent event)77 default boolean onInterceptTouchEvent(MotionEvent event) { 78 return isCustomizing(); 79 } 80 81 @ProvidesInterface(version = HeightListener.VERSION) 82 interface HeightListener { 83 int VERSION = 1; onQsHeightChanged()84 void onQsHeightChanged(); 85 } 86 87 } 88