John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 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.qs; |
| 18 | |
Jason Monk | 7e53f20 | 2016-01-28 10:40:20 -0500 | [diff] [blame] | 19 | import android.content.ComponentName; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 20 | import android.content.Context; |
Jorim Jaggi | e17c4b4 | 2014-08-26 17:27:31 +0200 | [diff] [blame] | 21 | import android.content.res.Configuration; |
John Spurlock | 4bf3198 | 2014-05-21 13:04:22 -0400 | [diff] [blame] | 22 | import android.content.res.Resources; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 23 | import android.os.Handler; |
| 24 | import android.os.Message; |
| 25 | import android.util.AttributeSet; |
John Spurlock | 7f8f22a | 2014-07-02 18:54:17 -0400 | [diff] [blame] | 26 | import android.view.LayoutInflater; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 27 | import android.view.View; |
Jorim Jaggi | 3f48f46 | 2014-07-08 16:53:29 +0200 | [diff] [blame] | 28 | import android.widget.ImageView; |
Jason Monk | 520ea06 | 2015-08-18 14:53:06 -0400 | [diff] [blame] | 29 | import android.widget.LinearLayout; |
Chris Wren | 457a21c | 2015-05-06 17:50:34 -0400 | [diff] [blame] | 30 | import com.android.internal.logging.MetricsLogger; |
Tamas Berghammer | 383db5eb | 2016-06-22 15:21:38 +0100 | [diff] [blame] | 31 | import com.android.internal.logging.nano.MetricsProto.MetricsEvent; |
Jason Monk | de850bb | 2017-02-01 19:26:30 -0500 | [diff] [blame] | 32 | import com.android.systemui.Dependency; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 33 | import com.android.systemui.R; |
Jason Monk | 0ceef21 | 2016-11-02 14:05:23 -0400 | [diff] [blame] | 34 | import com.android.systemui.plugins.qs.QS; |
| 35 | import com.android.systemui.plugins.qs.QS.DetailAdapter; |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame^] | 36 | import com.android.systemui.plugins.qs.QSTile; |
| 37 | import com.android.systemui.plugins.qs.QSTileView; |
| 38 | import com.android.systemui.qs.QSHost.Callback; |
Jason Monk | bd6dbb0 | 2015-09-03 15:46:25 -0400 | [diff] [blame] | 39 | import com.android.systemui.qs.customize.QSCustomizer; |
Jason Monk | 7e53f20 | 2016-01-28 10:40:20 -0500 | [diff] [blame] | 40 | import com.android.systemui.qs.external.CustomTile; |
Jorim Jaggi | 3f48f46 | 2014-07-08 16:53:29 +0200 | [diff] [blame] | 41 | import com.android.systemui.settings.BrightnessController; |
Muyuan Li | 3b0f892 | 2016-04-18 19:27:29 -0700 | [diff] [blame] | 42 | import com.android.systemui.settings.ToggleSliderView; |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 43 | import com.android.systemui.statusbar.phone.QSTileHost; |
Adrian Roos | 5fd872e | 2014-08-12 17:28:58 +0200 | [diff] [blame] | 44 | import com.android.systemui.statusbar.policy.BrightnessMirrorController; |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 45 | import com.android.systemui.tuner.TunerService; |
| 46 | import com.android.systemui.tuner.TunerService.Tunable; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 47 | |
| 48 | import java.util.ArrayList; |
John Spurlock | bceed06 | 2014-08-10 18:04:16 -0400 | [diff] [blame] | 49 | import java.util.Collection; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 50 | |
| 51 | /** View that represents the quick settings tile panel. **/ |
Jason Monk | 46dbfb4 | 2016-02-25 14:59:20 -0500 | [diff] [blame] | 52 | public class QSPanel extends LinearLayout implements Tunable, Callback { |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 53 | |
| 54 | public static final String QS_SHOW_BRIGHTNESS = "qs_show_brightness"; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 55 | |
Jason Monk | bd6dbb0 | 2015-09-03 15:46:25 -0400 | [diff] [blame] | 56 | protected final Context mContext; |
Jason Monk | 11a7744 | 2015-05-12 19:29:02 -0400 | [diff] [blame] | 57 | protected final ArrayList<TileRecord> mRecords = new ArrayList<TileRecord>(); |
Jason Monk | 11a7744 | 2015-05-12 19:29:02 -0400 | [diff] [blame] | 58 | protected final View mBrightnessView; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 59 | private final H mHandler = new H(); |
Jason Monk | 3250885 | 2017-01-18 09:17:13 -0500 | [diff] [blame] | 60 | private final View mPageIndicator; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 61 | |
John Spurlock | 92d9b19 | 2014-06-29 12:54:24 -0400 | [diff] [blame] | 62 | private int mPanelPaddingBottom; |
Adrian Roos | cd542b8 | 2014-08-12 22:25:35 +0200 | [diff] [blame] | 63 | private int mBrightnessPaddingTop; |
Muyuan Li | 0e9f538 | 2016-04-27 15:51:15 -0700 | [diff] [blame] | 64 | protected boolean mExpanded; |
Jason Monk | 1bec6af | 2016-05-31 15:40:58 -0400 | [diff] [blame] | 65 | protected boolean mListening; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 66 | |
Jason Monk | 0ceef21 | 2016-11-02 14:05:23 -0400 | [diff] [blame] | 67 | private QS.Callback mCallback; |
Jorim Jaggi | 3f48f46 | 2014-07-08 16:53:29 +0200 | [diff] [blame] | 68 | private BrightnessController mBrightnessController; |
Jason Monk | bbadff8 | 2015-11-06 15:47:26 -0500 | [diff] [blame] | 69 | protected QSTileHost mHost; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 70 | |
Jason Monk | bbadff8 | 2015-11-06 15:47:26 -0500 | [diff] [blame] | 71 | protected QSFooter mFooter; |
Selim Cinek | e32010a | 2014-08-20 23:50:41 +0200 | [diff] [blame] | 72 | private boolean mGridContentVisible = true; |
Jason Monk | 3d5f551 | 2014-07-25 11:17:28 -0400 | [diff] [blame] | 73 | |
Jason Monk | bd6dbb0 | 2015-09-03 15:46:25 -0400 | [diff] [blame] | 74 | protected QSTileLayout mTileLayout; |
| 75 | |
| 76 | private QSCustomizer mCustomizePanel; |
Jason Monk | 377e7ad | 2016-02-16 14:03:21 -0500 | [diff] [blame] | 77 | private Record mDetailRecord; |
Jason Monk | 520ea06 | 2015-08-18 14:53:06 -0400 | [diff] [blame] | 78 | |
Adrian Roos | 429c962 | 2016-06-15 13:02:17 -0700 | [diff] [blame] | 79 | private BrightnessMirrorController mBrightnessMirrorController; |
| 80 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 81 | public QSPanel(Context context) { |
| 82 | this(context, null); |
| 83 | } |
| 84 | |
| 85 | public QSPanel(Context context, AttributeSet attrs) { |
| 86 | super(context, attrs); |
| 87 | mContext = context; |
| 88 | |
Jason Monk | 162011e | 2016-02-19 08:11:55 -0500 | [diff] [blame] | 89 | setOrientation(VERTICAL); |
Jason Monk | 520ea06 | 2015-08-18 14:53:06 -0400 | [diff] [blame] | 90 | |
Jason Monk | f13413e | 2017-02-15 15:49:32 -0500 | [diff] [blame] | 91 | mBrightnessView = LayoutInflater.from(context).inflate( |
| 92 | R.layout.quick_settings_brightness_dialog, this, false); |
| 93 | addView(mBrightnessView); |
| 94 | |
Xiaohui Chen | 2f3551b | 2016-04-07 10:37:25 -0700 | [diff] [blame] | 95 | setupTileLayout(); |
Jason Monk | deba7a4 | 2015-12-08 16:14:10 -0500 | [diff] [blame] | 96 | |
| 97 | mFooter = new QSFooter(this, context); |
Jason Monk | 162011e | 2016-02-19 08:11:55 -0500 | [diff] [blame] | 98 | addView(mFooter.getView()); |
Jason Monk | deba7a4 | 2015-12-08 16:14:10 -0500 | [diff] [blame] | 99 | |
Jason Monk | 3250885 | 2017-01-18 09:17:13 -0500 | [diff] [blame] | 100 | mPageIndicator = LayoutInflater.from(context).inflate( |
| 101 | R.layout.qs_page_indicator, this, false); |
| 102 | addView(mPageIndicator); |
| 103 | if (mTileLayout instanceof PagedTileLayout) { |
| 104 | ((PagedTileLayout) mTileLayout).setPageIndicator((PageIndicator) mPageIndicator); |
| 105 | } |
| 106 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 107 | updateResources(); |
Jorim Jaggi | 3f48f46 | 2014-07-08 16:53:29 +0200 | [diff] [blame] | 108 | |
| 109 | mBrightnessController = new BrightnessController(getContext(), |
| 110 | (ImageView) findViewById(R.id.brightness_icon), |
Muyuan Li | 3b0f892 | 2016-04-18 19:27:29 -0700 | [diff] [blame] | 111 | (ToggleSliderView) findViewById(R.id.brightness_slider)); |
Jason Monk | 3250885 | 2017-01-18 09:17:13 -0500 | [diff] [blame] | 112 | } |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 113 | |
Jason Monk | 3250885 | 2017-01-18 09:17:13 -0500 | [diff] [blame] | 114 | public View getPageIndicator() { |
| 115 | return mPageIndicator; |
Jason Monk | 377e7ad | 2016-02-16 14:03:21 -0500 | [diff] [blame] | 116 | } |
| 117 | |
Xiaohui Chen | 2f3551b | 2016-04-07 10:37:25 -0700 | [diff] [blame] | 118 | protected void setupTileLayout() { |
| 119 | mTileLayout = (QSTileLayout) LayoutInflater.from(mContext).inflate( |
| 120 | R.layout.qs_paged_tile_layout, this, false); |
Jason Monk | 1bec6af | 2016-05-31 15:40:58 -0400 | [diff] [blame] | 121 | mTileLayout.setListening(mListening); |
Xiaohui Chen | 2f3551b | 2016-04-07 10:37:25 -0700 | [diff] [blame] | 122 | addView((View) mTileLayout); |
Xiaohui Chen | 2f3551b | 2016-04-07 10:37:25 -0700 | [diff] [blame] | 123 | } |
| 124 | |
Jason Monk | 377e7ad | 2016-02-16 14:03:21 -0500 | [diff] [blame] | 125 | public boolean isShowingCustomize() { |
| 126 | return mCustomizePanel != null && mCustomizePanel.isCustomizing(); |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 127 | } |
| 128 | |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 129 | @Override |
| 130 | protected void onAttachedToWindow() { |
| 131 | super.onAttachedToWindow(); |
Jason Monk | de850bb | 2017-02-01 19:26:30 -0500 | [diff] [blame] | 132 | Dependency.get(TunerService.class).addTunable(this, QS_SHOW_BRIGHTNESS); |
Jason Monk | f160edca | 2016-03-30 13:48:56 -0400 | [diff] [blame] | 133 | if (mHost != null) { |
| 134 | setTiles(mHost.getTiles()); |
| 135 | } |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | @Override |
| 139 | protected void onDetachedFromWindow() { |
Jason Monk | de850bb | 2017-02-01 19:26:30 -0500 | [diff] [blame] | 140 | Dependency.get(TunerService.class).removeTunable(this); |
| 141 | if (mHost != null) { |
| 142 | mHost.removeCallback(this); |
| 143 | } |
Jason Monk | f160edca | 2016-03-30 13:48:56 -0400 | [diff] [blame] | 144 | for (TileRecord record : mRecords) { |
| 145 | record.tile.removeCallbacks(); |
| 146 | } |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 147 | super.onDetachedFromWindow(); |
| 148 | } |
| 149 | |
| 150 | @Override |
Jason Monk | 46dbfb4 | 2016-02-25 14:59:20 -0500 | [diff] [blame] | 151 | public void onTilesChanged() { |
| 152 | setTiles(mHost.getTiles()); |
| 153 | } |
| 154 | |
| 155 | @Override |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 156 | public void onTuningChanged(String key, String newValue) { |
| 157 | if (QS_SHOW_BRIGHTNESS.equals(key)) { |
| 158 | mBrightnessView.setVisibility(newValue == null || Integer.parseInt(newValue) != 0 |
| 159 | ? VISIBLE : GONE); |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 160 | } |
| 161 | } |
| 162 | |
Jason Monk | a992732 | 2015-12-13 16:22:37 -0500 | [diff] [blame] | 163 | public void openDetails(String subPanel) { |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame^] | 164 | QSTile tile = getTile(subPanel); |
Jason Monk | a992732 | 2015-12-13 16:22:37 -0500 | [diff] [blame] | 165 | showDetailAdapter(true, tile.getDetailAdapter(), new int[] {getWidth() / 2, 0}); |
| 166 | } |
| 167 | |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame^] | 168 | private QSTile getTile(String subPanel) { |
Jason Monk | a992732 | 2015-12-13 16:22:37 -0500 | [diff] [blame] | 169 | for (int i = 0; i < mRecords.size(); i++) { |
| 170 | if (subPanel.equals(mRecords.get(i).tile.getTileSpec())) { |
| 171 | return mRecords.get(i).tile; |
| 172 | } |
| 173 | } |
| 174 | return mHost.createTile(subPanel); |
| 175 | } |
| 176 | |
Adrian Roos | 5fd872e | 2014-08-12 17:28:58 +0200 | [diff] [blame] | 177 | public void setBrightnessMirror(BrightnessMirrorController c) { |
Adrian Roos | 429c962 | 2016-06-15 13:02:17 -0700 | [diff] [blame] | 178 | mBrightnessMirrorController = c; |
Muyuan Li | 3b0f892 | 2016-04-18 19:27:29 -0700 | [diff] [blame] | 179 | ToggleSliderView brightnessSlider = (ToggleSliderView) findViewById(R.id.brightness_slider); |
| 180 | ToggleSliderView mirror = (ToggleSliderView) c.getMirror().findViewById( |
| 181 | R.id.brightness_slider); |
Adrian Roos | 5fd872e | 2014-08-12 17:28:58 +0200 | [diff] [blame] | 182 | brightnessSlider.setMirror(mirror); |
| 183 | brightnessSlider.setMirrorController(c); |
| 184 | } |
| 185 | |
Jason Monk | b46059a | 2016-06-30 14:22:42 -0400 | [diff] [blame] | 186 | View getBrightnessView() { |
| 187 | return mBrightnessView; |
| 188 | } |
| 189 | |
Jason Monk | 0ceef21 | 2016-11-02 14:05:23 -0400 | [diff] [blame] | 190 | public void setCallback(QS.Callback callback) { |
John Spurlock | 5729d09 | 2014-05-29 17:42:51 -0400 | [diff] [blame] | 191 | mCallback = callback; |
| 192 | } |
| 193 | |
Jason Monk | 8b9d67f | 2016-03-02 08:59:08 -0500 | [diff] [blame] | 194 | public void setHost(QSTileHost host, QSCustomizer customizer) { |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 195 | mHost = host; |
Jason Monk | 46dbfb4 | 2016-02-25 14:59:20 -0500 | [diff] [blame] | 196 | mHost.addCallback(this); |
| 197 | setTiles(mHost.getTiles()); |
Jason Monk | 9c7844c | 2017-01-18 15:21:53 -0500 | [diff] [blame] | 198 | mFooter.setHostEnvironment(host); |
Jason Monk | 8b9d67f | 2016-03-02 08:59:08 -0500 | [diff] [blame] | 199 | mCustomizePanel = customizer; |
| 200 | if (mCustomizePanel != null) { |
| 201 | mCustomizePanel.setHost(mHost); |
| 202 | } |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 203 | } |
| 204 | |
Adrian Roos | 00a0b1f | 2014-07-16 16:44:49 +0200 | [diff] [blame] | 205 | public QSTileHost getHost() { |
| 206 | return mHost; |
| 207 | } |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 208 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 209 | public void updateResources() { |
John Spurlock | 4bf3198 | 2014-05-21 13:04:22 -0400 | [diff] [blame] | 210 | final Resources res = mContext.getResources(); |
John Spurlock | 92d9b19 | 2014-06-29 12:54:24 -0400 | [diff] [blame] | 211 | mPanelPaddingBottom = res.getDimensionPixelSize(R.dimen.qs_panel_padding_bottom); |
Adrian Roos | cd542b8 | 2014-08-12 22:25:35 +0200 | [diff] [blame] | 212 | mBrightnessPaddingTop = res.getDimensionPixelSize(R.dimen.qs_brightness_padding_top); |
Jason Monk | 162011e | 2016-02-19 08:11:55 -0500 | [diff] [blame] | 213 | setPadding(0, mBrightnessPaddingTop, 0, mPanelPaddingBottom); |
Jason Monk | a758ba6 | 2015-07-14 12:29:28 -0400 | [diff] [blame] | 214 | for (TileRecord r : mRecords) { |
| 215 | r.tile.clearState(); |
| 216 | } |
John Spurlock | 1a462c1 | 2014-07-14 10:52:01 -0400 | [diff] [blame] | 217 | if (mListening) { |
| 218 | refreshAllTiles(); |
| 219 | } |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 220 | if (mTileLayout != null) { |
| 221 | mTileLayout.updateResources(); |
| 222 | } |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 223 | } |
| 224 | |
Jorim Jaggi | e17c4b4 | 2014-08-26 17:27:31 +0200 | [diff] [blame] | 225 | @Override |
| 226 | protected void onConfigurationChanged(Configuration newConfig) { |
| 227 | super.onConfigurationChanged(newConfig); |
Jorim Jaggi | e17c4b4 | 2014-08-26 17:27:31 +0200 | [diff] [blame] | 228 | mFooter.onConfigurationChanged(); |
Adrian Roos | 429c962 | 2016-06-15 13:02:17 -0700 | [diff] [blame] | 229 | |
| 230 | if (mBrightnessMirrorController != null) { |
| 231 | // Reload the mirror in case it got reinflated but we didn't. |
| 232 | setBrightnessMirror(mBrightnessMirrorController); |
| 233 | } |
Jorim Jaggi | e17c4b4 | 2014-08-26 17:27:31 +0200 | [diff] [blame] | 234 | } |
| 235 | |
Jason Monk | bd6dbb0 | 2015-09-03 15:46:25 -0400 | [diff] [blame] | 236 | public void onCollapse() { |
Yoshinori Hirano | 1dd7d07 | 2016-09-05 16:11:59 +0900 | [diff] [blame] | 237 | if (mCustomizePanel != null && mCustomizePanel.isShown()) { |
Jason Monk | b9c0019 | 2015-10-07 11:45:33 -0400 | [diff] [blame] | 238 | mCustomizePanel.hide(mCustomizePanel.getWidth() / 2, mCustomizePanel.getHeight() / 2); |
Jason Monk | bd6dbb0 | 2015-09-03 15:46:25 -0400 | [diff] [blame] | 239 | } |
| 240 | } |
| 241 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 242 | public void setExpanded(boolean expanded) { |
John Spurlock | 5729d09 | 2014-05-29 17:42:51 -0400 | [diff] [blame] | 243 | if (mExpanded == expanded) return; |
| 244 | mExpanded = expanded; |
Jason Monk | 162011e | 2016-02-19 08:11:55 -0500 | [diff] [blame] | 245 | if (!mExpanded && mTileLayout instanceof PagedTileLayout) { |
| 246 | ((PagedTileLayout) mTileLayout).setCurrentItem(0, false); |
| 247 | } |
Chris Wren | 77781d3 | 2016-01-11 14:49:26 -0500 | [diff] [blame] | 248 | MetricsLogger.visibility(mContext, MetricsEvent.QS_PANEL, mExpanded); |
John Spurlock | 5729d09 | 2014-05-29 17:42:51 -0400 | [diff] [blame] | 249 | if (!mExpanded) { |
John Spurlock | f7ae442 | 2014-08-01 12:45:18 -0400 | [diff] [blame] | 250 | closeDetail(); |
Chris Wren | 457a21c | 2015-05-06 17:50:34 -0400 | [diff] [blame] | 251 | } else { |
| 252 | logTiles(); |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 253 | } |
Jorim Jaggi | e65e310 | 2014-07-01 22:00:50 +0200 | [diff] [blame] | 254 | } |
| 255 | |
Muyuan Li | 0e9f538 | 2016-04-27 15:51:15 -0700 | [diff] [blame] | 256 | public boolean isExpanded() { |
| 257 | return mExpanded; |
| 258 | } |
| 259 | |
Jorim Jaggi | e65e310 | 2014-07-01 22:00:50 +0200 | [diff] [blame] | 260 | public void setListening(boolean listening) { |
| 261 | if (mListening == listening) return; |
| 262 | mListening = listening; |
Jason Monk | 1bec6af | 2016-05-31 15:40:58 -0400 | [diff] [blame] | 263 | if (mTileLayout != null) { |
| 264 | mTileLayout.setListening(listening); |
John Spurlock | 1a462c1 | 2014-07-14 10:52:01 -0400 | [diff] [blame] | 265 | } |
Jason Monk | 3d5f551 | 2014-07-25 11:17:28 -0400 | [diff] [blame] | 266 | mFooter.setListening(mListening); |
John Spurlock | 1a462c1 | 2014-07-14 10:52:01 -0400 | [diff] [blame] | 267 | if (mListening) { |
| 268 | refreshAllTiles(); |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 269 | } |
Jason Monk | b5ece9a | 2016-04-22 11:40:36 -0400 | [diff] [blame] | 270 | if (mBrightnessView.getVisibility() == View.VISIBLE) { |
| 271 | if (listening) { |
| 272 | mBrightnessController.registerCallbacks(); |
| 273 | } else { |
| 274 | mBrightnessController.unregisterCallbacks(); |
| 275 | } |
Jorim Jaggi | 3f48f46 | 2014-07-08 16:53:29 +0200 | [diff] [blame] | 276 | } |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 277 | } |
| 278 | |
Jorim Jaggi | 1ecd7cd | 2014-11-03 16:18:03 +0100 | [diff] [blame] | 279 | public void refreshAllTiles() { |
John Spurlock | 1a462c1 | 2014-07-14 10:52:01 -0400 | [diff] [blame] | 280 | for (TileRecord r : mRecords) { |
| 281 | r.tile.refreshState(); |
| 282 | } |
Jason Monk | 3d5f551 | 2014-07-25 11:17:28 -0400 | [diff] [blame] | 283 | mFooter.refreshState(); |
John Spurlock | 1a462c1 | 2014-07-14 10:52:01 -0400 | [diff] [blame] | 284 | } |
| 285 | |
Adrian Roos | 970be53 | 2014-11-21 15:50:16 +0100 | [diff] [blame] | 286 | public void showDetailAdapter(boolean show, DetailAdapter adapter, int[] locationInWindow) { |
| 287 | int xInWindow = locationInWindow[0]; |
| 288 | int yInWindow = locationInWindow[1]; |
Jason Monk | 377e7ad | 2016-02-16 14:03:21 -0500 | [diff] [blame] | 289 | ((View) getParent()).getLocationInWindow(locationInWindow); |
Adrian Roos | 970be53 | 2014-11-21 15:50:16 +0100 | [diff] [blame] | 290 | |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 291 | Record r = new Record(); |
| 292 | r.detailAdapter = adapter; |
Adrian Roos | 970be53 | 2014-11-21 15:50:16 +0100 | [diff] [blame] | 293 | r.x = xInWindow - locationInWindow[0]; |
| 294 | r.y = yInWindow - locationInWindow[1]; |
| 295 | |
| 296 | locationInWindow[0] = xInWindow; |
| 297 | locationInWindow[1] = yInWindow; |
| 298 | |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 299 | showDetail(show, r); |
| 300 | } |
| 301 | |
Jason Monk | dc35dcb | 2015-12-04 16:36:15 -0500 | [diff] [blame] | 302 | protected void showDetail(boolean show, Record r) { |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 303 | mHandler.obtainMessage(H.SHOW_DETAIL, show ? 1 : 0, 0, r).sendToTarget(); |
| 304 | } |
| 305 | |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame^] | 306 | public void setTiles(Collection<QSTile> tiles) { |
Julia Reynolds | 20aef8a | 2016-05-04 16:44:08 -0400 | [diff] [blame] | 307 | setTiles(tiles, false); |
| 308 | } |
| 309 | |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame^] | 310 | public void setTiles(Collection<QSTile> tiles, boolean collapsedView) { |
John Spurlock | bceed06 | 2014-08-10 18:04:16 -0400 | [diff] [blame] | 311 | for (TileRecord record : mRecords) { |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 312 | mTileLayout.removeTile(record); |
Xiaohui Chen | 08e266c | 2016-04-18 12:53:28 -0700 | [diff] [blame] | 313 | record.tile.removeCallback(record.callback); |
John Spurlock | bceed06 | 2014-08-10 18:04:16 -0400 | [diff] [blame] | 314 | } |
| 315 | mRecords.clear(); |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame^] | 316 | for (QSTile tile : tiles) { |
Julia Reynolds | 20aef8a | 2016-05-04 16:44:08 -0400 | [diff] [blame] | 317 | addTile(tile, collapsedView); |
John Spurlock | bceed06 | 2014-08-10 18:04:16 -0400 | [diff] [blame] | 318 | } |
John Spurlock | bceed06 | 2014-08-10 18:04:16 -0400 | [diff] [blame] | 319 | } |
| 320 | |
Jason Monk | ec87a87 | 2016-03-01 15:00:16 -0500 | [diff] [blame] | 321 | protected void drawTile(TileRecord r, QSTile.State state) { |
John Spurlock | 20c8905 | 2015-05-11 13:11:24 -0400 | [diff] [blame] | 322 | r.tileView.onStateChanged(state); |
| 323 | } |
| 324 | |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame^] | 325 | protected QSTileView createTileView(QSTile tile, boolean collapsedView) { |
| 326 | return mHost.createTileView(tile, collapsedView); |
Jason Monk | dc35dcb | 2015-12-04 16:36:15 -0500 | [diff] [blame] | 327 | } |
| 328 | |
Xiaohui Chen | 6644893 | 2016-04-18 12:53:28 -0700 | [diff] [blame] | 329 | protected boolean shouldShowDetail() { |
| 330 | return mExpanded; |
| 331 | } |
| 332 | |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame^] | 333 | protected TileRecord addTile(final QSTile tile, boolean collapsedView) { |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 334 | final TileRecord r = new TileRecord(); |
| 335 | r.tile = tile; |
Julia Reynolds | 20aef8a | 2016-05-04 16:44:08 -0400 | [diff] [blame] | 336 | r.tileView = createTileView(tile, collapsedView); |
John Spurlock | bceed06 | 2014-08-10 18:04:16 -0400 | [diff] [blame] | 337 | final QSTile.Callback callback = new QSTile.Callback() { |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 338 | @Override |
| 339 | public void onStateChanged(QSTile.State state) { |
Jason Monk | 377e7ad | 2016-02-16 14:03:21 -0500 | [diff] [blame] | 340 | drawTile(r, state); |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 341 | } |
Jason Monk | ca894a0 | 2016-01-12 15:30:22 -0500 | [diff] [blame] | 342 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 343 | @Override |
| 344 | public void onShowDetail(boolean show) { |
Xiaohui Chen | 6644893 | 2016-04-18 12:53:28 -0700 | [diff] [blame] | 345 | // Both the collapsed and full QS panels get this callback, this check determines |
| 346 | // which one should handle showing the detail. |
| 347 | if (shouldShowDetail()) { |
| 348 | QSPanel.this.showDetail(show, r); |
| 349 | } |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 350 | } |
Jason Monk | ca894a0 | 2016-01-12 15:30:22 -0500 | [diff] [blame] | 351 | |
John Spurlock | 7f8f22a | 2014-07-02 18:54:17 -0400 | [diff] [blame] | 352 | @Override |
| 353 | public void onToggleStateChanged(boolean state) { |
| 354 | if (mDetailRecord == r) { |
| 355 | fireToggleStateChanged(state); |
| 356 | } |
| 357 | } |
Jason Monk | ca894a0 | 2016-01-12 15:30:22 -0500 | [diff] [blame] | 358 | |
John Spurlock | 486b78e | 2014-07-07 08:37:56 -0400 | [diff] [blame] | 359 | @Override |
| 360 | public void onScanStateChanged(boolean state) { |
John Spurlock | 465cefa | 2014-08-16 10:39:33 -0400 | [diff] [blame] | 361 | r.scanState = state; |
John Spurlock | 486b78e | 2014-07-07 08:37:56 -0400 | [diff] [blame] | 362 | if (mDetailRecord == r) { |
John Spurlock | 465cefa | 2014-08-16 10:39:33 -0400 | [diff] [blame] | 363 | fireScanStateChanged(r.scanState); |
John Spurlock | 486b78e | 2014-07-07 08:37:56 -0400 | [diff] [blame] | 364 | } |
| 365 | } |
Selim Cinek | 4fda7b2 | 2014-08-18 22:07:25 +0200 | [diff] [blame] | 366 | |
| 367 | @Override |
| 368 | public void onAnnouncementRequested(CharSequence announcement) { |
dooyoung.hwang | 1b00662 | 2016-12-22 20:04:20 +0900 | [diff] [blame] | 369 | if (announcement != null) { |
| 370 | mHandler.obtainMessage(H.ANNOUNCE_FOR_ACCESSIBILITY, announcement) |
| 371 | .sendToTarget(); |
| 372 | } |
Selim Cinek | 4fda7b2 | 2014-08-18 22:07:25 +0200 | [diff] [blame] | 373 | } |
John Spurlock | bceed06 | 2014-08-10 18:04:16 -0400 | [diff] [blame] | 374 | }; |
Jason Monk | ca894a0 | 2016-01-12 15:30:22 -0500 | [diff] [blame] | 375 | r.tile.addCallback(callback); |
Xiaohui Chen | 08e266c | 2016-04-18 12:53:28 -0700 | [diff] [blame] | 376 | r.callback = callback; |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame^] | 377 | r.tileView.init(r.tile); |
John Spurlock | ccb6b9a | 2014-05-17 15:54:40 -0400 | [diff] [blame] | 378 | r.tile.refreshState(); |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 379 | mRecords.add(r); |
| 380 | |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 381 | if (mTileLayout != null) { |
| 382 | mTileLayout.addTile(r); |
| 383 | } |
Muyuan Li | b40004b | 2016-05-11 14:47:29 -0700 | [diff] [blame] | 384 | |
| 385 | return r; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 386 | } |
| 387 | |
Jason Monk | 2142843 | 2016-02-10 16:42:38 -0500 | [diff] [blame] | 388 | |
Jason Monk | 4bb7b1a | 2016-05-27 15:19:15 -0400 | [diff] [blame] | 389 | public void showEdit(final View v) { |
Jason Monk | 2142843 | 2016-02-10 16:42:38 -0500 | [diff] [blame] | 390 | v.post(new Runnable() { |
| 391 | @Override |
| 392 | public void run() { |
| 393 | if (mCustomizePanel != null) { |
| 394 | if (!mCustomizePanel.isCustomizing()) { |
| 395 | int[] loc = new int[2]; |
| 396 | v.getLocationInWindow(loc); |
Jason Monk | 4bb7b1a | 2016-05-27 15:19:15 -0400 | [diff] [blame] | 397 | int x = loc[0] + v.getWidth() / 2; |
| 398 | int y = loc[1] + v.getHeight() / 2; |
Jason Monk | 2142843 | 2016-02-10 16:42:38 -0500 | [diff] [blame] | 399 | mCustomizePanel.show(x, y); |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | } |
| 404 | }); |
| 405 | } |
| 406 | |
John Spurlock | f7ae442 | 2014-08-01 12:45:18 -0400 | [diff] [blame] | 407 | public void closeDetail() { |
Yoshinori Hirano | 1dd7d07 | 2016-09-05 16:11:59 +0900 | [diff] [blame] | 408 | if (mCustomizePanel != null && mCustomizePanel.isShown()) { |
Jason Monk | bd6dbb0 | 2015-09-03 15:46:25 -0400 | [diff] [blame] | 409 | // Treat this as a detail panel for now, to make things easy. |
Jason Monk | b9c0019 | 2015-10-07 11:45:33 -0400 | [diff] [blame] | 410 | mCustomizePanel.hide(mCustomizePanel.getWidth() / 2, mCustomizePanel.getHeight() / 2); |
Jason Monk | bd6dbb0 | 2015-09-03 15:46:25 -0400 | [diff] [blame] | 411 | return; |
| 412 | } |
John Spurlock | f7ae442 | 2014-08-01 12:45:18 -0400 | [diff] [blame] | 413 | showDetail(false, mDetailRecord); |
| 414 | } |
| 415 | |
Jorim Jaggi | 8bc983e | 2014-12-10 17:45:50 +0100 | [diff] [blame] | 416 | public int getGridHeight() { |
Jason Monk | 162011e | 2016-02-19 08:11:55 -0500 | [diff] [blame] | 417 | return getMeasuredHeight(); |
Jorim Jaggi | 8bc983e | 2014-12-10 17:45:50 +0100 | [diff] [blame] | 418 | } |
| 419 | |
Jason Monk | dc35dcb | 2015-12-04 16:36:15 -0500 | [diff] [blame] | 420 | protected void handleShowDetail(Record r, boolean show) { |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 421 | if (r instanceof TileRecord) { |
| 422 | handleShowDetailTile((TileRecord) r, show); |
| 423 | } else { |
Adrian Roos | 970be53 | 2014-11-21 15:50:16 +0100 | [diff] [blame] | 424 | int x = 0; |
| 425 | int y = 0; |
| 426 | if (r != null) { |
| 427 | x = r.x; |
| 428 | y = r.y; |
| 429 | } |
| 430 | handleShowDetailImpl(r, show, x, y); |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 431 | } |
| 432 | } |
| 433 | |
| 434 | private void handleShowDetailTile(TileRecord r, boolean show) { |
Jason Monk | efe3d3f | 2015-06-10 16:48:03 -0400 | [diff] [blame] | 435 | if ((mDetailRecord != null) == show && mDetailRecord == r) return; |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 436 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 437 | if (show) { |
John Spurlock | 7f8f22a | 2014-07-02 18:54:17 -0400 | [diff] [blame] | 438 | r.detailAdapter = r.tile.getDetailAdapter(); |
| 439 | if (r.detailAdapter == null) return; |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 440 | } |
Jason Monk | 0d6a1c4 | 2015-04-20 16:38:51 -0400 | [diff] [blame] | 441 | r.tile.setDetailListening(show); |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 442 | int x = r.tileView.getLeft() + r.tileView.getWidth() / 2; |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame^] | 443 | int y = r.tileView.getDetailY() + mTileLayout.getOffsetTop(r) + getTop(); |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 444 | handleShowDetailImpl(r, show, x, y); |
| 445 | } |
| 446 | |
| 447 | private void handleShowDetailImpl(Record r, boolean show, int x, int y) { |
Jason Monk | 377e7ad | 2016-02-16 14:03:21 -0500 | [diff] [blame] | 448 | setDetailRecord(show ? r : null); |
| 449 | fireShowingDetail(show ? r.detailAdapter : null, x, y); |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 450 | } |
| 451 | |
Muyuan Li | 4074b46 | 2016-05-06 13:40:42 -0700 | [diff] [blame] | 452 | protected void setDetailRecord(Record r) { |
Jason Monk | 377e7ad | 2016-02-16 14:03:21 -0500 | [diff] [blame] | 453 | if (r == mDetailRecord) return; |
| 454 | mDetailRecord = r; |
| 455 | final boolean scanState = mDetailRecord instanceof TileRecord |
| 456 | && ((TileRecord) mDetailRecord).scanState; |
| 457 | fireScanStateChanged(scanState); |
| 458 | } |
| 459 | |
| 460 | void setGridContentVisibility(boolean visible) { |
Selim Cinek | e32010a | 2014-08-20 23:50:41 +0200 | [diff] [blame] | 461 | int newVis = visible ? VISIBLE : INVISIBLE; |
Jason Monk | 162011e | 2016-02-19 08:11:55 -0500 | [diff] [blame] | 462 | setVisibility(newVis); |
Chris Wren | 457a21c | 2015-05-06 17:50:34 -0400 | [diff] [blame] | 463 | if (mGridContentVisible != visible) { |
Chris Wren | 77781d3 | 2016-01-11 14:49:26 -0500 | [diff] [blame] | 464 | MetricsLogger.visibility(mContext, MetricsEvent.QS_PANEL, newVis); |
Chris Wren | 457a21c | 2015-05-06 17:50:34 -0400 | [diff] [blame] | 465 | } |
Selim Cinek | e32010a | 2014-08-20 23:50:41 +0200 | [diff] [blame] | 466 | mGridContentVisible = visible; |
| 467 | } |
| 468 | |
Chris Wren | 457a21c | 2015-05-06 17:50:34 -0400 | [diff] [blame] | 469 | private void logTiles() { |
| 470 | for (int i = 0; i < mRecords.size(); i++) { |
| 471 | TileRecord tileRecord = mRecords.get(i); |
Jason Monk | ba2318e | 2015-12-08 09:04:23 -0500 | [diff] [blame] | 472 | MetricsLogger.visible(mContext, tileRecord.tile.getMetricsCategory()); |
Chris Wren | 457a21c | 2015-05-06 17:50:34 -0400 | [diff] [blame] | 473 | } |
| 474 | } |
| 475 | |
Jason Monk | 377e7ad | 2016-02-16 14:03:21 -0500 | [diff] [blame] | 476 | private void fireShowingDetail(DetailAdapter detail, int x, int y) { |
John Spurlock | 5729d09 | 2014-05-29 17:42:51 -0400 | [diff] [blame] | 477 | if (mCallback != null) { |
Jason Monk | 377e7ad | 2016-02-16 14:03:21 -0500 | [diff] [blame] | 478 | mCallback.onShowingDetail(detail, x, y); |
John Spurlock | 7f8f22a | 2014-07-02 18:54:17 -0400 | [diff] [blame] | 479 | } |
| 480 | } |
| 481 | |
| 482 | private void fireToggleStateChanged(boolean state) { |
| 483 | if (mCallback != null) { |
| 484 | mCallback.onToggleStateChanged(state); |
John Spurlock | 5729d09 | 2014-05-29 17:42:51 -0400 | [diff] [blame] | 485 | } |
| 486 | } |
| 487 | |
John Spurlock | 486b78e | 2014-07-07 08:37:56 -0400 | [diff] [blame] | 488 | private void fireScanStateChanged(boolean state) { |
| 489 | if (mCallback != null) { |
| 490 | mCallback.onScanStateChanged(state); |
| 491 | } |
| 492 | } |
| 493 | |
Jason Monk | 7e53f20 | 2016-01-28 10:40:20 -0500 | [diff] [blame] | 494 | public void clickTile(ComponentName tile) { |
| 495 | final String spec = CustomTile.toSpec(tile); |
| 496 | final int N = mRecords.size(); |
| 497 | for (int i = 0; i < N; i++) { |
| 498 | if (mRecords.get(i).tile.getTileSpec().equals(spec)) { |
| 499 | mRecords.get(i).tile.click(); |
| 500 | break; |
| 501 | } |
| 502 | } |
| 503 | } |
| 504 | |
Jason Monk | 162011e | 2016-02-19 08:11:55 -0500 | [diff] [blame] | 505 | QSTileLayout getTileLayout() { |
| 506 | return mTileLayout; |
| 507 | } |
| 508 | |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame^] | 509 | QSTileView getTileView(QSTile tile) { |
Jason Monk | 162011e | 2016-02-19 08:11:55 -0500 | [diff] [blame] | 510 | for (TileRecord r : mRecords) { |
| 511 | if (r.tile == tile) { |
| 512 | return r.tileView; |
| 513 | } |
| 514 | } |
| 515 | return null; |
| 516 | } |
| 517 | |
Jason Monk | df36aed | 2016-07-25 11:21:56 -0400 | [diff] [blame] | 518 | public QSFooter getFooter() { |
| 519 | return mFooter; |
| 520 | } |
| 521 | |
phweiss | a0cb251 | 2016-12-14 21:37:48 +0100 | [diff] [blame] | 522 | public void showDeviceMonitoringDialog() { |
| 523 | mFooter.showDeviceMonitoringDialog(); |
| 524 | } |
| 525 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 526 | private class H extends Handler { |
| 527 | private static final int SHOW_DETAIL = 1; |
| 528 | private static final int SET_TILE_VISIBILITY = 2; |
dooyoung.hwang | 1b00662 | 2016-12-22 20:04:20 +0900 | [diff] [blame] | 529 | private static final int ANNOUNCE_FOR_ACCESSIBILITY = 3; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 530 | @Override |
| 531 | public void handleMessage(Message msg) { |
| 532 | if (msg.what == SHOW_DETAIL) { |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 533 | handleShowDetail((Record)msg.obj, msg.arg1 != 0); |
dooyoung.hwang | 1b00662 | 2016-12-22 20:04:20 +0900 | [diff] [blame] | 534 | } else if (msg.what == ANNOUNCE_FOR_ACCESSIBILITY) { |
| 535 | announceForAccessibility((CharSequence)msg.obj); |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 536 | } |
| 537 | } |
| 538 | } |
| 539 | |
Jason Monk | dc35dcb | 2015-12-04 16:36:15 -0500 | [diff] [blame] | 540 | protected static class Record { |
John Spurlock | 7f8f22a | 2014-07-02 18:54:17 -0400 | [diff] [blame] | 541 | DetailAdapter detailAdapter; |
Adrian Roos | 970be53 | 2014-11-21 15:50:16 +0100 | [diff] [blame] | 542 | int x; |
| 543 | int y; |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 544 | } |
| 545 | |
Jason Monk | bd6dbb0 | 2015-09-03 15:46:25 -0400 | [diff] [blame] | 546 | public static final class TileRecord extends Record { |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame^] | 547 | public QSTile tile; |
| 548 | public com.android.systemui.plugins.qs.QSTileView tileView; |
Jason Monk | 11a7744 | 2015-05-12 19:29:02 -0400 | [diff] [blame] | 549 | public boolean scanState; |
Xiaohui Chen | 08e266c | 2016-04-18 12:53:28 -0700 | [diff] [blame] | 550 | public QSTile.Callback callback; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 551 | } |
| 552 | |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 553 | public interface QSTileLayout { |
| 554 | void addTile(TileRecord tile); |
| 555 | void removeTile(TileRecord tile); |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 556 | int getOffsetTop(TileRecord tile); |
Jason Monk | 9d02a43 | 2016-01-20 16:33:46 -0500 | [diff] [blame] | 557 | boolean updateResources(); |
Jason Monk | 1bec6af | 2016-05-31 15:40:58 -0400 | [diff] [blame] | 558 | |
| 559 | void setListening(boolean listening); |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 560 | } |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 561 | } |