Merge "Tablet Settings Layout is no longer stretched" into nyc-mr1-dev

This commit is contained in:
TreeHugger Robot
2016-09-29 00:16:23 +00:00
committed by Android (Google) Code Review
7 changed files with 22 additions and 5 deletions

View File

@@ -20,4 +20,6 @@
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
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"/>

View File

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

View File

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

View File

@@ -18,8 +18,12 @@
<dimen name="settings_side_margin">112dp</dimen>
<!-- Dashboard padding in its container -->
<dimen name="dashboard_padding_start">128dp</dimen>
<dimen name="dashboard_padding_end">128dp</dimen>
<dimen name="dashboard_padding_start">160dp</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 -->
<dimen name="actionbar_contentInsetStart">128dp</dimen>

View File

@@ -42,6 +42,10 @@
<dimen name="dashboard_padding_start">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 -->
<dimen name="dashboard_category_padding_start">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_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 -->
<dimen name="dashboard_category_padding_start">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
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (mTitleView.getChildCount() > 0) {
mTitleView.layout(0, 0, mTitleView.getMeasuredWidth(), mTitleView.getMeasuredHeight());
final int indicatorBottom = getMeasuredHeight();
final int indicatorHeight = mIndicatorView.getMeasuredHeight();
final int indicatorWidth = mIndicatorView.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
if (isRtlMode()) {
mIndicatorView.layout(totalWidth - indicatorWidth,
indicatorBottom - indicatorHeight, totalWidth,
indicatorBottom);
} else {
mIndicatorView.layout(0, indicatorBottom - indicatorHeight,
indicatorWidth, indicatorBottom);
}