Fix margins between headers and tiles.
Also: * Remove old classes. * Change height of tiles. * Add back clipping on PagedTileLayout, as the views don't need to go outside its bounds. * Fix a scrolling issue Fixes: 187460996 Fixes: 187966021 Fixes: 187334034 Fixes: 188459321 Test: manual Change-Id: Ide520f26982a3f2c8918424cb4c14d3d14da3724
This commit is contained in:
@@ -18,6 +18,4 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/tile_page"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false" />
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
@@ -20,7 +20,4 @@
|
||||
android:id="@+id/qs_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="@dimen/qs_paged_tile_layout_padding_bottom" />
|
||||
android:layout_weight="1"/>
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/quick_qs_status_icons"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginTop="@dimen/qqs_layout_margin_top"
|
||||
android:accessibilityTraversalAfter="@id/quick_qs_status_icons"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
|
||||
@@ -22,13 +22,15 @@
|
||||
<dimen name="docked_divider_handle_width">2dp</dimen>
|
||||
<dimen name="docked_divider_handle_height">16dp</dimen>
|
||||
|
||||
<dimen name="qs_tile_margin_top">8dp</dimen>
|
||||
|
||||
<dimen name="qs_tile_height">84dp</dimen>
|
||||
<dimen name="qs_brightness_margin_top">0dp</dimen>
|
||||
<dimen name="qs_brightness_margin_bottom">12dp</dimen>
|
||||
<dimen name="qqs_layout_margin_top">8dp</dimen>
|
||||
<!-- The height of the qs customize header. Should be
|
||||
(qs_panel_padding_top (48dp) + brightness_mirror_height (48dp) + qs_tile_margin_top (8dp)) -
|
||||
(qs_panel_padding_top (48dp) + brightness_mirror_height (48dp) + qs_brightness_margin_top (0dp) + qs_brightness_margin_bottom (12dp)) -
|
||||
(Toolbar_minWidth (56dp) + qs_tile_margin_top_bottom (4dp))
|
||||
-->
|
||||
<dimen name="qs_customize_header_min_height">44dp</dimen>
|
||||
<dimen name="qs_customize_header_min_height">48dp</dimen>
|
||||
|
||||
<dimen name="qs_security_footer_single_line_height">@*android:dimen/quick_qs_offset_height</dimen>
|
||||
<dimen name="qs_footer_padding">14dp</dimen>
|
||||
|
||||
@@ -536,21 +536,22 @@
|
||||
<dimen name="pull_span_min">25dp</dimen>
|
||||
|
||||
<dimen name="qs_corner_radius">28dp</dimen>
|
||||
<dimen name="qs_tile_height">88dp</dimen>
|
||||
<dimen name="qs_tile_height">84dp</dimen>
|
||||
<!--notification_side_paddings + notification_content_margin_start - (qs_quick_tile_size - qs_tile_background_size) / 2 -->
|
||||
<dimen name="qs_tile_layout_margin_side">18dp</dimen>
|
||||
<dimen name="qs_tile_margin_horizontal">8dp</dimen>
|
||||
<dimen name="qs_tile_margin_horizontal_two_line">2dp</dimen>
|
||||
<dimen name="qs_tile_margin_vertical">@dimen/qs_tile_margin_horizontal</dimen>
|
||||
<dimen name="qs_tile_margin_top_bottom">4dp</dimen>
|
||||
<dimen name="qs_tile_margin_top_bottom_negative">-4dp</dimen>
|
||||
<dimen name="qs_brightness_margin_top">8dp</dimen>
|
||||
<dimen name="qs_brightness_margin_bottom">24dp</dimen>
|
||||
<dimen name="qqs_layout_margin_top">16dp</dimen>
|
||||
<!-- The height of the qs customize header. Should be
|
||||
(qs_panel_padding_top (48dp) + brightness_mirror_height (48dp) + qs_tile_margin_top (18dp)) -
|
||||
(qs_panel_padding_top (48dp) + brightness_mirror_height (48dp) + qs_brightness_margin_top(8dp) + qs_brightness_margin_bottom (24dp)) -
|
||||
(Toolbar_minWidth (56dp) + qs_tile_margin_top_bottom (4dp))
|
||||
-->
|
||||
<dimen name="qs_customize_header_min_height">54dp</dimen>
|
||||
<dimen name="qs_customize_header_min_height">68dp</dimen>
|
||||
<dimen name="qs_customize_internal_side_paddings">8dp</dimen>
|
||||
<dimen name="qs_tile_margin_top">18dp</dimen>
|
||||
<dimen name="qs_tile_icon_background_stroke_width">-1dp</dimen>
|
||||
<dimen name="qs_tile_background_size">56dp</dimen>
|
||||
<dimen name="qs_icon_size">20dp</dimen>
|
||||
@@ -610,7 +611,6 @@
|
||||
<dimen name="qs_status_separator">32dp</dimen>
|
||||
<dimen name="qs_carrier_margin_width">4dp</dimen>
|
||||
<dimen name="qs_footer_icon_size">20dp</dimen>
|
||||
<dimen name="qs_paged_tile_layout_padding_bottom">0dp</dimen>
|
||||
<dimen name="qs_header_top_padding">15dp</dimen>
|
||||
<dimen name="qs_header_bottom_padding">14dp</dimen>
|
||||
|
||||
@@ -1251,8 +1251,6 @@
|
||||
<!-- Size of the RAT type for CellularTile -->
|
||||
<dimen name="celltile_rat_type_size">10sp</dimen>
|
||||
|
||||
<dimen name="new_qs_vertical_margin">8dp</dimen>
|
||||
|
||||
<!-- Size of media cards in the QSPanel carousel -->
|
||||
<dimen name="qs_media_padding">16dp</dimen>
|
||||
<dimen name="qs_media_album_size_small">72dp</dimen>
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.systemui.qs
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.android.internal.logging.UiEventLogger
|
||||
import com.android.systemui.R
|
||||
import com.android.systemui.qs.TileLayout.exactly
|
||||
|
||||
class DoubleLineTileLayout(
|
||||
context: Context
|
||||
) : ViewGroup(context), QSPanel.QSTileLayout {
|
||||
|
||||
companion object {
|
||||
private const val NUM_LINES = 2
|
||||
}
|
||||
|
||||
protected val mRecords = ArrayList<QSPanelControllerBase.TileRecord>()
|
||||
private var _listening = false
|
||||
private var smallTileSize = 0
|
||||
private val twoLineHeight
|
||||
get() = smallTileSize * NUM_LINES + cellMarginVertical * (NUM_LINES - 1)
|
||||
private var cellMarginHorizontal = 0
|
||||
private var cellMarginVertical = 0
|
||||
private var tilesToShow = 0
|
||||
|
||||
init {
|
||||
isFocusableInTouchMode = true
|
||||
clipChildren = false
|
||||
clipToPadding = false
|
||||
|
||||
updateResources()
|
||||
}
|
||||
|
||||
override fun addTile(tile: QSPanelControllerBase.TileRecord) {
|
||||
mRecords.add(tile)
|
||||
tile.tile.setListening(this, _listening)
|
||||
addTileView(tile)
|
||||
}
|
||||
|
||||
protected fun addTileView(tile: QSPanelControllerBase.TileRecord) {
|
||||
addView(tile.tileView)
|
||||
}
|
||||
|
||||
override fun removeTile(tile: QSPanelControllerBase.TileRecord) {
|
||||
mRecords.remove(tile)
|
||||
tile.tile.setListening(this, false)
|
||||
removeView(tile.tileView)
|
||||
}
|
||||
|
||||
override fun removeAllViews() {
|
||||
mRecords.forEach { it.tile.setListening(this, false) }
|
||||
mRecords.clear()
|
||||
super.removeAllViews()
|
||||
}
|
||||
|
||||
override fun getOffsetTop(tile: QSPanelControllerBase.TileRecord?) = top
|
||||
|
||||
override fun updateResources(): Boolean {
|
||||
with(mContext.resources) {
|
||||
smallTileSize = getDimensionPixelSize(R.dimen.qs_quick_tile_size)
|
||||
cellMarginHorizontal = getDimensionPixelSize(R.dimen.qs_tile_margin_horizontal_two_line)
|
||||
cellMarginVertical = getDimensionPixelSize(R.dimen.new_qs_vertical_margin)
|
||||
}
|
||||
requestLayout()
|
||||
return false
|
||||
}
|
||||
|
||||
override fun setListening(listening: Boolean, uiEventLogger: UiEventLogger) {
|
||||
if (_listening == listening) return
|
||||
_listening = listening
|
||||
for (record in mRecords) {
|
||||
record.tile.setListening(this, listening)
|
||||
}
|
||||
if (listening) {
|
||||
for (i in 0 until numVisibleTiles) {
|
||||
val tile = mRecords[i].tile
|
||||
uiEventLogger.logWithInstanceId(
|
||||
QSEvent.QQS_TILE_VISIBLE, 0, tile.metricsSpec, tile.instanceId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getNumVisibleTiles() = Math.min(mRecords.size, tilesToShow)
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
updateResources()
|
||||
postInvalidate()
|
||||
}
|
||||
|
||||
override fun onFinishInflate() {
|
||||
updateResources()
|
||||
}
|
||||
|
||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||
|
||||
mRecords.forEach {
|
||||
it.tileView.measure(exactly(smallTileSize), exactly(smallTileSize))
|
||||
}
|
||||
|
||||
val height = twoLineHeight + paddingBottom + paddingTop
|
||||
setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), height)
|
||||
}
|
||||
|
||||
private fun calculateMaxColumns(availableWidth: Int): Int {
|
||||
if (smallTileSize + cellMarginHorizontal == 0) {
|
||||
return 0
|
||||
} else {
|
||||
return (availableWidth - smallTileSize) / (smallTileSize + cellMarginHorizontal) + 1
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
|
||||
val availableWidth = r - l - paddingLeft - paddingRight
|
||||
val maxColumns = calculateMaxColumns(availableWidth)
|
||||
val actualColumns = Math.min(maxColumns, mRecords.size / NUM_LINES)
|
||||
if (actualColumns == 0) {
|
||||
// No tileSize or horizontal margin
|
||||
return
|
||||
}
|
||||
tilesToShow = actualColumns * NUM_LINES
|
||||
|
||||
val spacePerTile = availableWidth / actualColumns
|
||||
|
||||
for (index in 0 until mRecords.size) {
|
||||
val tileView = mRecords[index].tileView
|
||||
if (index >= tilesToShow) {
|
||||
tileView.visibility = View.GONE
|
||||
} else {
|
||||
tileView.visibility = View.VISIBLE
|
||||
if (index > 0) tileView.updateAccessibilityOrder(mRecords[index - 1].tileView)
|
||||
val column = index % actualColumns
|
||||
val left = getLeftForColumn(column, spacePerTile)
|
||||
val top = if (index < actualColumns) 0 else getTopBottomRow()
|
||||
tileView.layout(left, top, left + smallTileSize, top + smallTileSize)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getLeftForColumn(column: Int, spacePerTile: Int): Int {
|
||||
// Distribute the space evenly among all tiles.
|
||||
return (column * spacePerTile + spacePerTile / 2.0f - smallTileSize / 2.0f).toInt()
|
||||
}
|
||||
|
||||
private fun getTopBottomRow() = smallTileSize + cellMarginVertical
|
||||
}
|
||||
@@ -332,9 +332,6 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
||||
|
||||
@Override
|
||||
public boolean updateResources() {
|
||||
setPadding(0, 0, 0,
|
||||
getContext().getResources().getDimensionPixelSize(
|
||||
R.dimen.qs_paged_tile_layout_padding_bottom));
|
||||
boolean changed = false;
|
||||
for (int i = 0; i < mPages.size(); i++) {
|
||||
changed |= mPages.get(i).updateResources();
|
||||
|
||||
@@ -199,10 +199,13 @@ public class QSContainerImpl extends FrameLayout {
|
||||
|
||||
void updateResources(QSPanelController qsPanelController,
|
||||
QuickStatusBarHeaderController quickStatusBarHeaderController) {
|
||||
LayoutParams layoutParams = (LayoutParams) mQSPanelContainer.getLayoutParams();
|
||||
layoutParams.topMargin = mContext.getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.quick_qs_offset_height);
|
||||
mQSPanelContainer.setLayoutParams(layoutParams);
|
||||
mQSPanelContainer.setPaddingRelative(
|
||||
getPaddingStart(),
|
||||
mContext.getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.quick_qs_offset_height),
|
||||
getPaddingEnd(),
|
||||
getPaddingBottom()
|
||||
);
|
||||
|
||||
int sideMargins = getResources().getDimensionPixelSize(R.dimen.notification_side_paddings);
|
||||
int padding = getResources().getDimensionPixelSize(
|
||||
|
||||
@@ -165,9 +165,23 @@ public class QSPanel extends LinearLayout implements Tunable {
|
||||
}
|
||||
addView(view, 0);
|
||||
mBrightnessView = view;
|
||||
|
||||
setBrightnessViewMargin();
|
||||
|
||||
mMovableContentStartIndex++;
|
||||
}
|
||||
|
||||
private void setBrightnessViewMargin() {
|
||||
if (mBrightnessView != null) {
|
||||
MarginLayoutParams lp = (MarginLayoutParams) mBrightnessView.getLayoutParams();
|
||||
lp.topMargin = mContext.getResources()
|
||||
.getDimensionPixelSize(R.dimen.qs_brightness_margin_top);
|
||||
lp.bottomMargin = mContext.getResources()
|
||||
.getDimensionPixelSize(R.dimen.qs_brightness_margin_bottom);
|
||||
mBrightnessView.setLayoutParams(lp);
|
||||
}
|
||||
}
|
||||
|
||||
/** */
|
||||
public QSTileLayout createRegularTileLayout() {
|
||||
if (mRegularTileLayout == null) {
|
||||
@@ -291,6 +305,8 @@ public class QSPanel extends LinearLayout implements Tunable {
|
||||
|
||||
updatePageIndicator();
|
||||
|
||||
setBrightnessViewMargin();
|
||||
|
||||
if (mTileLayout != null) {
|
||||
mTileLayout.updateResources();
|
||||
}
|
||||
|
||||
@@ -18,9 +18,7 @@ package com.android.systemui.qs;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
@@ -49,19 +47,6 @@ public class QuickQSPanel extends QSPanel {
|
||||
getResources().getInteger(R.integer.quick_qs_panel_max_columns));
|
||||
}
|
||||
|
||||
@Override
|
||||
void initialize() {
|
||||
super.initialize();
|
||||
applyBottomMargin((View) mRegularTileLayout);
|
||||
}
|
||||
|
||||
private void applyBottomMargin(View view) {
|
||||
int margin = getResources().getDimensionPixelSize(R.dimen.qs_header_tile_margin_bottom);
|
||||
MarginLayoutParams layoutParams = (MarginLayoutParams) view.getLayoutParams();
|
||||
layoutParams.bottomMargin = margin;
|
||||
view.setLayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBrightnessView(View view) {
|
||||
// Don't add brightness view
|
||||
@@ -188,150 +173,6 @@ public class QuickQSPanel extends QSPanel {
|
||||
return QSEvent.QQS_TILE_VISIBLE;
|
||||
}
|
||||
|
||||
private static class HeaderTileLayout extends TileLayout {
|
||||
|
||||
private Rect mClippingBounds = new Rect();
|
||||
|
||||
HeaderTileLayout(Context context) {
|
||||
super(context);
|
||||
setClipChildren(false);
|
||||
setClipToPadding(false);
|
||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.WRAP_CONTENT);
|
||||
lp.gravity = Gravity.CENTER_HORIZONTAL;
|
||||
setLayoutParams(lp);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
updateResources();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinishInflate(){
|
||||
super.onFinishInflate();
|
||||
updateResources();
|
||||
}
|
||||
|
||||
private LayoutParams generateTileLayoutParams() {
|
||||
LayoutParams lp = new LayoutParams(mCellWidth, mCellHeight);
|
||||
return lp;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addTileView(QSPanelControllerBase.TileRecord tile) {
|
||||
addView(tile.tileView, getChildCount(), generateTileLayoutParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
// We only care about clipping on the right side
|
||||
mClippingBounds.set(0, 0, r - l, 10000);
|
||||
setClipBounds(mClippingBounds);
|
||||
|
||||
calculateColumns();
|
||||
|
||||
for (int i = 0; i < mRecords.size(); i++) {
|
||||
mRecords.get(i).tileView.setVisibility( i < mColumns ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
setAccessibilityOrder();
|
||||
layoutTileRecords(mColumns);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateResources() {
|
||||
mCellWidth = mContext.getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_size);
|
||||
mCellHeight = mCellWidth;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean calculateColumns() {
|
||||
int prevNumColumns = mColumns;
|
||||
int maxTiles = mRecords.size();
|
||||
|
||||
if (maxTiles == 0){ // Early return during setup
|
||||
mColumns = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
final int availableWidth = getMeasuredWidth() - getPaddingStart() - getPaddingEnd();
|
||||
final int leftoverWhitespace = availableWidth - maxTiles * mCellWidth;
|
||||
|
||||
if (leftoverWhitespace > 0) {
|
||||
mCellMarginHorizontal = leftoverWhitespace / Math.max(1, maxTiles);
|
||||
mColumns = maxTiles;
|
||||
} else{
|
||||
mColumns = mCellWidth == 0 ? 1 :
|
||||
Math.min(maxTiles, availableWidth / mCellWidth );
|
||||
// If we can only fit one column, use mCellMarginHorizontal to center it.
|
||||
if (mColumns == 1) {
|
||||
mCellMarginHorizontal = (availableWidth - mCellWidth) / 2;
|
||||
} else {
|
||||
mCellMarginHorizontal =
|
||||
(availableWidth - mColumns * mCellWidth) / mColumns;
|
||||
}
|
||||
|
||||
}
|
||||
return mColumns != prevNumColumns;
|
||||
}
|
||||
|
||||
private void setAccessibilityOrder() {
|
||||
if (mRecords != null && mRecords.size() > 0) {
|
||||
View previousView = this;
|
||||
for (QSPanelControllerBase.TileRecord record : mRecords) {
|
||||
if (record.tileView.getVisibility() == GONE) continue;
|
||||
previousView = record.tileView.updateAccessibilityOrder(previousView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
// Measure each QS tile.
|
||||
for (QSPanelControllerBase.TileRecord record : mRecords) {
|
||||
if (record.tileView.getVisibility() == GONE) continue;
|
||||
record.tileView.measure(exactly(mCellWidth), exactly(mCellHeight));
|
||||
}
|
||||
|
||||
int height = mCellHeight;
|
||||
if (height < 0) height = 0;
|
||||
|
||||
setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumVisibleTiles() {
|
||||
return Math.min(mRecords.size(), mColumns);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getColumnStart(int column) {
|
||||
if (mColumns == 1) {
|
||||
// Only one column/tile. Use the margin to center the tile.
|
||||
return getPaddingStart() + mCellMarginHorizontal;
|
||||
}
|
||||
return getPaddingStart() + mCellMarginHorizontal / 2
|
||||
+ column * (mCellWidth + mCellMarginHorizontal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setListening(boolean listening, UiEventLogger uiEventLogger) {
|
||||
boolean startedListening = !mListening && listening;
|
||||
super.setListening(listening, uiEventLogger);
|
||||
if (startedListening) {
|
||||
// getNumVisibleTiles() <= mRecords.size()
|
||||
for (int i = 0; i < getNumVisibleTiles(); i++) {
|
||||
QSTile tile = mRecords.get(i).tile;
|
||||
uiEventLogger.logWithInstanceId(QSEvent.QQS_TILE_VISIBLE, 0,
|
||||
tile.getMetricsSpec(), tile.getInstanceId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class QQSSideLabelTileLayout extends SideLabelTileLayout {
|
||||
|
||||
QQSSideLabelTileLayout(Context context) {
|
||||
|
||||
@@ -225,6 +225,12 @@ public class QuickStatusBarHeader extends FrameLayout {
|
||||
mBatteryRemainingIcon.updateColors(mTextColorPrimary, textColorSecondary,
|
||||
mTextColorPrimary);
|
||||
}
|
||||
|
||||
MarginLayoutParams qqsLP = (MarginLayoutParams) mHeaderQsPanel.getLayoutParams();
|
||||
qqsLP.topMargin = mContext.getResources()
|
||||
.getDimensionPixelSize(R.dimen.qqs_layout_margin_top);
|
||||
mHeaderQsPanel.setLayoutParams(qqsLP);
|
||||
|
||||
updateHeadersPadding();
|
||||
updateAnimators();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import java.util.ArrayList;
|
||||
public class TileLayout extends ViewGroup implements QSTileLayout {
|
||||
|
||||
public static final int NO_MAX_COLUMNS = 100;
|
||||
private static final float TILE_ASPECT = 1.2f;
|
||||
|
||||
private static final String TAG = "TileLayout";
|
||||
|
||||
@@ -34,7 +33,6 @@ public class TileLayout extends ViewGroup implements QSTileLayout {
|
||||
protected int mRows = 1;
|
||||
|
||||
protected final ArrayList<TileRecord> mRecords = new ArrayList<>();
|
||||
private int mCellMarginTop;
|
||||
protected boolean mListening;
|
||||
protected int mMaxAllowedRows = 3;
|
||||
|
||||
@@ -123,7 +121,6 @@ public class TileLayout extends ViewGroup implements QSTileLayout {
|
||||
mCellMarginHorizontal = res.getDimensionPixelSize(R.dimen.qs_tile_margin_horizontal);
|
||||
mSidePadding = useSidePadding() ? mCellMarginHorizontal / 2 : 0;
|
||||
mCellMarginVertical= res.getDimensionPixelSize(R.dimen.qs_tile_margin_vertical);
|
||||
mCellMarginTop = res.getDimensionPixelSize(R.dimen.qs_tile_margin_top);
|
||||
mMaxAllowedRows = Math.max(1, getResources().getInteger(R.integer.quick_settings_max_rows));
|
||||
if (mLessRows) mMaxAllowedRows = Math.max(mMinRows, mMaxAllowedRows - 1);
|
||||
if (updateColumns()) {
|
||||
@@ -169,10 +166,7 @@ public class TileLayout extends ViewGroup implements QSTileLayout {
|
||||
mCellHeight = record.tileView.getMeasuredHeight();
|
||||
}
|
||||
|
||||
// Only include the top margin in our measurement if we have more than 1 row to show.
|
||||
// Otherwise, don't add the extra margin buffer at top.
|
||||
int height = (mCellHeight + mCellMarginVertical) * mRows +
|
||||
(mRows != 0 ? (mCellMarginTop - mCellMarginVertical) : 0);
|
||||
int height = (mCellHeight + mCellMarginVertical) * mRows;
|
||||
if (height < 0) height = 0;
|
||||
|
||||
setMeasuredDimension(width, height);
|
||||
@@ -186,9 +180,8 @@ public class TileLayout extends ViewGroup implements QSTileLayout {
|
||||
* @param tilesCount Upper limit on the number of tiles to show. to prevent empty rows.
|
||||
*/
|
||||
public boolean updateMaxRows(int allowedHeight, int tilesCount) {
|
||||
final int availableHeight = allowedHeight - mCellMarginTop
|
||||
// Add the cell margin in order to divide easily by the height + the margin below
|
||||
+ mCellMarginVertical;
|
||||
// Add the cell margin in order to divide easily by the height + the margin below
|
||||
final int availableHeight = allowedHeight + mCellMarginVertical;
|
||||
final int previousRows = mRows;
|
||||
mRows = availableHeight / (getCellHeight() + mCellMarginVertical);
|
||||
if (mRows < mMinRows) {
|
||||
@@ -243,7 +236,7 @@ public class TileLayout extends ViewGroup implements QSTileLayout {
|
||||
}
|
||||
|
||||
protected int getRowTop(int row) {
|
||||
return row * (mCellHeight + mCellMarginVertical) + mCellMarginTop;
|
||||
return row * (mCellHeight + mCellMarginVertical);
|
||||
}
|
||||
|
||||
protected int getColumnStart(int column) {
|
||||
|
||||
Reference in New Issue
Block a user