@@ -61,6 +61,7 @@ public class QSPanel extends ViewGroup {
6161 private int mLargeCellHeight ;
6262 private int mPanelPaddingBottom ;
6363 private int mDualTileUnderlap ;
64+ private int mBrightnessPaddingTop ;
6465 private boolean mExpanded ;
6566 private boolean mListening ;
6667
@@ -136,6 +137,7 @@ public void updateResources() {
136137 mLargeCellWidth = (int )(mLargeCellHeight * TILE_ASPECT );
137138 mPanelPaddingBottom = res .getDimensionPixelSize (R .dimen .qs_panel_padding_bottom );
138139 mDualTileUnderlap = res .getDimensionPixelSize (R .dimen .qs_dual_tile_padding_vertical );
140+ mBrightnessPaddingTop = res .getDimensionPixelSize (R .dimen .qs_brightness_padding_top );
139141 if (mColumns != columns ) {
140142 mColumns = columns ;
141143 postInvalidate ();
@@ -320,6 +322,7 @@ public void onClick(View v) {
320322 protected void onMeasure (int widthMeasureSpec , int heightMeasureSpec ) {
321323 final int width = MeasureSpec .getSize (widthMeasureSpec );
322324 mBrightnessView .measure (exactly (width ), MeasureSpec .UNSPECIFIED );
325+ final int brightnessHeight = mBrightnessView .getMeasuredHeight () + mBrightnessPaddingTop ;
323326 mFooter .getView ().measure (exactly (width ), MeasureSpec .UNSPECIFIED );
324327 int r = -1 ;
325328 int c = -1 ;
@@ -348,9 +351,9 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
348351 final int ch = record .row == 0 ? mLargeCellHeight : mCellHeight ;
349352 record .tileView .measure (exactly (cw ), exactly (ch ));
350353 }
351- int h = rows == 0 ? mBrightnessView . getHeight () : (getRowTop (rows ) + mPanelPaddingBottom );
354+ int h = rows == 0 ? brightnessHeight : (getRowTop (rows ) + mPanelPaddingBottom );
352355 if (mFooter .hasFooter ()) {
353- h += mFooter .getView ().getHeight ();
356+ h += mFooter .getView ().getMeasuredHeight ();
354357 }
355358 mDetail .measure (exactly (width ), MeasureSpec .UNSPECIFIED );
356359 if (mDetail .getMeasuredHeight () < h ) {
@@ -366,8 +369,9 @@ private static int exactly(int size) {
366369 @ Override
367370 protected void onLayout (boolean changed , int l , int t , int r , int b ) {
368371 final int w = getWidth ();
369- mBrightnessView .layout (0 , 0 ,
370- mBrightnessView .getMeasuredWidth (), mBrightnessView .getMeasuredHeight ());
372+ mBrightnessView .layout (0 , mBrightnessPaddingTop ,
373+ mBrightnessView .getMeasuredWidth (),
374+ mBrightnessPaddingTop + mBrightnessView .getMeasuredHeight ());
371375 for (TileRecord record : mRecords ) {
372376 if (record .tileView .getVisibility () == GONE ) continue ;
373377 final int cols = getColumnCount (record .row );
@@ -389,8 +393,8 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
389393 }
390394
391395 private int getRowTop (int row ) {
392- if (row <= 0 ) return mBrightnessView .getHeight () ;
393- return mBrightnessView .getHeight ()
396+ if (row <= 0 ) return mBrightnessView .getMeasuredHeight () + mBrightnessPaddingTop ;
397+ return mBrightnessView .getMeasuredHeight () + mBrightnessPaddingTop
394398 + mLargeCellHeight - mDualTileUnderlap + (row - 1 ) * mCellHeight ;
395399 }
396400
0 commit comments