Home | History | Annotate | Download | only in qs
      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 = 6;
     38 
     39     String TAG = "QS";
     40 
     41     void setPanelView(HeightListener notificationPanelView);
     42 
     43     void hideImmediately();
     44     int getQsMinExpansionHeight();
     45     int getDesiredHeight();
     46     void setHeightOverride(int desiredHeight);
     47     void setHeaderClickable(boolean qsExpansionEnabled);
     48     boolean isCustomizing();
     49     void setOverscrolling(boolean overscrolling);
     50     void setExpanded(boolean qsExpanded);
     51     void setListening(boolean listening);
     52     boolean isShowingDetail();
     53     void closeDetail();
     54     void setKeyguardShowing(boolean keyguardShowing);
     55     void animateHeaderSlidingIn(long delay);
     56     void animateHeaderSlidingOut();
     57     void setQsExpansion(float qsExpansionFraction, float headerTranslation);
     58     void setHeaderListening(boolean listening);
     59     void notifyCustomizeChanged();
     60 
     61     void setContainer(ViewGroup container);
     62     void setExpandClickListener(OnClickListener onClickListener);
     63 
     64     View getHeader();
     65 
     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      */
     77     default boolean onInterceptTouchEvent(MotionEvent event) {
     78         return isCustomizing();
     79     }
     80 
     81     @ProvidesInterface(version = HeightListener.VERSION)
     82     interface HeightListener {
     83         int VERSION = 1;
     84         void onQsHeightChanged();
     85     }
     86 
     87 }
     88