OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.firstrun; | 5 package org.chromium.chrome.browser.firstrun; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.util.AttributeSet; | 8 import android.util.AttributeSet; |
9 import android.widget.FrameLayout; | 9 import android.widget.FrameLayout; |
10 import android.widget.LinearLayout; | 10 import android.widget.LinearLayout; |
(...skipping 13 matching lines...) Expand all Loading... |
24 @Override | 24 @Override |
25 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | 25 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
26 // This assumes that view's layout_width is set to match_parent. | 26 // This assumes that view's layout_width is set to match_parent. |
27 assert MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY; | 27 assert MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY; |
28 int width = MeasureSpec.getSize(widthMeasureSpec); | 28 int width = MeasureSpec.getSize(widthMeasureSpec); |
29 int height = MeasureSpec.getSize(heightMeasureSpec); | 29 int height = MeasureSpec.getSize(heightMeasureSpec); |
30 LinearLayout content = (LinearLayout) findViewById(R.id.fre_content); | 30 LinearLayout content = (LinearLayout) findViewById(R.id.fre_content); |
31 LinearLayout wrapper = (LinearLayout) findViewById(R.id.text_wrapper); | 31 LinearLayout wrapper = (LinearLayout) findViewById(R.id.text_wrapper); |
32 MarginLayoutParams params = (MarginLayoutParams) wrapper.getLayoutParams
(); | 32 MarginLayoutParams params = (MarginLayoutParams) wrapper.getLayoutParams
(); |
33 int paddingStart = 0; | 33 int paddingStart = 0; |
34 if (width >= 2 * getResources().getDimension(R.dimen.signin_image_carous
el_width) | 34 if (width >= 2 * getResources().getDimension(R.dimen.fre_image_carousel_
width) |
35 && width > height) { | 35 && width > height) { |
36 content.setOrientation(LinearLayout.HORIZONTAL); | 36 content.setOrientation(LinearLayout.HORIZONTAL); |
37 paddingStart = getResources().getDimensionPixelSize(R.dimen.fre_marg
in); | 37 paddingStart = getResources().getDimensionPixelSize(R.dimen.fre_marg
in); |
38 params.width = 0; | 38 params.width = 0; |
39 params.height = LayoutParams.WRAP_CONTENT; | 39 params.height = LayoutParams.WRAP_CONTENT; |
40 } else { | 40 } else { |
41 content.setOrientation(LinearLayout.VERTICAL); | 41 content.setOrientation(LinearLayout.VERTICAL); |
42 params.width = LayoutParams.WRAP_CONTENT; | 42 params.width = LayoutParams.WRAP_CONTENT; |
43 params.height = 0; | 43 params.height = 0; |
44 } | 44 } |
45 ApiCompatibilityUtils.setPaddingRelative(content, | 45 ApiCompatibilityUtils.setPaddingRelative(content, |
46 paddingStart, | 46 paddingStart, |
47 content.getPaddingTop(), | 47 content.getPaddingTop(), |
48 ApiCompatibilityUtils.getPaddingEnd(content), | 48 ApiCompatibilityUtils.getPaddingEnd(content), |
49 content.getPaddingBottom()); | 49 content.getPaddingBottom()); |
50 wrapper.setLayoutParams(params); | 50 wrapper.setLayoutParams(params); |
51 super.onMeasure(widthMeasureSpec, heightMeasureSpec); | 51 super.onMeasure(widthMeasureSpec, heightMeasureSpec); |
52 } | 52 } |
53 } | 53 } |
OLD | NEW |