Merge "Showing 8 tiles in collapsed Quick Settings in split shade" into sc-v2-dev am: 59f92c5738

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15284434

Change-Id: Ic92992045c592ca352b91357c7cebe7e47f0b5a3
This commit is contained in:
Michał Brzeziński
2021-07-16 15:30:17 +00:00
committed by Automerger Merge Worker
4 changed files with 18 additions and 12 deletions

View File

@@ -18,6 +18,10 @@
<!-- Max number of columns for quick controls area --> <!-- Max number of columns for quick controls area -->
<integer name="controls_max_columns">2</integer> <integer name="controls_max_columns">2</integer>
<integer name="quick_settings_num_columns">2</integer>
<integer name="quick_qs_panel_max_rows">4</integer>
<integer name="quick_qs_panel_max_tiles">8</integer>
<!-- Whether to use the split 2-column notification shade --> <!-- Whether to use the split 2-column notification shade -->
<bool name="config_use_split_notification_shade">true</bool> <bool name="config_use_split_notification_shade">true</bool>
</resources> </resources>

View File

@@ -86,7 +86,10 @@
<bool name="config_navigation_bar_enable_auto_dim_no_visible_wallpaper">true</bool> <bool name="config_navigation_bar_enable_auto_dim_no_visible_wallpaper">true</bool>
<!-- The maximum number of tiles in the QuickQSPanel --> <!-- The maximum number of tiles in the QuickQSPanel -->
<integer name="quick_qs_panel_max_columns">4</integer> <integer name="quick_qs_panel_max_tiles">4</integer>
<!-- The maximum number of rows in the QuickQSPanel -->
<integer name="quick_qs_panel_max_rows">2</integer>
<!-- The number of columns in the QuickSettings --> <!-- The number of columns in the QuickSettings -->
<integer name="quick_settings_num_columns">2</integer> <integer name="quick_settings_num_columns">2</integer>

View File

@@ -33,18 +33,16 @@ import com.android.systemui.plugins.qs.QSTile.State;
*/ */
public class QuickQSPanel extends QSPanel { public class QuickQSPanel extends QSPanel {
public static final String NUM_QUICK_TILES = "sysui_qqs_count";
private static final String TAG = "QuickQSPanel"; private static final String TAG = "QuickQSPanel";
// A default value so that we never return 0. // A fallback value for max tiles number when setting via Tuner (parseNumTiles)
public static final int DEFAULT_MAX_TILES = 6; public static final int TUNER_MAX_TILES_FALLBACK = 6;
private boolean mDisabledByPolicy; private boolean mDisabledByPolicy;
private int mMaxTiles; private int mMaxTiles;
public QuickQSPanel(Context context, AttributeSet attrs) { public QuickQSPanel(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
mMaxTiles = Math.min(DEFAULT_MAX_TILES, mMaxTiles = getResources().getInteger(R.integer.quick_qs_panel_max_tiles);
getResources().getInteger(R.integer.quick_qs_panel_max_columns));
} }
@Override @Override
@@ -101,7 +99,7 @@ public class QuickQSPanel extends QSPanel {
} }
public void setMaxTiles(int maxTiles) { public void setMaxTiles(int maxTiles) {
mMaxTiles = Math.min(maxTiles, DEFAULT_MAX_TILES); mMaxTiles = maxTiles;
} }
@Override @Override
@@ -117,17 +115,18 @@ public class QuickQSPanel extends QSPanel {
} }
/** /**
* Parses the String setting into the number of tiles. Defaults to {@code mDefaultMaxTiles} * Parses the String setting into the number of tiles. Defaults to
* {@link #TUNER_MAX_TILES_FALLBACK}
* *
* @param numTilesValue value of the setting to parse * @param numTilesValue value of the setting to parse
* @return parsed value of numTilesValue OR {@code mDefaultMaxTiles} on error * @return parsed value of numTilesValue OR {@link #TUNER_MAX_TILES_FALLBACK} on error
*/ */
public static int parseNumTiles(String numTilesValue) { public static int parseNumTiles(String numTilesValue) {
try { try {
return Integer.parseInt(numTilesValue); return Integer.parseInt(numTilesValue);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
// Couldn't read an int from the new setting value. Use default. // Couldn't read an int from the new setting value. Use default.
return DEFAULT_MAX_TILES; return TUNER_MAX_TILES_FALLBACK;
} }
} }
@@ -187,7 +186,7 @@ public class QuickQSPanel extends QSPanel {
public boolean updateResources() { public boolean updateResources() {
mCellHeightResId = R.dimen.qs_quick_tile_size; mCellHeightResId = R.dimen.qs_quick_tile_size;
boolean b = super.updateResources(); boolean b = super.updateResources();
mMaxAllowedRows = 2; mMaxAllowedRows = getResources().getInteger(R.integer.quick_qs_panel_max_rows);
return b; return b;
} }

View File

@@ -43,7 +43,7 @@ public class QuickQSPanelController extends QSPanelControllerBase<QuickQSPanel>
private final QSPanel.OnConfigurationChangedListener mOnConfigurationChangedListener = private final QSPanel.OnConfigurationChangedListener mOnConfigurationChangedListener =
newConfig -> { newConfig -> {
int newMaxTiles = getResources().getInteger(R.integer.quick_qs_panel_max_columns); int newMaxTiles = getResources().getInteger(R.integer.quick_qs_panel_max_tiles);
if (newMaxTiles != mView.getNumQuickTiles()) { if (newMaxTiles != mView.getNumQuickTiles()) {
setMaxTiles(newMaxTiles); setMaxTiles(newMaxTiles);
} }