Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/widget/PaddedFrameLayout.java

Issue 1343433002: Add landscape specs for Data Reduction Proxy promo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.widget; 5 package org.chromium.chrome.browser.widget;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.res.TypedArray; 8 import android.content.res.TypedArray;
9 import android.util.AttributeSet; 9 import android.util.AttributeSet;
10 import android.widget.FrameLayout; 10 import android.widget.FrameLayout;
(...skipping 27 matching lines...) Expand all
38 public PaddedFrameLayout(Context context, AttributeSet attrs) { 38 public PaddedFrameLayout(Context context, AttributeSet attrs) {
39 super(context, attrs); 39 super(context, attrs);
40 TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PaddedF rameLayout); 40 TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PaddedF rameLayout);
41 mMaxChildWidth = a.getDimensionPixelSize( 41 mMaxChildWidth = a.getDimensionPixelSize(
42 R.styleable.PaddedFrameLayout_maxChildWidth, NO_MAX_SIZE); 42 R.styleable.PaddedFrameLayout_maxChildWidth, NO_MAX_SIZE);
43 mMaxChildHeight = a.getDimensionPixelSize( 43 mMaxChildHeight = a.getDimensionPixelSize(
44 R.styleable.PaddedFrameLayout_maxChildHeight, NO_MAX_SIZE); 44 R.styleable.PaddedFrameLayout_maxChildHeight, NO_MAX_SIZE);
45 a.recycle(); 45 a.recycle();
46 } 46 }
47 47
48 protected void setMaxChildWidth(int maxChildWidth) {
49 mMaxChildWidth = maxChildWidth;
50 }
51
52 protected void setMaxChildHeight(int maxChildHeight) {
53 mMaxChildHeight = maxChildHeight;
54 }
55
48 @Override 56 @Override
49 protected void onFinishInflate() { 57 protected void onFinishInflate() {
50 super.onFinishInflate(); 58 super.onFinishInflate();
51 mHorizontalPadding = getPaddingLeft(); 59 mHorizontalPadding = getPaddingLeft();
52 mTopPadding = getPaddingTop(); 60 mTopPadding = getPaddingTop();
53 mBottomPadding = getPaddingBottom(); 61 mBottomPadding = getPaddingBottom();
54 } 62 }
55 63
56 @Override 64 @Override
57 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 65 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
(...skipping 18 matching lines...) Expand all
76 topPadding += excessHeight / 2; 84 topPadding += excessHeight / 2;
77 bottomPadding += excessHeight / 2; 85 bottomPadding += excessHeight / 2;
78 } 86 }
79 } 87 }
80 setPadding(horizontalPadding, topPadding, horizontalPadding, bottomPaddi ng); 88 setPadding(horizontalPadding, topPadding, horizontalPadding, bottomPaddi ng);
81 89
82 super.onMeasure(widthMeasureSpec, heightMeasureSpec); 90 super.onMeasure(widthMeasureSpec, heightMeasureSpec);
83 } 91 }
84 92
85 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698