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 | e5b770e | 2017-03-03 21:49:29 -0500 | [diff] [blame] | 19 | import static com.android.systemui.qs.tileimpl.QSTileImpl.getColorForState; |
Fabian Kozynski | 00d494d | 2019-04-04 09:53:50 -0400 | [diff] [blame] | 20 | import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT; |
Matt Pietal | 5a19cb6 | 2019-10-30 12:31:07 -0400 | [diff] [blame] | 21 | import static com.android.systemui.util.Utils.useQsMediaPlayer; |
Jason Monk | e5b770e | 2017-03-03 21:49:29 -0500 | [diff] [blame] | 22 | |
Rohan Shah | db2cfa3 | 2018-02-20 11:27:22 -0800 | [diff] [blame] | 23 | import android.annotation.Nullable; |
Jason Monk | 7e53f20 | 2016-01-28 10:40:20 -0500 | [diff] [blame] | 24 | import android.content.ComponentName; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 25 | import android.content.Context; |
Jorim Jaggi | e17c4b4 | 2014-08-26 17:27:31 +0200 | [diff] [blame] | 26 | import android.content.res.Configuration; |
John Spurlock | 4bf3198 | 2014-05-21 13:04:22 -0400 | [diff] [blame] | 27 | import android.content.res.Resources; |
Beth Thibodeau | 07d20c3 | 2019-10-16 13:45:56 -0400 | [diff] [blame] | 28 | import android.graphics.drawable.Icon; |
| 29 | import android.media.session.MediaSession; |
Jason Monk | cb4b31d | 2017-05-03 10:37:34 -0400 | [diff] [blame] | 30 | import android.metrics.LogMaker; |
Fabian Kozynski | 407ddb2 | 2018-10-03 15:04:56 -0400 | [diff] [blame] | 31 | import android.os.Bundle; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 32 | import android.os.Handler; |
| 33 | import android.os.Message; |
Fabian Kozynski | 2865ab0 | 2019-10-11 15:03:59 -0400 | [diff] [blame] | 34 | import android.provider.Settings; |
Beth Thibodeau | 07d20c3 | 2019-10-16 13:45:56 -0400 | [diff] [blame] | 35 | import android.service.notification.StatusBarNotification; |
Jason Monk | e5b770e | 2017-03-03 21:49:29 -0500 | [diff] [blame] | 36 | import android.service.quicksettings.Tile; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 37 | import android.util.AttributeSet; |
Beth Thibodeau | 07d20c3 | 2019-10-16 13:45:56 -0400 | [diff] [blame] | 38 | import android.util.Log; |
John Spurlock | 7f8f22a | 2014-07-02 18:54:17 -0400 | [diff] [blame] | 39 | import android.view.LayoutInflater; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 40 | import android.view.View; |
Beth Thibodeau | 07d20c3 | 2019-10-16 13:45:56 -0400 | [diff] [blame] | 41 | import android.view.ViewGroup; |
Fabian Kozynski | 2865ab0 | 2019-10-11 15:03:59 -0400 | [diff] [blame] | 42 | import android.widget.FrameLayout; |
Beth Thibodeau | 07d20c3 | 2019-10-16 13:45:56 -0400 | [diff] [blame] | 43 | import android.widget.HorizontalScrollView; |
Jason Monk | 520ea06 | 2015-08-18 14:53:06 -0400 | [diff] [blame] | 44 | import android.widget.LinearLayout; |
Jason Monk | cb4b31d | 2017-05-03 10:37:34 -0400 | [diff] [blame] | 45 | |
Chris Wren | 457a21c | 2015-05-06 17:50:34 -0400 | [diff] [blame] | 46 | import com.android.internal.logging.MetricsLogger; |
Tamas Berghammer | 383db5eb | 2016-06-22 15:21:38 +0100 | [diff] [blame] | 47 | import com.android.internal.logging.nano.MetricsProto.MetricsEvent; |
Jason Monk | 824ffff | 2017-04-11 15:49:06 -0400 | [diff] [blame] | 48 | import com.android.settingslib.Utils; |
Jason Monk | de850bb | 2017-02-01 19:26:30 -0500 | [diff] [blame] | 49 | import com.android.systemui.Dependency; |
Fabian Kozynski | 00d494d | 2019-04-04 09:53:50 -0400 | [diff] [blame] | 50 | import com.android.systemui.DumpController; |
| 51 | import com.android.systemui.Dumpable; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 52 | import com.android.systemui.R; |
Fabian Kozynski | 5ca7a51 | 2019-10-16 19:56:11 +0000 | [diff] [blame] | 53 | import com.android.systemui.broadcast.BroadcastDispatcher; |
Jason Monk | e5b770e | 2017-03-03 21:49:29 -0500 | [diff] [blame] | 54 | import com.android.systemui.plugins.qs.DetailAdapter; |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame] | 55 | import com.android.systemui.plugins.qs.QSTile; |
| 56 | import com.android.systemui.plugins.qs.QSTileView; |
| 57 | import com.android.systemui.qs.QSHost.Callback; |
Jason Monk | bd6dbb0 | 2015-09-03 15:46:25 -0400 | [diff] [blame] | 58 | import com.android.systemui.qs.customize.QSCustomizer; |
Jason Monk | 7e53f20 | 2016-01-28 10:40:20 -0500 | [diff] [blame] | 59 | import com.android.systemui.qs.external.CustomTile; |
Jorim Jaggi | 3f48f46 | 2014-07-08 16:53:29 +0200 | [diff] [blame] | 60 | import com.android.systemui.settings.BrightnessController; |
Muyuan Li | 3b0f892 | 2016-04-18 19:27:29 -0700 | [diff] [blame] | 61 | import com.android.systemui.settings.ToggleSliderView; |
Fabian Kozynski | 2865ab0 | 2019-10-11 15:03:59 -0400 | [diff] [blame] | 62 | import com.android.systemui.shared.plugins.PluginManager; |
| 63 | import com.android.systemui.statusbar.phone.NPVPluginManager; |
Adrian Roos | 5fd872e | 2014-08-12 17:28:58 +0200 | [diff] [blame] | 64 | import com.android.systemui.statusbar.policy.BrightnessMirrorController; |
Adrian Roos | b01793f | 2017-08-09 14:34:55 +0200 | [diff] [blame] | 65 | import com.android.systemui.statusbar.policy.BrightnessMirrorController.BrightnessMirrorListener; |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 66 | import com.android.systemui.tuner.TunerService; |
| 67 | import com.android.systemui.tuner.TunerService.Tunable; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 68 | |
Fabian Kozynski | 00d494d | 2019-04-04 09:53:50 -0400 | [diff] [blame] | 69 | import java.io.FileDescriptor; |
| 70 | import java.io.PrintWriter; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 71 | import java.util.ArrayList; |
John Spurlock | bceed06 | 2014-08-10 18:04:16 -0400 | [diff] [blame] | 72 | import java.util.Collection; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 73 | |
Fabian Kozynski | 00d494d | 2019-04-04 09:53:50 -0400 | [diff] [blame] | 74 | import javax.inject.Inject; |
| 75 | import javax.inject.Named; |
| 76 | |
Rohan Shah | d3cf756 | 2018-02-23 11:12:28 -0800 | [diff] [blame] | 77 | /** View that represents the quick settings tile panel (when expanded/pulled down). **/ |
Fabian Kozynski | 00d494d | 2019-04-04 09:53:50 -0400 | [diff] [blame] | 78 | public class QSPanel extends LinearLayout implements Tunable, Callback, BrightnessMirrorListener, |
| 79 | Dumpable { |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 80 | |
| 81 | public static final String QS_SHOW_BRIGHTNESS = "qs_show_brightness"; |
Rohan Shah | d3cf756 | 2018-02-23 11:12:28 -0800 | [diff] [blame] | 82 | public static final String QS_SHOW_HEADER = "qs_show_header"; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 83 | |
Fabian Kozynski | 0db39af | 2018-08-31 15:56:45 -0400 | [diff] [blame] | 84 | private static final String TAG = "QSPanel"; |
| 85 | |
Jason Monk | bd6dbb0 | 2015-09-03 15:46:25 -0400 | [diff] [blame] | 86 | protected final Context mContext; |
Amin Shaikh | a07a17b | 2018-02-23 16:02:52 -0500 | [diff] [blame] | 87 | protected final ArrayList<TileRecord> mRecords = new ArrayList<>(); |
Jason Monk | 11a7744 | 2015-05-12 19:29:02 -0400 | [diff] [blame] | 88 | protected final View mBrightnessView; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 89 | private final H mHandler = new H(); |
Jason Monk | 8c09ac7 | 2017-03-16 11:53:40 -0400 | [diff] [blame] | 90 | private final MetricsLogger mMetricsLogger = Dependency.get(MetricsLogger.class); |
Amin Shaikh | a07a17b | 2018-02-23 16:02:52 -0500 | [diff] [blame] | 91 | private final QSTileRevealController mQsTileRevealController; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 92 | |
Beth Thibodeau | 07d20c3 | 2019-10-16 13:45:56 -0400 | [diff] [blame] | 93 | private final LinearLayout mMediaCarousel; |
| 94 | private final ArrayList<QSMediaPlayer> mMediaPlayers = new ArrayList<>(); |
| 95 | |
Muyuan Li | 0e9f538 | 2016-04-27 15:51:15 -0700 | [diff] [blame] | 96 | protected boolean mExpanded; |
Jason Monk | 1bec6af | 2016-05-31 15:40:58 -0400 | [diff] [blame] | 97 | protected boolean mListening; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 98 | |
Jason Monk | e5b770e | 2017-03-03 21:49:29 -0500 | [diff] [blame] | 99 | private QSDetail.Callback mCallback; |
Jorim Jaggi | 3f48f46 | 2014-07-08 16:53:29 +0200 | [diff] [blame] | 100 | private BrightnessController mBrightnessController; |
Fabian Kozynski | 00d494d | 2019-04-04 09:53:50 -0400 | [diff] [blame] | 101 | private DumpController mDumpController; |
Jason Monk | bbadff8 | 2015-11-06 15:47:26 -0500 | [diff] [blame] | 102 | protected QSTileHost mHost; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 103 | |
Jason Monk | e5b770e | 2017-03-03 21:49:29 -0500 | [diff] [blame] | 104 | protected QSSecurityFooter mFooter; |
Rohan Shah | 3090e79 | 2018-04-12 00:01:00 -0400 | [diff] [blame] | 105 | private PageIndicator mFooterPageIndicator; |
Selim Cinek | e32010a | 2014-08-20 23:50:41 +0200 | [diff] [blame] | 106 | private boolean mGridContentVisible = true; |
Jason Monk | 3d5f551 | 2014-07-25 11:17:28 -0400 | [diff] [blame] | 107 | |
Jason Monk | bd6dbb0 | 2015-09-03 15:46:25 -0400 | [diff] [blame] | 108 | protected QSTileLayout mTileLayout; |
| 109 | |
| 110 | private QSCustomizer mCustomizePanel; |
Jason Monk | 377e7ad | 2016-02-16 14:03:21 -0500 | [diff] [blame] | 111 | private Record mDetailRecord; |
Jason Monk | 520ea06 | 2015-08-18 14:53:06 -0400 | [diff] [blame] | 112 | |
Adrian Roos | 429c962 | 2016-06-15 13:02:17 -0700 | [diff] [blame] | 113 | private BrightnessMirrorController mBrightnessMirrorController; |
Jason Monk | e5b770e | 2017-03-03 21:49:29 -0500 | [diff] [blame] | 114 | private View mDivider; |
Adrian Roos | 429c962 | 2016-06-15 13:02:17 -0700 | [diff] [blame] | 115 | |
Fabian Kozynski | 2865ab0 | 2019-10-11 15:03:59 -0400 | [diff] [blame] | 116 | private FrameLayout mPluginFrame; |
| 117 | private final PluginManager mPluginManager; |
| 118 | private NPVPluginManager mNPVPluginManager; |
| 119 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 120 | public QSPanel(Context context) { |
| 121 | this(context, null); |
| 122 | } |
| 123 | |
| 124 | public QSPanel(Context context, AttributeSet attrs) { |
Fabian Kozynski | 00d494d | 2019-04-04 09:53:50 -0400 | [diff] [blame] | 125 | this(context, attrs, null); |
| 126 | } |
| 127 | |
Fabian Kozynski | 2865ab0 | 2019-10-11 15:03:59 -0400 | [diff] [blame] | 128 | public QSPanel(Context context, AttributeSet attrs, DumpController dumpController) { |
Fabian Kozynski | 5ca7a51 | 2019-10-16 19:56:11 +0000 | [diff] [blame] | 129 | this(context, attrs, dumpController, null, Dependency.get(BroadcastDispatcher.class)); |
Fabian Kozynski | 2865ab0 | 2019-10-11 15:03:59 -0400 | [diff] [blame] | 130 | } |
| 131 | |
Fabian Kozynski | 00d494d | 2019-04-04 09:53:50 -0400 | [diff] [blame] | 132 | @Inject |
| 133 | public QSPanel(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs, |
Fabian Kozynski | 5ca7a51 | 2019-10-16 19:56:11 +0000 | [diff] [blame] | 134 | DumpController dumpController, PluginManager pluginManager, |
| 135 | BroadcastDispatcher broadcastDispatcher) { |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 136 | super(context, attrs); |
| 137 | mContext = context; |
| 138 | |
Jason Monk | 162011e | 2016-02-19 08:11:55 -0500 | [diff] [blame] | 139 | setOrientation(VERTICAL); |
Jason Monk | 520ea06 | 2015-08-18 14:53:06 -0400 | [diff] [blame] | 140 | |
Jason Monk | 231b052 | 2018-01-04 10:49:55 -0500 | [diff] [blame] | 141 | mBrightnessView = LayoutInflater.from(mContext).inflate( |
| 142 | R.layout.quick_settings_brightness_dialog, this, false); |
Amin Shaikh | 15781d6 | 2018-02-16 16:00:13 -0500 | [diff] [blame] | 143 | addView(mBrightnessView); |
| 144 | |
| 145 | mTileLayout = (QSTileLayout) LayoutInflater.from(mContext).inflate( |
| 146 | R.layout.qs_paged_tile_layout, this, false); |
Jason Monk | 231b052 | 2018-01-04 10:49:55 -0500 | [diff] [blame] | 147 | mTileLayout.setListening(mListening); |
Amin Shaikh | 15781d6 | 2018-02-16 16:00:13 -0500 | [diff] [blame] | 148 | addView((View) mTileLayout); |
| 149 | |
Amin Shaikh | a07a17b | 2018-02-23 16:02:52 -0500 | [diff] [blame] | 150 | mQsTileRevealController = new QSTileRevealController(mContext, this, |
Rohan Shah | 3090e79 | 2018-04-12 00:01:00 -0400 | [diff] [blame] | 151 | (PagedTileLayout) mTileLayout); |
Jason Monk | 3250885 | 2017-01-18 09:17:13 -0500 | [diff] [blame] | 152 | |
Jason Monk | e5b770e | 2017-03-03 21:49:29 -0500 | [diff] [blame] | 153 | addDivider(); |
| 154 | |
Beth Thibodeau | 07d20c3 | 2019-10-16 13:45:56 -0400 | [diff] [blame] | 155 | // Add media carousel |
Matt Pietal | 5a19cb6 | 2019-10-30 12:31:07 -0400 | [diff] [blame] | 156 | if (useQsMediaPlayer(context)) { |
Beth Thibodeau | 07d20c3 | 2019-10-16 13:45:56 -0400 | [diff] [blame] | 157 | HorizontalScrollView mediaScrollView = new HorizontalScrollView(mContext); |
| 158 | mediaScrollView.setHorizontalScrollBarEnabled(false); |
| 159 | int playerHeight = (int) getResources().getDimension(R.dimen.qs_media_height); |
| 160 | int padding = (int) getResources().getDimension(R.dimen.qs_media_padding); |
| 161 | LayoutParams lpView = new LayoutParams(LayoutParams.MATCH_PARENT, playerHeight); |
| 162 | lpView.setMarginStart(padding); |
| 163 | lpView.setMarginEnd(padding); |
| 164 | addView(mediaScrollView, lpView); |
| 165 | |
| 166 | LayoutParams lpCarousel = new LayoutParams(LayoutParams.MATCH_PARENT, |
| 167 | LayoutParams.WRAP_CONTENT); |
| 168 | mMediaCarousel = new LinearLayout(mContext); |
| 169 | mMediaCarousel.setOrientation(LinearLayout.HORIZONTAL); |
| 170 | mediaScrollView.addView(mMediaCarousel, lpCarousel); |
Beth Thibodeau | 4e69f4c | 2019-10-24 14:13:49 -0400 | [diff] [blame] | 171 | mediaScrollView.setVisibility(View.GONE); |
Beth Thibodeau | 07d20c3 | 2019-10-16 13:45:56 -0400 | [diff] [blame] | 172 | } else { |
| 173 | mMediaCarousel = null; |
| 174 | } |
| 175 | |
phweiss | 4f70f10 | 2017-04-12 19:32:55 +0200 | [diff] [blame] | 176 | mFooter = new QSSecurityFooter(this, context); |
| 177 | addView(mFooter.getView()); |
| 178 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 179 | updateResources(); |
Jorim Jaggi | 3f48f46 | 2014-07-08 16:53:29 +0200 | [diff] [blame] | 180 | |
| 181 | mBrightnessController = new BrightnessController(getContext(), |
Fabian Kozynski | 5ca7a51 | 2019-10-16 19:56:11 +0000 | [diff] [blame] | 182 | findViewById(R.id.brightness_slider), broadcastDispatcher); |
Fabian Kozynski | 00d494d | 2019-04-04 09:53:50 -0400 | [diff] [blame] | 183 | mDumpController = dumpController; |
Fabian Kozynski | 2865ab0 | 2019-10-11 15:03:59 -0400 | [diff] [blame] | 184 | mPluginManager = pluginManager; |
| 185 | if (mPluginManager != null && Settings.System.getInt( |
| 186 | mContext.getContentResolver(), "npv_plugin_flag", 0) == 2) { |
| 187 | mPluginFrame = (FrameLayout) LayoutInflater.from(mContext).inflate( |
| 188 | R.layout.status_bar_expanded_plugin_frame, this, false); |
| 189 | addView(mPluginFrame); |
| 190 | mNPVPluginManager = new NPVPluginManager(mPluginFrame, mPluginManager); |
| 191 | } |
| 192 | |
Jason Monk | e5b770e | 2017-03-03 21:49:29 -0500 | [diff] [blame] | 193 | } |
| 194 | |
Beth Thibodeau | 07d20c3 | 2019-10-16 13:45:56 -0400 | [diff] [blame] | 195 | /** |
| 196 | * Add or update a player for the associated media session |
| 197 | * @param token |
| 198 | * @param icon |
| 199 | * @param iconColor |
| 200 | * @param bgColor |
| 201 | * @param actionsContainer |
| 202 | * @param notif |
| 203 | */ |
| 204 | public void addMediaSession(MediaSession.Token token, Icon icon, int iconColor, int bgColor, |
| 205 | View actionsContainer, StatusBarNotification notif) { |
Matt Pietal | 5a19cb6 | 2019-10-30 12:31:07 -0400 | [diff] [blame] | 206 | if (!useQsMediaPlayer(mContext)) { |
Beth Thibodeau | 07d20c3 | 2019-10-16 13:45:56 -0400 | [diff] [blame] | 207 | // Shouldn't happen, but just in case |
| 208 | Log.e(TAG, "Tried to add media session without player!"); |
| 209 | return; |
| 210 | } |
| 211 | QSMediaPlayer player = null; |
| 212 | String packageName = notif.getPackageName(); |
| 213 | for (QSMediaPlayer p : mMediaPlayers) { |
| 214 | if (p.getMediaSessionToken().equals(token)) { |
| 215 | Log.d(TAG, "a player for this session already exists"); |
| 216 | player = p; |
| 217 | break; |
| 218 | } |
| 219 | |
| 220 | if (packageName.equals(p.getMediaPlayerPackage())) { |
| 221 | Log.d(TAG, "found an old session for this app"); |
| 222 | player = p; |
| 223 | break; |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | int playerHeight = (int) getResources().getDimension(R.dimen.qs_media_height); |
| 228 | int playerWidth = (int) getResources().getDimension(R.dimen.qs_media_width); |
| 229 | int padding = (int) getResources().getDimension(R.dimen.qs_media_padding); |
| 230 | LayoutParams lp = new LayoutParams(playerWidth, ViewGroup.LayoutParams.MATCH_PARENT); |
| 231 | lp.setMarginStart(padding); |
| 232 | lp.setMarginEnd(padding); |
| 233 | |
| 234 | if (player == null) { |
| 235 | Log.d(TAG, "creating new player"); |
| 236 | |
| 237 | player = new QSMediaPlayer(mContext, this, playerWidth, playerHeight); |
| 238 | |
| 239 | if (player.isPlaying()) { |
| 240 | mMediaCarousel.addView(player.getView(), 0, lp); // add in front |
| 241 | } else { |
| 242 | mMediaCarousel.addView(player.getView(), lp); // add at end |
| 243 | } |
Beth Thibodeau | 4e69f4c | 2019-10-24 14:13:49 -0400 | [diff] [blame] | 244 | mMediaPlayers.add(player); |
Beth Thibodeau | 07d20c3 | 2019-10-16 13:45:56 -0400 | [diff] [blame] | 245 | } else if (player.isPlaying()) { |
| 246 | // move it to the front |
| 247 | mMediaCarousel.removeView(player.getView()); |
| 248 | mMediaCarousel.addView(player.getView(), 0, lp); |
| 249 | } |
| 250 | |
| 251 | Log.d(TAG, "setting player session"); |
| 252 | player.setMediaSession(token, icon, iconColor, bgColor, actionsContainer, |
| 253 | notif.getNotification()); |
Beth Thibodeau | 4e69f4c | 2019-10-24 14:13:49 -0400 | [diff] [blame] | 254 | |
| 255 | if (mMediaPlayers.size() > 0) { |
| 256 | ((View) mMediaCarousel.getParent()).setVisibility(View.VISIBLE); |
| 257 | } |
Beth Thibodeau | 07d20c3 | 2019-10-16 13:45:56 -0400 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | protected View getMediaPanel() { |
| 261 | return mMediaCarousel; |
| 262 | } |
| 263 | |
Jason Monk | e5b770e | 2017-03-03 21:49:29 -0500 | [diff] [blame] | 264 | protected void addDivider() { |
| 265 | mDivider = LayoutInflater.from(mContext).inflate(R.layout.qs_divider, this, false); |
Jason Monk | 824ffff | 2017-04-11 15:49:06 -0400 | [diff] [blame] | 266 | mDivider.setBackgroundColor(Utils.applyAlpha(mDivider.getAlpha(), |
| 267 | getColorForState(mContext, Tile.STATE_ACTIVE))); |
Jason Monk | e5b770e | 2017-03-03 21:49:29 -0500 | [diff] [blame] | 268 | addView(mDivider); |
| 269 | } |
| 270 | |
Fabian Kozynski | 72cd84a9 | 2019-04-15 14:09:43 -0400 | [diff] [blame] | 271 | @Override |
| 272 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
| 273 | // We want all the logic of LinearLayout#onMeasure, and for it to assign the excess space |
| 274 | // not used by the other children to PagedTileLayout. However, in this case, LinearLayout |
| 275 | // assumes that PagedTileLayout would use all the excess space. This is not the case as |
| 276 | // PagedTileLayout height is quantized (because it shows a certain number of rows). |
| 277 | // Therefore, after everything is measured, we need to make sure that we add up the correct |
| 278 | // total height |
| 279 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); |
| 280 | int height = getPaddingBottom() + getPaddingTop(); |
| 281 | int numChildren = getChildCount(); |
| 282 | for (int i = 0; i < numChildren; i++) { |
| 283 | View child = getChildAt(i); |
| 284 | if (child.getVisibility() != View.GONE) height += child.getMeasuredHeight(); |
| 285 | } |
| 286 | setMeasuredDimension(getMeasuredWidth(), height); |
| 287 | } |
| 288 | |
Jason Monk | e5b770e | 2017-03-03 21:49:29 -0500 | [diff] [blame] | 289 | public View getDivider() { |
| 290 | return mDivider; |
Jason Monk | 3250885 | 2017-01-18 09:17:13 -0500 | [diff] [blame] | 291 | } |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 292 | |
Amin Shaikh | a07a17b | 2018-02-23 16:02:52 -0500 | [diff] [blame] | 293 | public QSTileRevealController getQsTileRevealController() { |
| 294 | return mQsTileRevealController; |
| 295 | } |
| 296 | |
Jason Monk | 377e7ad | 2016-02-16 14:03:21 -0500 | [diff] [blame] | 297 | public boolean isShowingCustomize() { |
| 298 | return mCustomizePanel != null && mCustomizePanel.isCustomizing(); |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 299 | } |
| 300 | |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 301 | @Override |
| 302 | protected void onAttachedToWindow() { |
| 303 | super.onAttachedToWindow(); |
Rohan Shah | db2cfa3 | 2018-02-20 11:27:22 -0800 | [diff] [blame] | 304 | final TunerService tunerService = Dependency.get(TunerService.class); |
| 305 | tunerService.addTunable(this, QS_SHOW_BRIGHTNESS); |
Rohan Shah | db2cfa3 | 2018-02-20 11:27:22 -0800 | [diff] [blame] | 306 | |
Jason Monk | f160edca | 2016-03-30 13:48:56 -0400 | [diff] [blame] | 307 | if (mHost != null) { |
| 308 | setTiles(mHost.getTiles()); |
| 309 | } |
Adrian Roos | b01793f | 2017-08-09 14:34:55 +0200 | [diff] [blame] | 310 | if (mBrightnessMirrorController != null) { |
| 311 | mBrightnessMirrorController.addCallback(this); |
| 312 | } |
Ned Burns | 66b6e37 | 2019-07-26 13:45:42 -0400 | [diff] [blame] | 313 | if (mDumpController != null) mDumpController.registerDumpable(getDumpableTag(), this); |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 314 | } |
| 315 | |
| 316 | @Override |
| 317 | protected void onDetachedFromWindow() { |
Jason Monk | de850bb | 2017-02-01 19:26:30 -0500 | [diff] [blame] | 318 | Dependency.get(TunerService.class).removeTunable(this); |
| 319 | if (mHost != null) { |
| 320 | mHost.removeCallback(this); |
| 321 | } |
Jason Monk | f160edca | 2016-03-30 13:48:56 -0400 | [diff] [blame] | 322 | for (TileRecord record : mRecords) { |
| 323 | record.tile.removeCallbacks(); |
| 324 | } |
Adrian Roos | b01793f | 2017-08-09 14:34:55 +0200 | [diff] [blame] | 325 | if (mBrightnessMirrorController != null) { |
| 326 | mBrightnessMirrorController.removeCallback(this); |
| 327 | } |
Ned Burns | 66b6e37 | 2019-07-26 13:45:42 -0400 | [diff] [blame] | 328 | if (mDumpController != null) mDumpController.unregisterDumpable(this); |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 329 | super.onDetachedFromWindow(); |
| 330 | } |
| 331 | |
Ned Burns | 66b6e37 | 2019-07-26 13:45:42 -0400 | [diff] [blame] | 332 | protected String getDumpableTag() { |
| 333 | return TAG; |
| 334 | } |
| 335 | |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 336 | @Override |
Jason Monk | 46dbfb4 | 2016-02-25 14:59:20 -0500 | [diff] [blame] | 337 | public void onTilesChanged() { |
| 338 | setTiles(mHost.getTiles()); |
| 339 | } |
| 340 | |
| 341 | @Override |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 342 | public void onTuningChanged(String key, String newValue) { |
| 343 | if (QS_SHOW_BRIGHTNESS.equals(key)) { |
Rohan Shah | db2cfa3 | 2018-02-20 11:27:22 -0800 | [diff] [blame] | 344 | updateViewVisibilityForTuningValue(mBrightnessView, newValue); |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 345 | } |
| 346 | } |
| 347 | |
Rohan Shah | db2cfa3 | 2018-02-20 11:27:22 -0800 | [diff] [blame] | 348 | private void updateViewVisibilityForTuningValue(View view, @Nullable String newValue) { |
Henrik Baard | a2c86e8 | 2019-03-14 12:23:04 +0100 | [diff] [blame] | 349 | view.setVisibility(TunerService.parseIntegerSwitch(newValue, true) ? VISIBLE : GONE); |
Rohan Shah | db2cfa3 | 2018-02-20 11:27:22 -0800 | [diff] [blame] | 350 | } |
| 351 | |
Jason Monk | a992732 | 2015-12-13 16:22:37 -0500 | [diff] [blame] | 352 | public void openDetails(String subPanel) { |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame] | 353 | QSTile tile = getTile(subPanel); |
Fabian Kozynski | e3137e3 | 2018-09-28 11:20:04 -0400 | [diff] [blame] | 354 | // If there's no tile with that name (as defined in QSFactoryImpl or other QSFactory), |
| 355 | // QSFactory will not be able to create a tile and getTile will return null |
| 356 | if (tile != null) { |
| 357 | showDetailAdapter(true, tile.getDetailAdapter(), new int[]{getWidth() / 2, 0}); |
| 358 | } |
Jason Monk | a992732 | 2015-12-13 16:22:37 -0500 | [diff] [blame] | 359 | } |
| 360 | |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame] | 361 | private QSTile getTile(String subPanel) { |
Jason Monk | a992732 | 2015-12-13 16:22:37 -0500 | [diff] [blame] | 362 | for (int i = 0; i < mRecords.size(); i++) { |
| 363 | if (subPanel.equals(mRecords.get(i).tile.getTileSpec())) { |
| 364 | return mRecords.get(i).tile; |
| 365 | } |
| 366 | } |
| 367 | return mHost.createTile(subPanel); |
| 368 | } |
| 369 | |
Adrian Roos | 5fd872e | 2014-08-12 17:28:58 +0200 | [diff] [blame] | 370 | public void setBrightnessMirror(BrightnessMirrorController c) { |
Adrian Roos | b01793f | 2017-08-09 14:34:55 +0200 | [diff] [blame] | 371 | if (mBrightnessMirrorController != null) { |
| 372 | mBrightnessMirrorController.removeCallback(this); |
| 373 | } |
Adrian Roos | 429c962 | 2016-06-15 13:02:17 -0700 | [diff] [blame] | 374 | mBrightnessMirrorController = c; |
Adrian Roos | b01793f | 2017-08-09 14:34:55 +0200 | [diff] [blame] | 375 | if (mBrightnessMirrorController != null) { |
| 376 | mBrightnessMirrorController.addCallback(this); |
| 377 | } |
| 378 | updateBrightnessMirror(); |
| 379 | } |
| 380 | |
| 381 | @Override |
| 382 | public void onBrightnessMirrorReinflated(View brightnessMirror) { |
| 383 | updateBrightnessMirror(); |
Adrian Roos | 5fd872e | 2014-08-12 17:28:58 +0200 | [diff] [blame] | 384 | } |
| 385 | |
Jason Monk | b46059a | 2016-06-30 14:22:42 -0400 | [diff] [blame] | 386 | View getBrightnessView() { |
| 387 | return mBrightnessView; |
| 388 | } |
| 389 | |
Jason Monk | e5b770e | 2017-03-03 21:49:29 -0500 | [diff] [blame] | 390 | public void setCallback(QSDetail.Callback callback) { |
John Spurlock | 5729d09 | 2014-05-29 17:42:51 -0400 | [diff] [blame] | 391 | mCallback = callback; |
| 392 | } |
| 393 | |
Jason Monk | 8b9d67f | 2016-03-02 08:59:08 -0500 | [diff] [blame] | 394 | public void setHost(QSTileHost host, QSCustomizer customizer) { |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 395 | mHost = host; |
Jason Monk | 46dbfb4 | 2016-02-25 14:59:20 -0500 | [diff] [blame] | 396 | mHost.addCallback(this); |
| 397 | setTiles(mHost.getTiles()); |
Jason Monk | 9c7844c | 2017-01-18 15:21:53 -0500 | [diff] [blame] | 398 | mFooter.setHostEnvironment(host); |
Jason Monk | 8b9d67f | 2016-03-02 08:59:08 -0500 | [diff] [blame] | 399 | mCustomizePanel = customizer; |
| 400 | if (mCustomizePanel != null) { |
| 401 | mCustomizePanel.setHost(mHost); |
| 402 | } |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 403 | } |
| 404 | |
Rohan Shah | 3090e79 | 2018-04-12 00:01:00 -0400 | [diff] [blame] | 405 | /** |
| 406 | * Links the footer's page indicator, which is used in landscape orientation to save space. |
| 407 | * |
| 408 | * @param pageIndicator indicator to use for page scrolling |
| 409 | */ |
| 410 | public void setFooterPageIndicator(PageIndicator pageIndicator) { |
| 411 | if (mTileLayout instanceof PagedTileLayout) { |
| 412 | mFooterPageIndicator = pageIndicator; |
| 413 | updatePageIndicator(); |
| 414 | } |
| 415 | } |
| 416 | |
| 417 | private void updatePageIndicator() { |
| 418 | if (mTileLayout instanceof PagedTileLayout) { |
Rohan Shah | 3090e79 | 2018-04-12 00:01:00 -0400 | [diff] [blame] | 419 | if (mFooterPageIndicator != null) { |
| 420 | mFooterPageIndicator.setVisibility(View.GONE); |
Rohan Shah | 3090e79 | 2018-04-12 00:01:00 -0400 | [diff] [blame] | 421 | |
Fabian Kozynski | 4e76d1f | 2019-02-25 16:30:04 -0500 | [diff] [blame] | 422 | ((PagedTileLayout) mTileLayout).setPageIndicator(mFooterPageIndicator); |
| 423 | } |
Rohan Shah | 3090e79 | 2018-04-12 00:01:00 -0400 | [diff] [blame] | 424 | } |
| 425 | } |
| 426 | |
Adrian Roos | 00a0b1f | 2014-07-16 16:44:49 +0200 | [diff] [blame] | 427 | public QSTileHost getHost() { |
| 428 | return mHost; |
| 429 | } |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 430 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 431 | public void updateResources() { |
John Spurlock | 4bf3198 | 2014-05-21 13:04:22 -0400 | [diff] [blame] | 432 | final Resources res = mContext.getResources(); |
Rohan Shah | d3cf756 | 2018-02-23 11:12:28 -0800 | [diff] [blame] | 433 | setPadding(0, res.getDimensionPixelSize(R.dimen.qs_panel_padding_top), 0, res.getDimensionPixelSize(R.dimen.qs_panel_padding_bottom)); |
Rohan Shah | 3090e79 | 2018-04-12 00:01:00 -0400 | [diff] [blame] | 434 | |
| 435 | updatePageIndicator(); |
| 436 | |
John Spurlock | 1a462c1 | 2014-07-14 10:52:01 -0400 | [diff] [blame] | 437 | if (mListening) { |
| 438 | refreshAllTiles(); |
| 439 | } |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 440 | if (mTileLayout != null) { |
| 441 | mTileLayout.updateResources(); |
| 442 | } |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 443 | } |
| 444 | |
Jorim Jaggi | e17c4b4 | 2014-08-26 17:27:31 +0200 | [diff] [blame] | 445 | @Override |
| 446 | protected void onConfigurationChanged(Configuration newConfig) { |
| 447 | super.onConfigurationChanged(newConfig); |
Jorim Jaggi | e17c4b4 | 2014-08-26 17:27:31 +0200 | [diff] [blame] | 448 | mFooter.onConfigurationChanged(); |
Fabian Kozynski | b1aee81 | 2019-04-04 14:17:48 -0400 | [diff] [blame] | 449 | updateResources(); |
Adrian Roos | 429c962 | 2016-06-15 13:02:17 -0700 | [diff] [blame] | 450 | |
Adrian Roos | b01793f | 2017-08-09 14:34:55 +0200 | [diff] [blame] | 451 | updateBrightnessMirror(); |
| 452 | } |
| 453 | |
| 454 | public void updateBrightnessMirror() { |
Adrian Roos | 429c962 | 2016-06-15 13:02:17 -0700 | [diff] [blame] | 455 | if (mBrightnessMirrorController != null) { |
Adrian Roos | b01793f | 2017-08-09 14:34:55 +0200 | [diff] [blame] | 456 | ToggleSliderView brightnessSlider = findViewById(R.id.brightness_slider); |
| 457 | ToggleSliderView mirrorSlider = mBrightnessMirrorController.getMirror() |
| 458 | .findViewById(R.id.brightness_slider); |
| 459 | brightnessSlider.setMirror(mirrorSlider); |
| 460 | brightnessSlider.setMirrorController(mBrightnessMirrorController); |
Adrian Roos | 429c962 | 2016-06-15 13:02:17 -0700 | [diff] [blame] | 461 | } |
Jorim Jaggi | e17c4b4 | 2014-08-26 17:27:31 +0200 | [diff] [blame] | 462 | } |
| 463 | |
Jason Monk | bd6dbb0 | 2015-09-03 15:46:25 -0400 | [diff] [blame] | 464 | public void onCollapse() { |
Yoshinori Hirano | 1dd7d07 | 2016-09-05 16:11:59 +0900 | [diff] [blame] | 465 | if (mCustomizePanel != null && mCustomizePanel.isShown()) { |
Fabian Kozynski | 0db39af | 2018-08-31 15:56:45 -0400 | [diff] [blame] | 466 | mCustomizePanel.hide(); |
Jason Monk | bd6dbb0 | 2015-09-03 15:46:25 -0400 | [diff] [blame] | 467 | } |
| 468 | } |
| 469 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 470 | public void setExpanded(boolean expanded) { |
John Spurlock | 5729d09 | 2014-05-29 17:42:51 -0400 | [diff] [blame] | 471 | if (mExpanded == expanded) return; |
| 472 | mExpanded = expanded; |
Amin Shaikh | 15781d6 | 2018-02-16 16:00:13 -0500 | [diff] [blame] | 473 | if (!mExpanded && mTileLayout instanceof PagedTileLayout) { |
| 474 | ((PagedTileLayout) mTileLayout).setCurrentItem(0, false); |
Jason Monk | 162011e | 2016-02-19 08:11:55 -0500 | [diff] [blame] | 475 | } |
Jason Monk | 8c09ac7 | 2017-03-16 11:53:40 -0400 | [diff] [blame] | 476 | mMetricsLogger.visibility(MetricsEvent.QS_PANEL, mExpanded); |
John Spurlock | 5729d09 | 2014-05-29 17:42:51 -0400 | [diff] [blame] | 477 | if (!mExpanded) { |
John Spurlock | f7ae442 | 2014-08-01 12:45:18 -0400 | [diff] [blame] | 478 | closeDetail(); |
Chris Wren | 457a21c | 2015-05-06 17:50:34 -0400 | [diff] [blame] | 479 | } else { |
| 480 | logTiles(); |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 481 | } |
Jorim Jaggi | e65e310 | 2014-07-01 22:00:50 +0200 | [diff] [blame] | 482 | } |
| 483 | |
Amin Shaikh | 5da602f | 2018-02-02 15:00:25 -0500 | [diff] [blame] | 484 | public void setPageListener(final PagedTileLayout.PageListener pageListener) { |
| 485 | if (mTileLayout instanceof PagedTileLayout) { |
| 486 | ((PagedTileLayout) mTileLayout).setPageListener(pageListener); |
Amin Shaikh | 5da602f | 2018-02-02 15:00:25 -0500 | [diff] [blame] | 487 | } |
| 488 | } |
| 489 | |
Muyuan Li | 0e9f538 | 2016-04-27 15:51:15 -0700 | [diff] [blame] | 490 | public boolean isExpanded() { |
| 491 | return mExpanded; |
| 492 | } |
| 493 | |
Jorim Jaggi | e65e310 | 2014-07-01 22:00:50 +0200 | [diff] [blame] | 494 | public void setListening(boolean listening) { |
| 495 | if (mListening == listening) return; |
| 496 | mListening = listening; |
Jason Monk | 1bec6af | 2016-05-31 15:40:58 -0400 | [diff] [blame] | 497 | if (mTileLayout != null) { |
| 498 | mTileLayout.setListening(listening); |
John Spurlock | 1a462c1 | 2014-07-14 10:52:01 -0400 | [diff] [blame] | 499 | } |
| 500 | if (mListening) { |
| 501 | refreshAllTiles(); |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 502 | } |
Fabian Kozynski | 2865ab0 | 2019-10-11 15:03:59 -0400 | [diff] [blame] | 503 | if (mNPVPluginManager != null) mNPVPluginManager.setListening(listening); |
Fabian Kozynski | b9dc0c7 | 2018-09-20 13:00:17 -0400 | [diff] [blame] | 504 | } |
| 505 | |
| 506 | public void setListening(boolean listening, boolean expanded) { |
| 507 | setListening(listening && expanded); |
| 508 | getFooter().setListening(listening); |
| 509 | // Set the listening as soon as the QS fragment starts listening regardless of the expansion, |
| 510 | // so it will update the current brightness before the slider is visible. |
| 511 | setBrightnessListening(listening); |
| 512 | } |
| 513 | |
| 514 | public void setBrightnessListening(boolean listening) { |
| 515 | if (listening) { |
| 516 | mBrightnessController.registerCallbacks(); |
| 517 | } else { |
| 518 | mBrightnessController.unregisterCallbacks(); |
Jorim Jaggi | 3f48f46 | 2014-07-08 16:53:29 +0200 | [diff] [blame] | 519 | } |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 520 | } |
| 521 | |
Jorim Jaggi | 1ecd7cd | 2014-11-03 16:18:03 +0100 | [diff] [blame] | 522 | public void refreshAllTiles() { |
yuemingw | eb2bf7d18 | 2018-01-23 16:05:08 +0000 | [diff] [blame] | 523 | mBrightnessController.checkRestrictionAndSetEnabled(); |
John Spurlock | 1a462c1 | 2014-07-14 10:52:01 -0400 | [diff] [blame] | 524 | for (TileRecord r : mRecords) { |
| 525 | r.tile.refreshState(); |
| 526 | } |
Jason Monk | 3d5f551 | 2014-07-25 11:17:28 -0400 | [diff] [blame] | 527 | mFooter.refreshState(); |
John Spurlock | 1a462c1 | 2014-07-14 10:52:01 -0400 | [diff] [blame] | 528 | } |
| 529 | |
Adrian Roos | 970be53 | 2014-11-21 15:50:16 +0100 | [diff] [blame] | 530 | public void showDetailAdapter(boolean show, DetailAdapter adapter, int[] locationInWindow) { |
| 531 | int xInWindow = locationInWindow[0]; |
| 532 | int yInWindow = locationInWindow[1]; |
Jason Monk | 377e7ad | 2016-02-16 14:03:21 -0500 | [diff] [blame] | 533 | ((View) getParent()).getLocationInWindow(locationInWindow); |
Adrian Roos | 970be53 | 2014-11-21 15:50:16 +0100 | [diff] [blame] | 534 | |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 535 | Record r = new Record(); |
| 536 | r.detailAdapter = adapter; |
Adrian Roos | 970be53 | 2014-11-21 15:50:16 +0100 | [diff] [blame] | 537 | r.x = xInWindow - locationInWindow[0]; |
| 538 | r.y = yInWindow - locationInWindow[1]; |
| 539 | |
| 540 | locationInWindow[0] = xInWindow; |
| 541 | locationInWindow[1] = yInWindow; |
| 542 | |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 543 | showDetail(show, r); |
| 544 | } |
| 545 | |
Jason Monk | dc35dcb | 2015-12-04 16:36:15 -0500 | [diff] [blame] | 546 | protected void showDetail(boolean show, Record r) { |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 547 | mHandler.obtainMessage(H.SHOW_DETAIL, show ? 1 : 0, 0, r).sendToTarget(); |
| 548 | } |
| 549 | |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame] | 550 | public void setTiles(Collection<QSTile> tiles) { |
Julia Reynolds | 20aef8a | 2016-05-04 16:44:08 -0400 | [diff] [blame] | 551 | setTiles(tiles, false); |
| 552 | } |
| 553 | |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame] | 554 | public void setTiles(Collection<QSTile> tiles, boolean collapsedView) { |
Amin Shaikh | a07a17b | 2018-02-23 16:02:52 -0500 | [diff] [blame] | 555 | if (!collapsedView) { |
| 556 | mQsTileRevealController.updateRevealedTiles(tiles); |
| 557 | } |
John Spurlock | bceed06 | 2014-08-10 18:04:16 -0400 | [diff] [blame] | 558 | for (TileRecord record : mRecords) { |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 559 | mTileLayout.removeTile(record); |
Xiaohui Chen | 08e266c | 2016-04-18 12:53:28 -0700 | [diff] [blame] | 560 | record.tile.removeCallback(record.callback); |
John Spurlock | bceed06 | 2014-08-10 18:04:16 -0400 | [diff] [blame] | 561 | } |
| 562 | mRecords.clear(); |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame] | 563 | for (QSTile tile : tiles) { |
Julia Reynolds | 20aef8a | 2016-05-04 16:44:08 -0400 | [diff] [blame] | 564 | addTile(tile, collapsedView); |
John Spurlock | bceed06 | 2014-08-10 18:04:16 -0400 | [diff] [blame] | 565 | } |
John Spurlock | bceed06 | 2014-08-10 18:04:16 -0400 | [diff] [blame] | 566 | } |
| 567 | |
Jason Monk | ec87a87 | 2016-03-01 15:00:16 -0500 | [diff] [blame] | 568 | protected void drawTile(TileRecord r, QSTile.State state) { |
John Spurlock | 20c8905 | 2015-05-11 13:11:24 -0400 | [diff] [blame] | 569 | r.tileView.onStateChanged(state); |
| 570 | } |
| 571 | |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame] | 572 | protected QSTileView createTileView(QSTile tile, boolean collapsedView) { |
| 573 | return mHost.createTileView(tile, collapsedView); |
Jason Monk | dc35dcb | 2015-12-04 16:36:15 -0500 | [diff] [blame] | 574 | } |
| 575 | |
Xiaohui Chen | 6644893 | 2016-04-18 12:53:28 -0700 | [diff] [blame] | 576 | protected boolean shouldShowDetail() { |
| 577 | return mExpanded; |
| 578 | } |
| 579 | |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame] | 580 | protected TileRecord addTile(final QSTile tile, boolean collapsedView) { |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 581 | final TileRecord r = new TileRecord(); |
| 582 | r.tile = tile; |
Julia Reynolds | 20aef8a | 2016-05-04 16:44:08 -0400 | [diff] [blame] | 583 | r.tileView = createTileView(tile, collapsedView); |
John Spurlock | bceed06 | 2014-08-10 18:04:16 -0400 | [diff] [blame] | 584 | final QSTile.Callback callback = new QSTile.Callback() { |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 585 | @Override |
| 586 | public void onStateChanged(QSTile.State state) { |
Jason Monk | 377e7ad | 2016-02-16 14:03:21 -0500 | [diff] [blame] | 587 | drawTile(r, state); |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 588 | } |
Jason Monk | ca894a0 | 2016-01-12 15:30:22 -0500 | [diff] [blame] | 589 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 590 | @Override |
| 591 | public void onShowDetail(boolean show) { |
Xiaohui Chen | 6644893 | 2016-04-18 12:53:28 -0700 | [diff] [blame] | 592 | // Both the collapsed and full QS panels get this callback, this check determines |
| 593 | // which one should handle showing the detail. |
| 594 | if (shouldShowDetail()) { |
| 595 | QSPanel.this.showDetail(show, r); |
| 596 | } |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 597 | } |
Jason Monk | ca894a0 | 2016-01-12 15:30:22 -0500 | [diff] [blame] | 598 | |
John Spurlock | 7f8f22a | 2014-07-02 18:54:17 -0400 | [diff] [blame] | 599 | @Override |
| 600 | public void onToggleStateChanged(boolean state) { |
| 601 | if (mDetailRecord == r) { |
| 602 | fireToggleStateChanged(state); |
| 603 | } |
| 604 | } |
Jason Monk | ca894a0 | 2016-01-12 15:30:22 -0500 | [diff] [blame] | 605 | |
John Spurlock | 486b78e | 2014-07-07 08:37:56 -0400 | [diff] [blame] | 606 | @Override |
| 607 | public void onScanStateChanged(boolean state) { |
John Spurlock | 465cefa | 2014-08-16 10:39:33 -0400 | [diff] [blame] | 608 | r.scanState = state; |
John Spurlock | 486b78e | 2014-07-07 08:37:56 -0400 | [diff] [blame] | 609 | if (mDetailRecord == r) { |
John Spurlock | 465cefa | 2014-08-16 10:39:33 -0400 | [diff] [blame] | 610 | fireScanStateChanged(r.scanState); |
John Spurlock | 486b78e | 2014-07-07 08:37:56 -0400 | [diff] [blame] | 611 | } |
| 612 | } |
Selim Cinek | 4fda7b2 | 2014-08-18 22:07:25 +0200 | [diff] [blame] | 613 | |
| 614 | @Override |
| 615 | public void onAnnouncementRequested(CharSequence announcement) { |
dooyoung.hwang | 1b00662 | 2016-12-22 20:04:20 +0900 | [diff] [blame] | 616 | if (announcement != null) { |
| 617 | mHandler.obtainMessage(H.ANNOUNCE_FOR_ACCESSIBILITY, announcement) |
| 618 | .sendToTarget(); |
| 619 | } |
Selim Cinek | 4fda7b2 | 2014-08-18 22:07:25 +0200 | [diff] [blame] | 620 | } |
John Spurlock | bceed06 | 2014-08-10 18:04:16 -0400 | [diff] [blame] | 621 | }; |
Jason Monk | ca894a0 | 2016-01-12 15:30:22 -0500 | [diff] [blame] | 622 | r.tile.addCallback(callback); |
Xiaohui Chen | 08e266c | 2016-04-18 12:53:28 -0700 | [diff] [blame] | 623 | r.callback = callback; |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame] | 624 | r.tileView.init(r.tile); |
John Spurlock | ccb6b9a | 2014-05-17 15:54:40 -0400 | [diff] [blame] | 625 | r.tile.refreshState(); |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 626 | mRecords.add(r); |
| 627 | |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 628 | if (mTileLayout != null) { |
| 629 | mTileLayout.addTile(r); |
| 630 | } |
Muyuan Li | b40004b | 2016-05-11 14:47:29 -0700 | [diff] [blame] | 631 | |
| 632 | return r; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 633 | } |
| 634 | |
Jason Monk | 2142843 | 2016-02-10 16:42:38 -0500 | [diff] [blame] | 635 | |
Jason Monk | 4bb7b1a | 2016-05-27 15:19:15 -0400 | [diff] [blame] | 636 | public void showEdit(final View v) { |
Jason Monk | 2142843 | 2016-02-10 16:42:38 -0500 | [diff] [blame] | 637 | v.post(new Runnable() { |
| 638 | @Override |
| 639 | public void run() { |
| 640 | if (mCustomizePanel != null) { |
| 641 | if (!mCustomizePanel.isCustomizing()) { |
Fabian Kozynski | 0db39af | 2018-08-31 15:56:45 -0400 | [diff] [blame] | 642 | int[] loc = v.getLocationOnScreen(); |
Jason Monk | 4bb7b1a | 2016-05-27 15:19:15 -0400 | [diff] [blame] | 643 | int x = loc[0] + v.getWidth() / 2; |
| 644 | int y = loc[1] + v.getHeight() / 2; |
Jason Monk | 2142843 | 2016-02-10 16:42:38 -0500 | [diff] [blame] | 645 | mCustomizePanel.show(x, y); |
| 646 | } |
| 647 | } |
| 648 | |
| 649 | } |
| 650 | }); |
| 651 | } |
| 652 | |
John Spurlock | f7ae442 | 2014-08-01 12:45:18 -0400 | [diff] [blame] | 653 | public void closeDetail() { |
Yoshinori Hirano | 1dd7d07 | 2016-09-05 16:11:59 +0900 | [diff] [blame] | 654 | if (mCustomizePanel != null && mCustomizePanel.isShown()) { |
Jason Monk | bd6dbb0 | 2015-09-03 15:46:25 -0400 | [diff] [blame] | 655 | // Treat this as a detail panel for now, to make things easy. |
Fabian Kozynski | 0db39af | 2018-08-31 15:56:45 -0400 | [diff] [blame] | 656 | mCustomizePanel.hide(); |
Jason Monk | bd6dbb0 | 2015-09-03 15:46:25 -0400 | [diff] [blame] | 657 | return; |
| 658 | } |
John Spurlock | f7ae442 | 2014-08-01 12:45:18 -0400 | [diff] [blame] | 659 | showDetail(false, mDetailRecord); |
| 660 | } |
| 661 | |
Jorim Jaggi | 8bc983e | 2014-12-10 17:45:50 +0100 | [diff] [blame] | 662 | public int getGridHeight() { |
Jason Monk | 162011e | 2016-02-19 08:11:55 -0500 | [diff] [blame] | 663 | return getMeasuredHeight(); |
Jorim Jaggi | 8bc983e | 2014-12-10 17:45:50 +0100 | [diff] [blame] | 664 | } |
| 665 | |
Jason Monk | dc35dcb | 2015-12-04 16:36:15 -0500 | [diff] [blame] | 666 | protected void handleShowDetail(Record r, boolean show) { |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 667 | if (r instanceof TileRecord) { |
| 668 | handleShowDetailTile((TileRecord) r, show); |
| 669 | } else { |
Adrian Roos | 970be53 | 2014-11-21 15:50:16 +0100 | [diff] [blame] | 670 | int x = 0; |
| 671 | int y = 0; |
| 672 | if (r != null) { |
| 673 | x = r.x; |
| 674 | y = r.y; |
| 675 | } |
| 676 | handleShowDetailImpl(r, show, x, y); |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 677 | } |
| 678 | } |
| 679 | |
| 680 | private void handleShowDetailTile(TileRecord r, boolean show) { |
Jason Monk | efe3d3f | 2015-06-10 16:48:03 -0400 | [diff] [blame] | 681 | if ((mDetailRecord != null) == show && mDetailRecord == r) return; |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 682 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 683 | if (show) { |
John Spurlock | 7f8f22a | 2014-07-02 18:54:17 -0400 | [diff] [blame] | 684 | r.detailAdapter = r.tile.getDetailAdapter(); |
| 685 | if (r.detailAdapter == null) return; |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 686 | } |
Jason Monk | 0d6a1c4 | 2015-04-20 16:38:51 -0400 | [diff] [blame] | 687 | r.tile.setDetailListening(show); |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 688 | int x = r.tileView.getLeft() + r.tileView.getWidth() / 2; |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame] | 689 | int y = r.tileView.getDetailY() + mTileLayout.getOffsetTop(r) + getTop(); |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 690 | handleShowDetailImpl(r, show, x, y); |
| 691 | } |
| 692 | |
| 693 | private void handleShowDetailImpl(Record r, boolean show, int x, int y) { |
Jason Monk | 377e7ad | 2016-02-16 14:03:21 -0500 | [diff] [blame] | 694 | setDetailRecord(show ? r : null); |
| 695 | fireShowingDetail(show ? r.detailAdapter : null, x, y); |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 696 | } |
| 697 | |
Muyuan Li | 4074b46 | 2016-05-06 13:40:42 -0700 | [diff] [blame] | 698 | protected void setDetailRecord(Record r) { |
Jason Monk | 377e7ad | 2016-02-16 14:03:21 -0500 | [diff] [blame] | 699 | if (r == mDetailRecord) return; |
| 700 | mDetailRecord = r; |
| 701 | final boolean scanState = mDetailRecord instanceof TileRecord |
| 702 | && ((TileRecord) mDetailRecord).scanState; |
| 703 | fireScanStateChanged(scanState); |
| 704 | } |
| 705 | |
| 706 | void setGridContentVisibility(boolean visible) { |
Selim Cinek | e32010a | 2014-08-20 23:50:41 +0200 | [diff] [blame] | 707 | int newVis = visible ? VISIBLE : INVISIBLE; |
Jason Monk | 162011e | 2016-02-19 08:11:55 -0500 | [diff] [blame] | 708 | setVisibility(newVis); |
Chris Wren | 457a21c | 2015-05-06 17:50:34 -0400 | [diff] [blame] | 709 | if (mGridContentVisible != visible) { |
Jason Monk | 8c09ac7 | 2017-03-16 11:53:40 -0400 | [diff] [blame] | 710 | mMetricsLogger.visibility(MetricsEvent.QS_PANEL, newVis); |
Chris Wren | 457a21c | 2015-05-06 17:50:34 -0400 | [diff] [blame] | 711 | } |
Selim Cinek | e32010a | 2014-08-20 23:50:41 +0200 | [diff] [blame] | 712 | mGridContentVisible = visible; |
| 713 | } |
| 714 | |
Chris Wren | 457a21c | 2015-05-06 17:50:34 -0400 | [diff] [blame] | 715 | private void logTiles() { |
| 716 | for (int i = 0; i < mRecords.size(); i++) { |
Jason Monk | cb4b31d | 2017-05-03 10:37:34 -0400 | [diff] [blame] | 717 | QSTile tile = mRecords.get(i).tile; |
| 718 | mMetricsLogger.write(tile.populate(new LogMaker(tile.getMetricsCategory()) |
| 719 | .setType(MetricsEvent.TYPE_OPEN))); |
Chris Wren | 457a21c | 2015-05-06 17:50:34 -0400 | [diff] [blame] | 720 | } |
| 721 | } |
| 722 | |
Jason Monk | 377e7ad | 2016-02-16 14:03:21 -0500 | [diff] [blame] | 723 | private void fireShowingDetail(DetailAdapter detail, int x, int y) { |
John Spurlock | 5729d09 | 2014-05-29 17:42:51 -0400 | [diff] [blame] | 724 | if (mCallback != null) { |
Jason Monk | 377e7ad | 2016-02-16 14:03:21 -0500 | [diff] [blame] | 725 | mCallback.onShowingDetail(detail, x, y); |
John Spurlock | 7f8f22a | 2014-07-02 18:54:17 -0400 | [diff] [blame] | 726 | } |
| 727 | } |
| 728 | |
| 729 | private void fireToggleStateChanged(boolean state) { |
| 730 | if (mCallback != null) { |
| 731 | mCallback.onToggleStateChanged(state); |
John Spurlock | 5729d09 | 2014-05-29 17:42:51 -0400 | [diff] [blame] | 732 | } |
| 733 | } |
| 734 | |
John Spurlock | 486b78e | 2014-07-07 08:37:56 -0400 | [diff] [blame] | 735 | private void fireScanStateChanged(boolean state) { |
| 736 | if (mCallback != null) { |
| 737 | mCallback.onScanStateChanged(state); |
| 738 | } |
| 739 | } |
| 740 | |
Jason Monk | 7e53f20 | 2016-01-28 10:40:20 -0500 | [diff] [blame] | 741 | public void clickTile(ComponentName tile) { |
| 742 | final String spec = CustomTile.toSpec(tile); |
| 743 | final int N = mRecords.size(); |
| 744 | for (int i = 0; i < N; i++) { |
| 745 | if (mRecords.get(i).tile.getTileSpec().equals(spec)) { |
| 746 | mRecords.get(i).tile.click(); |
| 747 | break; |
| 748 | } |
| 749 | } |
| 750 | } |
| 751 | |
Jason Monk | 162011e | 2016-02-19 08:11:55 -0500 | [diff] [blame] | 752 | QSTileLayout getTileLayout() { |
| 753 | return mTileLayout; |
| 754 | } |
| 755 | |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame] | 756 | QSTileView getTileView(QSTile tile) { |
Jason Monk | 162011e | 2016-02-19 08:11:55 -0500 | [diff] [blame] | 757 | for (TileRecord r : mRecords) { |
| 758 | if (r.tile == tile) { |
| 759 | return r.tileView; |
| 760 | } |
| 761 | } |
| 762 | return null; |
| 763 | } |
| 764 | |
Jason Monk | e5b770e | 2017-03-03 21:49:29 -0500 | [diff] [blame] | 765 | public QSSecurityFooter getFooter() { |
Jason Monk | df36aed | 2016-07-25 11:21:56 -0400 | [diff] [blame] | 766 | return mFooter; |
| 767 | } |
| 768 | |
phweiss | a0cb251 | 2016-12-14 21:37:48 +0100 | [diff] [blame] | 769 | public void showDeviceMonitoringDialog() { |
| 770 | mFooter.showDeviceMonitoringDialog(); |
| 771 | } |
| 772 | |
Amin Shaikh | bc1a4e8 | 2018-04-16 12:14:35 -0400 | [diff] [blame] | 773 | public void setMargins(int sideMargins) { |
| 774 | for (int i = 0; i < getChildCount(); i++) { |
| 775 | View view = getChildAt(i); |
| 776 | if (view != mTileLayout) { |
| 777 | LayoutParams lp = (LayoutParams) view.getLayoutParams(); |
| 778 | lp.leftMargin = sideMargins; |
| 779 | lp.rightMargin = sideMargins; |
| 780 | } |
| 781 | } |
| 782 | } |
| 783 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 784 | private class H extends Handler { |
| 785 | private static final int SHOW_DETAIL = 1; |
| 786 | private static final int SET_TILE_VISIBILITY = 2; |
dooyoung.hwang | 1b00662 | 2016-12-22 20:04:20 +0900 | [diff] [blame] | 787 | private static final int ANNOUNCE_FOR_ACCESSIBILITY = 3; |
Jason Monk | cb4b31d | 2017-05-03 10:37:34 -0400 | [diff] [blame] | 788 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 789 | @Override |
| 790 | public void handleMessage(Message msg) { |
| 791 | if (msg.what == SHOW_DETAIL) { |
Jason Monk | cb4b31d | 2017-05-03 10:37:34 -0400 | [diff] [blame] | 792 | handleShowDetail((Record) msg.obj, msg.arg1 != 0); |
dooyoung.hwang | 1b00662 | 2016-12-22 20:04:20 +0900 | [diff] [blame] | 793 | } else if (msg.what == ANNOUNCE_FOR_ACCESSIBILITY) { |
Jason Monk | cb4b31d | 2017-05-03 10:37:34 -0400 | [diff] [blame] | 794 | announceForAccessibility((CharSequence) msg.obj); |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 795 | } |
| 796 | } |
| 797 | } |
| 798 | |
Fabian Kozynski | 00d494d | 2019-04-04 09:53:50 -0400 | [diff] [blame] | 799 | @Override |
| 800 | public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { |
| 801 | pw.println(getClass().getSimpleName() + ":"); |
| 802 | pw.println(" Tile records:"); |
| 803 | for (TileRecord record : mRecords) { |
| 804 | if (record.tile instanceof Dumpable) { |
| 805 | pw.print(" "); ((Dumpable) record.tile).dump(fd, pw, args); |
| 806 | pw.print(" "); pw.println(record.tileView.toString()); |
| 807 | } |
| 808 | } |
| 809 | } |
| 810 | |
Jason Monk | dc35dcb | 2015-12-04 16:36:15 -0500 | [diff] [blame] | 811 | protected static class Record { |
John Spurlock | 7f8f22a | 2014-07-02 18:54:17 -0400 | [diff] [blame] | 812 | DetailAdapter detailAdapter; |
Adrian Roos | 970be53 | 2014-11-21 15:50:16 +0100 | [diff] [blame] | 813 | int x; |
| 814 | int y; |
Adrian Roos | 1ef80fe | 2014-07-14 22:53:54 +0200 | [diff] [blame] | 815 | } |
| 816 | |
Jason Monk | bd6dbb0 | 2015-09-03 15:46:25 -0400 | [diff] [blame] | 817 | public static final class TileRecord extends Record { |
Jason Monk | 702e2eb | 2017-03-03 16:53:44 -0500 | [diff] [blame] | 818 | public QSTile tile; |
| 819 | public com.android.systemui.plugins.qs.QSTileView tileView; |
Jason Monk | 11a7744 | 2015-05-12 19:29:02 -0400 | [diff] [blame] | 820 | public boolean scanState; |
Xiaohui Chen | 08e266c | 2016-04-18 12:53:28 -0700 | [diff] [blame] | 821 | public QSTile.Callback callback; |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 822 | } |
| 823 | |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 824 | public interface QSTileLayout { |
Fabian Kozynski | 407ddb2 | 2018-10-03 15:04:56 -0400 | [diff] [blame] | 825 | |
| 826 | default void saveInstanceState(Bundle outState) {} |
| 827 | |
| 828 | default void restoreInstanceState(Bundle savedInstanceState) {} |
| 829 | |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 830 | void addTile(TileRecord tile); |
Jason Monk | cb4b31d | 2017-05-03 10:37:34 -0400 | [diff] [blame] | 831 | |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 832 | void removeTile(TileRecord tile); |
Jason Monk | cb4b31d | 2017-05-03 10:37:34 -0400 | [diff] [blame] | 833 | |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 834 | int getOffsetTop(TileRecord tile); |
Jason Monk | cb4b31d | 2017-05-03 10:37:34 -0400 | [diff] [blame] | 835 | |
Jason Monk | 9d02a43 | 2016-01-20 16:33:46 -0500 | [diff] [blame] | 836 | boolean updateResources(); |
Jason Monk | 1bec6af | 2016-05-31 15:40:58 -0400 | [diff] [blame] | 837 | |
| 838 | void setListening(boolean listening); |
Amin Shaikh | 0f8ea543 | 2018-03-27 11:09:27 -0400 | [diff] [blame] | 839 | |
| 840 | default void setExpansion(float expansion) {} |
Fabian Kozynski | 802279f | 2018-09-07 13:44:54 -0400 | [diff] [blame] | 841 | |
| 842 | int getNumVisibleTiles(); |
Jason Monk | caf3762 | 2015-08-18 12:33:50 -0400 | [diff] [blame] | 843 | } |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 844 | } |