QS.java revision 9c7844cb91b43929d0a86b1c90aa1efb37f5463a
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 15package com.android.systemui.plugins.qs; 16 17import android.annotation.NonNull; 18import android.annotation.Nullable; 19import android.app.PendingIntent; 20import android.content.Context; 21import android.content.Intent; 22import android.util.AttributeSet; 23import android.view.View; 24import android.view.ViewGroup; 25import android.widget.FrameLayout; 26import android.widget.RelativeLayout; 27 28import com.android.systemui.plugins.FragmentBase; 29 30/** 31 * Fragment that contains QS in the notification shade. Most of the interface is for 32 * handling the expand/collapsing of the view interaction. 33 */ 34public interface QS extends FragmentBase { 35 36 public static final String ACTION = "com.android.systemui.action.PLUGIN_QS"; 37 38 // This should be incremented any time this class or ActivityStarter or BaseStatusBarHeader 39 // change in incompatible ways. 40 public static final int VERSION = 5; 41 42 String TAG = "QS"; 43 44 public abstract void setPanelView(HeightListener notificationPanelView); 45 public abstract BaseStatusBarHeader getHeader(); 46 47 public abstract void hideImmediately(); 48 public abstract int getQsMinExpansionHeight(); 49 public abstract int getDesiredHeight(); 50 public abstract void setHeightOverride(int desiredHeight); 51 public abstract void setHeaderClickable(boolean qsExpansionEnabled); 52 public abstract boolean isCustomizing(); 53 public abstract void setOverscrolling(boolean overscrolling); 54 public abstract void setExpanded(boolean qsExpanded); 55 public abstract void setListening(boolean listening); 56 public abstract boolean isShowingDetail(); 57 public abstract void closeDetail(); 58 public abstract void setKeyguardShowing(boolean keyguardShowing); 59 public abstract void animateHeaderSlidingIn(long delay); 60 public abstract void animateHeaderSlidingOut(); 61 public abstract void setQsExpansion(float qsExpansionFraction, float headerTranslation); 62 public abstract void setHeaderListening(boolean listening); 63 public abstract void notifyCustomizeChanged(); 64 65 public abstract void setContainer(ViewGroup container); 66 67 public interface HeightListener { 68 void onQsHeightChanged(); 69 } 70 71 public interface Callback { 72 void onShowingDetail(DetailAdapter detail, int x, int y); 73 void onToggleStateChanged(boolean state); 74 void onScanStateChanged(boolean state); 75 } 76 77 public interface DetailAdapter { 78 CharSequence getTitle(); 79 Boolean getToggleState(); 80 default boolean getToggleEnabled() { 81 return true; 82 } 83 View createDetailView(Context context, View convertView, ViewGroup parent); 84 Intent getSettingsIntent(); 85 void setToggleState(boolean state); 86 int getMetricsCategory(); 87 88 /** 89 * Indicates whether the detail view wants to have its header (back button, title and 90 * toggle) shown. 91 */ 92 default boolean hasHeader() { return true; } 93 } 94 95 public abstract static class BaseStatusBarHeader extends RelativeLayout { 96 97 public BaseStatusBarHeader(Context context, AttributeSet attrs) { 98 super(context, attrs); 99 } 100 101 public abstract int getCollapsedHeight(); 102 public abstract int getExpandedHeight(); 103 104 public abstract void setExpanded(boolean b); 105 public abstract void setExpansion(float headerExpansionFraction); 106 public abstract void setListening(boolean listening); 107 public abstract void updateEverything(); 108 public abstract void setCallback(Callback qsPanelCallback); 109 public abstract View getExpandView(); 110 } 111 112} 113