1f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski/*
2f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * Copyright (C) 2015 The Android Open Source Project
3f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *
4f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * Licensed under the Apache License, Version 2.0 (the "License");
5f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * you may not use this file except in compliance with the License.
6f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * You may obtain a copy of the License at
7f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *
8f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *      http://www.apache.org/licenses/LICENSE-2.0
9f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *
10f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * Unless required by applicable law or agreed to in writing, software
11f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * distributed under the License is distributed on an "AS IS" BASIS,
12f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * See the License for the specific language governing permissions and
14f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * limitations under the License.
15f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski */
16f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski
17f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynskipackage android.support.percent;
18f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski
19f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynskiimport android.content.Context;
20f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynskiimport android.content.res.TypedArray;
21f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynskiimport android.util.AttributeSet;
22f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynskiimport android.view.ViewGroup;
23f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynskiimport android.widget.RelativeLayout;
24f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski
25f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski/**
26f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * Subclass of {@link android.widget.RelativeLayout} that supports percentage based dimensions and
27f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * margins.
28f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *
29f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * You can specify dimension or a margin of child by using attributes with "Percent" suffix. Follow
30f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * this example:
31f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *
32f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * <pre class="prettyprint">
33f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * &lt;android.support.percent.PercentRelativeLayout
34f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *         xmlns:android="http://schemas.android.com/apk/res/android"
35f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *         xmlns:app="http://schemas.android.com/apk/res-auto"
36f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *         android:layout_width="match_parent"
37300da29db1ab98a0e0e1ac5bf15c836f40ebfd5fFilip Gruszczynski *         android:layout_height="match_parent"&gt
38f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *     &lt;ImageView
39f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *         app:layout_widthPercent="50%"
40f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *         app:layout_heightPercent="50%"
41f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *         app:layout_marginTopPercent="25%"
42f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *         app:layout_marginLeftPercent="25%"/&gt
431ef18f3d2e3141031c0cb83167f952db71ec63fbAurimas Liutikas * &lt;/android.support.percent.PercentRelativeLayout&gt
44f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * </pre>
45f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *
46f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * The attributes that you can use are:
47f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * <ul>
48f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *     <li>{@code layout_widthPercent}
49f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *     <li>{@code layout_heightPercent}
50f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *     <li>{@code layout_marginPercent}
51f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *     <li>{@code layout_marginLeftPercent}
52f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *     <li>{@code layout_marginTopPercent}
53f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *     <li>{@code layout_marginRightPercent}
54f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *     <li>{@code layout_marginBottomPercent}
55f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *     <li>{@code layout_marginStartPercent}
56f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *     <li>{@code layout_marginEndPercent}
57300da29db1ab98a0e0e1ac5bf15c836f40ebfd5fFilip Gruszczynski *     <li>{@code layout_aspectRatio}
58f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * </ul>
59f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski *
60f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * It is not necessary to specify {@code layout_width/height} if you specify {@code
61f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * layout_widthPercent.} However, if you want the view to be able to take up more space than what
62f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * percentage value permits, you can add {@code layout_width/height="wrap_content"}. In that case
63f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * if the percentage size is too small for the View's content, it will be resized using
64f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski * {@code wrap_content} rule.
65300da29db1ab98a0e0e1ac5bf15c836f40ebfd5fFilip Gruszczynski *
66300da29db1ab98a0e0e1ac5bf15c836f40ebfd5fFilip Gruszczynski * <p>
67300da29db1ab98a0e0e1ac5bf15c836f40ebfd5fFilip Gruszczynski * You can also make one dimension be a fraction of the other by setting only width or height and
68300da29db1ab98a0e0e1ac5bf15c836f40ebfd5fFilip Gruszczynski * using {@code layout_aspectRatio} for the second one to be calculated automatically. For
69300da29db1ab98a0e0e1ac5bf15c836f40ebfd5fFilip Gruszczynski * example, if you would like to achieve 16:9 aspect ratio, you can write:
70300da29db1ab98a0e0e1ac5bf15c836f40ebfd5fFilip Gruszczynski * <pre class="prettyprint">
71300da29db1ab98a0e0e1ac5bf15c836f40ebfd5fFilip Gruszczynski *     android:layout_width="300dp"
72300da29db1ab98a0e0e1ac5bf15c836f40ebfd5fFilip Gruszczynski *     app:layout_aspectRatio="178%"
73300da29db1ab98a0e0e1ac5bf15c836f40ebfd5fFilip Gruszczynski * </pre>
74300da29db1ab98a0e0e1ac5bf15c836f40ebfd5fFilip Gruszczynski * This will make the aspect ratio 16:9 (1.78:1) with the width fixed at 300dp and height adjusted
75300da29db1ab98a0e0e1ac5bf15c836f40ebfd5fFilip Gruszczynski * accordingly.
76199e575893be653ba3088c19e95adda62b8344fbAga Madurska *
77199e575893be653ba3088c19e95adda62b8344fbAga Madurska * @deprecated consider using ConstraintLayout and associated layouts instead. The following shows
78199e575893be653ba3088c19e95adda62b8344fbAga Madurska * how to replicate the functionality of percentage layouts with a ConstraintLayout. The Guidelines
79199e575893be653ba3088c19e95adda62b8344fbAga Madurska * are used to define each percentage break point, and then a Button view is stretched to fill
80199e575893be653ba3088c19e95adda62b8344fbAga Madurska * the gap:
81199e575893be653ba3088c19e95adda62b8344fbAga Madurska *
82199e575893be653ba3088c19e95adda62b8344fbAga Madurska * <pre class="prettyprint">
83199e575893be653ba3088c19e95adda62b8344fbAga Madurska * &lt;android.support.constraint.ConstraintLayout
84199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         xmlns:android="http://schemas.android.com/apk/res/android"
85199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         xmlns:app="http://schemas.android.com/apk/res-auto"
86199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:layout_width="match_parent"
87199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:layout_height="match_parent"&gt
88199e575893be653ba3088c19e95adda62b8344fbAga Madurska *
89199e575893be653ba3088c19e95adda62b8344fbAga Madurska *     &lt;android.support.constraint.Guideline
90199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:layout_width="wrap_content"
91199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:layout_height="wrap_content"
92199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:id="@+id/left_guideline"
93199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         app:layout_constraintGuide_percent=".15"
94199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:orientation="vertical"/&gt
95199e575893be653ba3088c19e95adda62b8344fbAga Madurska *
96199e575893be653ba3088c19e95adda62b8344fbAga Madurska *     &lt;android.support.constraint.Guideline
97199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:layout_width="wrap_content"
98199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:layout_height="wrap_content"
99199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:id="@+id/right_guideline"
100199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         app:layout_constraintGuide_percent=".85"
101199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:orientation="vertical"/&gt
102199e575893be653ba3088c19e95adda62b8344fbAga Madurska *
103199e575893be653ba3088c19e95adda62b8344fbAga Madurska *     &lt;android.support.constraint.Guideline
104199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:layout_width="wrap_content"
105199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:layout_height="wrap_content"
106199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:id="@+id/top_guideline"
107199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         app:layout_constraintGuide_percent=".15"
108199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:orientation="horizontal"/&gt
109199e575893be653ba3088c19e95adda62b8344fbAga Madurska *
110199e575893be653ba3088c19e95adda62b8344fbAga Madurska *     &lt;android.support.constraint.Guideline
111199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:layout_width="wrap_content"
112199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:layout_height="wrap_content"
113199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:id="@+id/bottom_guideline"
114199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         app:layout_constraintGuide_percent=".85"
115199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:orientation="horizontal"/&gt
116199e575893be653ba3088c19e95adda62b8344fbAga Madurska *
117199e575893be653ba3088c19e95adda62b8344fbAga Madurska *     &lt;Button
118199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:text="Button"
119199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:layout_width="0dp"
120199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:layout_height="0dp"
121199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         android:id="@+id/button"
122199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         app:layout_constraintLeft_toLeftOf="@+id/left_guideline"
123199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         app:layout_constraintRight_toRightOf="@+id/right_guideline"
124199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         app:layout_constraintTop_toTopOf="@+id/top_guideline"
125199e575893be653ba3088c19e95adda62b8344fbAga Madurska *         app:layout_constraintBottom_toBottomOf="@+id/bottom_guideline" /&gt
126199e575893be653ba3088c19e95adda62b8344fbAga Madurska *
127199e575893be653ba3088c19e95adda62b8344fbAga Madurska * &lt;/android.support.constraint.ConstraintLayout&gt
128f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski */
129199e575893be653ba3088c19e95adda62b8344fbAga Madurska@Deprecated
130f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynskipublic class PercentRelativeLayout extends RelativeLayout {
131f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    private final PercentLayoutHelper mHelper = new PercentLayoutHelper(this);
132f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski
133f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    public PercentRelativeLayout(Context context) {
134f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        super(context);
135f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    }
136f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski
137f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    public PercentRelativeLayout(Context context, AttributeSet attrs) {
138f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        super(context, attrs);
139f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    }
140f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski
141f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    public PercentRelativeLayout(Context context, AttributeSet attrs, int defStyle) {
142f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        super(context, attrs, defStyle);
143f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    }
144f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski
145f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    @Override
1461ddfd71aa6dd24a5f87f93c55dd774f5eb7320e4Bryce Lee    protected LayoutParams generateDefaultLayoutParams() {
1471ddfd71aa6dd24a5f87f93c55dd774f5eb7320e4Bryce Lee        return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
1481ddfd71aa6dd24a5f87f93c55dd774f5eb7320e4Bryce Lee    }
1491ddfd71aa6dd24a5f87f93c55dd774f5eb7320e4Bryce Lee
1501ddfd71aa6dd24a5f87f93c55dd774f5eb7320e4Bryce Lee    @Override
151f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    public LayoutParams generateLayoutParams(AttributeSet attrs) {
152f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        return new LayoutParams(getContext(), attrs);
153f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    }
154f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski
155f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    @Override
156f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
157f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        mHelper.adjustChildren(widthMeasureSpec, heightMeasureSpec);
158f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
159f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        if (mHelper.handleMeasuredStateTooSmall()) {
160f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
161f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        }
162f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    }
163f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski
164f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    @Override
165f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
166f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        super.onLayout(changed, left, top, right, bottom);
167f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        mHelper.restoreOriginalParams();
168f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    }
169f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski
170199e575893be653ba3088c19e95adda62b8344fbAga Madurska    /**
171199e575893be653ba3088c19e95adda62b8344fbAga Madurska     * @deprecated this class is deprecated along with its parent class.
172199e575893be653ba3088c19e95adda62b8344fbAga Madurska     */
173199e575893be653ba3088c19e95adda62b8344fbAga Madurska    @Deprecated
174f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    public static class LayoutParams extends RelativeLayout.LayoutParams
175f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski            implements PercentLayoutHelper.PercentLayoutParams {
176f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        private PercentLayoutHelper.PercentLayoutInfo mPercentLayoutInfo;
177f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski
178f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        public LayoutParams(Context c, AttributeSet attrs) {
179f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski            super(c, attrs);
180f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski            mPercentLayoutInfo = PercentLayoutHelper.getPercentLayoutInfo(c, attrs);
181f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        }
182f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski
183f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        public LayoutParams(int width, int height) {
184f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski            super(width, height);
185f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        }
186f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski
187f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        public LayoutParams(ViewGroup.LayoutParams source) {
188f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski            super(source);
189f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        }
190f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski
191f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        public LayoutParams(MarginLayoutParams source) {
192f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski            super(source);
193f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        }
194f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski
195f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        @Override
196f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        public PercentLayoutHelper.PercentLayoutInfo getPercentLayoutInfo() {
197796a29bc6265696029863ec22ee753ff4065a8dbBryce Lee            if (mPercentLayoutInfo == null) {
198796a29bc6265696029863ec22ee753ff4065a8dbBryce Lee                mPercentLayoutInfo = new PercentLayoutHelper.PercentLayoutInfo();
199796a29bc6265696029863ec22ee753ff4065a8dbBryce Lee            }
200796a29bc6265696029863ec22ee753ff4065a8dbBryce Lee
201f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski            return mPercentLayoutInfo;
202f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        }
203f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski
204f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        @Override
205f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        protected void setBaseAttributes(TypedArray a, int widthAttr, int heightAttr) {
206f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski            PercentLayoutHelper.fetchWidthAndHeight(this, a, widthAttr, heightAttr);
207f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski        }
208f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski    }
209f9cabe2ad76a19d555b5b656d8167bdb167c9d03Filip Gruszczynski}
210