Merge "Calculate min height for header in code" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
04269d836b
@@ -21,6 +21,5 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:minHeight="@dimen/qs_customize_header_min_height"
|
|
||||||
android:textAppearance="@style/TextAppearance.QSEdit"
|
android:textAppearance="@style/TextAppearance.QSEdit"
|
||||||
android:text="@string/drag_to_rearrange_tiles" />
|
android:text="@string/drag_to_rearrange_tiles" />
|
||||||
@@ -25,11 +25,6 @@
|
|||||||
<dimen name="qs_brightness_margin_top">0dp</dimen>
|
<dimen name="qs_brightness_margin_top">0dp</dimen>
|
||||||
<dimen name="qs_brightness_margin_bottom">12dp</dimen>
|
<dimen name="qs_brightness_margin_bottom">12dp</dimen>
|
||||||
<dimen name="qqs_layout_margin_top">8dp</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_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">48dp</dimen>
|
|
||||||
|
|
||||||
<!-- In landscape the security footer is actually part of the header,
|
<!-- In landscape the security footer is actually part of the header,
|
||||||
and needs to be as short as the header -->
|
and needs to be as short as the header -->
|
||||||
|
|||||||
@@ -476,11 +476,7 @@
|
|||||||
<dimen name="qs_brightness_margin_top">8dp</dimen>
|
<dimen name="qs_brightness_margin_top">8dp</dimen>
|
||||||
<dimen name="qs_brightness_margin_bottom">24dp</dimen>
|
<dimen name="qs_brightness_margin_bottom">24dp</dimen>
|
||||||
<dimen name="qqs_layout_margin_top">16dp</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_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">68dp</dimen>
|
|
||||||
<dimen name="qs_customize_internal_side_paddings">8dp</dimen>
|
<dimen name="qs_customize_internal_side_paddings">8dp</dimen>
|
||||||
<dimen name="qs_icon_size">20dp</dimen>
|
<dimen name="qs_icon_size">20dp</dimen>
|
||||||
<dimen name="qs_side_view_size">28dp</dimen>
|
<dimen name="qs_side_view_size">28dp</dimen>
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ public class QSCustomizer extends LinearLayout {
|
|||||||
LayoutParams lp = (LayoutParams) mTransparentView.getLayoutParams();
|
LayoutParams lp = (LayoutParams) mTransparentView.getLayoutParams();
|
||||||
lp.height = QSUtils.getQsHeaderSystemIconsAreaHeight(mContext);
|
lp.height = QSUtils.getQsHeaderSystemIconsAreaHeight(mContext);
|
||||||
mTransparentView.setLayoutParams(lp);
|
mTransparentView.setLayoutParams(lp);
|
||||||
|
mRecyclerView.getAdapter().notifyItemChanged(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateNavBackDrop(Configuration newConfig, LightBarController lightBarController) {
|
void updateNavBackDrop(Configuration newConfig, LightBarController lightBarController) {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ package com.android.systemui.qs.customize;
|
|||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
@@ -277,7 +278,9 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta
|
|||||||
final Context context = parent.getContext();
|
final Context context = parent.getContext();
|
||||||
LayoutInflater inflater = LayoutInflater.from(context);
|
LayoutInflater inflater = LayoutInflater.from(context);
|
||||||
if (viewType == TYPE_HEADER) {
|
if (viewType == TYPE_HEADER) {
|
||||||
return new Holder(inflater.inflate(R.layout.qs_customize_header, parent, false));
|
View v = inflater.inflate(R.layout.qs_customize_header, parent, false);
|
||||||
|
v.setMinimumHeight(calculateHeaderMinHeight(context));
|
||||||
|
return new Holder(v);
|
||||||
}
|
}
|
||||||
if (viewType == TYPE_DIVIDER) {
|
if (viewType == TYPE_DIVIDER) {
|
||||||
return new Holder(inflater.inflate(R.layout.qs_customize_tile_divider, parent, false));
|
return new Holder(inflater.inflate(R.layout.qs_customize_tile_divider, parent, false));
|
||||||
@@ -835,4 +838,26 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta
|
|||||||
super.clearView(recyclerView, viewHolder);
|
super.clearView(recyclerView, viewHolder);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static int calculateHeaderMinHeight(Context context) {
|
||||||
|
Resources res = context.getResources();
|
||||||
|
// style used in qs_customize_header.xml for the Toolbar
|
||||||
|
TypedArray toolbarStyle = context.obtainStyledAttributes(
|
||||||
|
R.style.QSCustomizeToolbar, com.android.internal.R.styleable.Toolbar);
|
||||||
|
int buttonStyle = toolbarStyle.getResourceId(
|
||||||
|
com.android.internal.R.styleable.Toolbar_navigationButtonStyle, 0);
|
||||||
|
toolbarStyle.recycle();
|
||||||
|
int buttonMinWidth = 0;
|
||||||
|
if (buttonStyle != 0) {
|
||||||
|
TypedArray t = context.obtainStyledAttributes(buttonStyle, android.R.styleable.View);
|
||||||
|
buttonMinWidth = t.getDimensionPixelSize(android.R.styleable.View_minWidth, 0);
|
||||||
|
t.recycle();
|
||||||
|
}
|
||||||
|
return res.getDimensionPixelSize(R.dimen.qs_panel_padding_top)
|
||||||
|
+ res.getDimensionPixelSize(R.dimen.brightness_mirror_height)
|
||||||
|
+ res.getDimensionPixelSize(R.dimen.qs_brightness_margin_top)
|
||||||
|
+ res.getDimensionPixelSize(R.dimen.qs_brightness_margin_bottom)
|
||||||
|
- buttonMinWidth
|
||||||
|
- res.getDimensionPixelSize(R.dimen.qs_tile_margin_top_bottom);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user