Tablet Settings Layout is no longer stretched

Change-Id: If4a883077f41b859f4e8aaf92a4f397b94814137
Fixes: 31583422
Tests: Visual Inspection
This commit is contained in:
Matthew Fritze
2016-09-28 14:30:17 -07:00
parent 59d2b185f3
commit c4a9b18121
7 changed files with 22 additions and 5 deletions

View File

@@ -20,4 +20,6 @@
android:id="@+id/sliding_tabs" android:id="@+id/sliding_tabs"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dashboard_header_margin_left"
android:layout_marginRight="@dimen/dashboard_header_margin_right"
android:background="?android:attr/colorPrimary"/> android:background="?android:attr/colorPrimary"/>

View File

@@ -21,4 +21,5 @@
android:id="@+id/main_content" android:id="@+id/main_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:background="@color/material_grey_300"
/> />

View File

@@ -15,7 +15,7 @@
limitations under the License. limitations under the License.
--> -->
<Space <View
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/support_spacer_height" android:layout_height="@dimen/support_spacer_height"

View File

@@ -18,8 +18,12 @@
<dimen name="settings_side_margin">112dp</dimen> <dimen name="settings_side_margin">112dp</dimen>
<!-- Dashboard padding in its container --> <!-- Dashboard padding in its container -->
<dimen name="dashboard_padding_start">128dp</dimen> <dimen name="dashboard_padding_start">160dp</dimen>
<dimen name="dashboard_padding_end">128dp</dimen> <dimen name="dashboard_padding_end">160dp</dimen>
<!-- Dashboard Header margin in its container -->
<dimen name="dashboard_header_margin_right">304dp</dimen>
<dimen name="dashboard_header_margin_left">304dp</dimen>
<!-- ActionBar contentInsetStart --> <!-- ActionBar contentInsetStart -->
<dimen name="actionbar_contentInsetStart">128dp</dimen> <dimen name="actionbar_contentInsetStart">128dp</dimen>

View File

@@ -42,6 +42,10 @@
<dimen name="dashboard_padding_start">80dp</dimen> <dimen name="dashboard_padding_start">80dp</dimen>
<dimen name="dashboard_padding_end">80dp</dimen> <dimen name="dashboard_padding_end">80dp</dimen>
<!-- Dashboard Header margin in its container -->
<dimen name="dashboard_header_margin_right">176dp</dimen>
<dimen name="dashboard_header_margin_left">176dp</dimen>
<!-- Dashboard category padding start / end --> <!-- Dashboard category padding start / end -->
<dimen name="dashboard_category_padding_start">24dp</dimen> <dimen name="dashboard_category_padding_start">24dp</dimen>
<dimen name="dashboard_category_padding_end">24dp</dimen> <dimen name="dashboard_category_padding_end">24dp</dimen>

View File

@@ -96,6 +96,10 @@
<dimen name="dashboard_padding_top">0dp</dimen> <dimen name="dashboard_padding_top">0dp</dimen>
<dimen name="dashboard_padding_bottom">0dp</dimen> <dimen name="dashboard_padding_bottom">0dp</dimen>
<!-- Dashboard Header margin in its container -->
<dimen name="dashboard_header_margin_right">0dp</dimen>
<dimen name="dashboard_header_margin_left">0dp</dimen>
<!-- Dashboard category padding start / end --> <!-- Dashboard category padding start / end -->
<dimen name="dashboard_category_padding_start">0dp</dimen> <dimen name="dashboard_category_padding_start">0dp</dimen>
<dimen name="dashboard_category_padding_end">0dp</dimen> <dimen name="dashboard_category_padding_end">0dp</dimen>

View File

@@ -83,19 +83,21 @@ public final class SlidingTabLayout extends FrameLayout implements View.OnClickL
@Override @Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) { protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (mTitleView.getChildCount() > 0) { if (mTitleView.getChildCount() > 0) {
mTitleView.layout(0, 0, mTitleView.getMeasuredWidth(), mTitleView.getMeasuredHeight());
final int indicatorBottom = getMeasuredHeight(); final int indicatorBottom = getMeasuredHeight();
final int indicatorHeight = mIndicatorView.getMeasuredHeight(); final int indicatorHeight = mIndicatorView.getMeasuredHeight();
final int indicatorWidth = mIndicatorView.getMeasuredWidth(); final int indicatorWidth = mIndicatorView.getMeasuredWidth();
final int totalWidth = getMeasuredWidth(); final int totalWidth = getMeasuredWidth();
final int leftPadding = getPaddingLeft();
final int rightPadding = getPaddingRight();
mTitleView.layout(leftPadding, 0, mTitleView.getMeasuredWidth() + rightPadding,
mTitleView.getMeasuredHeight());
// IndicatorView should start on the right when RTL mode is enabled // IndicatorView should start on the right when RTL mode is enabled
if (isRtlMode()) { if (isRtlMode()) {
mIndicatorView.layout(totalWidth - indicatorWidth, mIndicatorView.layout(totalWidth - indicatorWidth,
indicatorBottom - indicatorHeight, totalWidth, indicatorBottom - indicatorHeight, totalWidth,
indicatorBottom); indicatorBottom);
} else { } else {
mIndicatorView.layout(0, indicatorBottom - indicatorHeight, mIndicatorView.layout(0, indicatorBottom - indicatorHeight,
indicatorWidth, indicatorBottom); indicatorWidth, indicatorBottom);
} }