ForegroundLinearLayout.java
5.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
package android.support.design.internal;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
import android.support.annotation.RestrictTo;
import android.support.design.R.styleable;
import android.support.v7.widget.LinearLayoutCompat;
import android.util.AttributeSet;
import android.view.Gravity;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public class ForegroundLinearLayout
extends LinearLayoutCompat
{
boolean a = false;
private Drawable b;
private final Rect c = new Rect();
private final Rect d = new Rect();
private int e = 119;
protected boolean mForegroundInPadding = true;
public ForegroundLinearLayout(Context paramContext)
{
this(paramContext, null);
}
public ForegroundLinearLayout(Context paramContext, AttributeSet paramAttributeSet)
{
this(paramContext, paramAttributeSet, 0);
}
public ForegroundLinearLayout(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
{
super(paramContext, paramAttributeSet, paramInt);
paramContext = paramContext.obtainStyledAttributes(paramAttributeSet, R.styleable.ForegroundLinearLayout, paramInt, 0);
this.e = paramContext.getInt(R.styleable.ForegroundLinearLayout_android_foregroundGravity, this.e);
paramAttributeSet = paramContext.getDrawable(R.styleable.ForegroundLinearLayout_android_foreground);
if (paramAttributeSet != null) {
setForeground(paramAttributeSet);
}
this.mForegroundInPadding = paramContext.getBoolean(R.styleable.ForegroundLinearLayout_foregroundInsidePadding, true);
paramContext.recycle();
}
public void draw(@NonNull Canvas paramCanvas)
{
super.draw(paramCanvas);
Drawable localDrawable;
Rect localRect1;
Rect localRect2;
int i;
int j;
if (this.b != null)
{
localDrawable = this.b;
if (this.a)
{
this.a = false;
localRect1 = this.c;
localRect2 = this.d;
i = getRight() - getLeft();
j = getBottom() - getTop();
if (!this.mForegroundInPadding) {
break label113;
}
localRect1.set(0, 0, i, j);
}
}
for (;;)
{
Gravity.apply(this.e, localDrawable.getIntrinsicWidth(), localDrawable.getIntrinsicHeight(), localRect1, localRect2);
localDrawable.setBounds(localRect2);
localDrawable.draw(paramCanvas);
return;
label113:
localRect1.set(getPaddingLeft(), getPaddingTop(), i - getPaddingRight(), j - getPaddingBottom());
}
}
@TargetApi(21)
@RequiresApi(21)
public void drawableHotspotChanged(float paramFloat1, float paramFloat2)
{
super.drawableHotspotChanged(paramFloat1, paramFloat2);
if (this.b != null) {
this.b.setHotspot(paramFloat1, paramFloat2);
}
}
protected void drawableStateChanged()
{
super.drawableStateChanged();
if ((this.b != null) && (this.b.isStateful())) {
this.b.setState(getDrawableState());
}
}
public Drawable getForeground()
{
return this.b;
}
public int getForegroundGravity()
{
return this.e;
}
@TargetApi(11)
@RequiresApi(11)
public void jumpDrawablesToCurrentState()
{
super.jumpDrawablesToCurrentState();
if (this.b != null) {
this.b.jumpToCurrentState();
}
}
protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
super.onLayout(paramBoolean, paramInt1, paramInt2, paramInt3, paramInt4);
this.a |= paramBoolean;
}
protected void onSizeChanged(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
super.onSizeChanged(paramInt1, paramInt2, paramInt3, paramInt4);
this.a = true;
}
public void setForeground(Drawable paramDrawable)
{
if (this.b != paramDrawable)
{
if (this.b != null)
{
this.b.setCallback(null);
unscheduleDrawable(this.b);
}
this.b = paramDrawable;
if (paramDrawable == null) {
break label96;
}
setWillNotDraw(false);
paramDrawable.setCallback(this);
if (paramDrawable.isStateful()) {
paramDrawable.setState(getDrawableState());
}
if (this.e == 119) {
paramDrawable.getPadding(new Rect());
}
}
for (;;)
{
requestLayout();
invalidate();
return;
label96:
setWillNotDraw(true);
}
}
public void setForegroundGravity(int paramInt)
{
if (this.e != paramInt)
{
if ((0x800007 & paramInt) != 0) {
break label77;
}
paramInt = 0x800003 | paramInt;
}
label77:
for (;;)
{
int i = paramInt;
if ((paramInt & 0x70) == 0) {
i = paramInt | 0x30;
}
this.e = i;
if ((this.e == 119) && (this.b != null))
{
Rect localRect = new Rect();
this.b.getPadding(localRect);
}
requestLayout();
return;
}
}
protected boolean verifyDrawable(Drawable paramDrawable)
{
return (super.verifyDrawable(paramDrawable)) || (paramDrawable == this.b);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/design/internal/ForegroundLinearLayout.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/