Showing 8 tiles in collapsed Quick Settings in split shade
Also overriding default tiles columns count for bigger screens - I've seen some weird behaviour with tiles columns so just to be safe Fixes: 193651837 Fixes: 190688328 Test: manual Change-Id: I681fd7ac9c0ad7898a1b24b50bf140de43bf414f
This commit is contained in:
@@ -18,6 +18,10 @@
|
||||
<!-- Max number of columns for quick controls area -->
|
||||
<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 -->
|
||||
<bool name="config_use_split_notification_shade">true</bool>
|
||||
</resources>
|
||||
|
||||
@@ -86,7 +86,10 @@
|
||||
<bool name="config_navigation_bar_enable_auto_dim_no_visible_wallpaper">true</bool>
|
||||
|
||||
<!-- 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 -->
|
||||
<integer name="quick_settings_num_columns">2</integer>
|
||||
|
||||
@@ -33,18 +33,16 @@ import com.android.systemui.plugins.qs.QSTile.State;
|
||||
*/
|
||||
public class QuickQSPanel extends QSPanel {
|
||||
|
||||
public static final String NUM_QUICK_TILES = "sysui_qqs_count";
|
||||
private static final String TAG = "QuickQSPanel";
|
||||
// A default value so that we never return 0.
|
||||
public static final int DEFAULT_MAX_TILES = 6;
|
||||
// A fallback value for max tiles number when setting via Tuner (parseNumTiles)
|
||||
public static final int TUNER_MAX_TILES_FALLBACK = 6;
|
||||
|
||||
private boolean mDisabledByPolicy;
|
||||
private int mMaxTiles;
|
||||
|
||||
public QuickQSPanel(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mMaxTiles = Math.min(DEFAULT_MAX_TILES,
|
||||
getResources().getInteger(R.integer.quick_qs_panel_max_columns));
|
||||
mMaxTiles = getResources().getInteger(R.integer.quick_qs_panel_max_tiles);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,7 +99,7 @@ public class QuickQSPanel extends QSPanel {
|
||||
}
|
||||
|
||||
public void setMaxTiles(int maxTiles) {
|
||||
mMaxTiles = Math.min(maxTiles, DEFAULT_MAX_TILES);
|
||||
mMaxTiles = maxTiles;
|
||||
}
|
||||
|
||||
@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
|
||||
* @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) {
|
||||
try {
|
||||
return Integer.parseInt(numTilesValue);
|
||||
} catch (NumberFormatException e) {
|
||||
// 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() {
|
||||
mCellHeightResId = R.dimen.qs_quick_tile_size;
|
||||
boolean b = super.updateResources();
|
||||
mMaxAllowedRows = 2;
|
||||
mMaxAllowedRows = getResources().getInteger(R.integer.quick_qs_panel_max_rows);
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class QuickQSPanelController extends QSPanelControllerBase<QuickQSPanel>
|
||||
|
||||
private final QSPanel.OnConfigurationChangedListener mOnConfigurationChangedListener =
|
||||
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()) {
|
||||
setMaxTiles(newMaxTiles);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user