SnackbarContentLayout.java
4.8 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
package android.support.design.internal;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.support.annotation.RestrictTo;
import android.support.design.R.dimen;
import android.support.design.R.id;
import android.support.design.R.styleable;
import android.support.design.widget.BaseTransientBottomBar.ContentViewCallback;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPropertyAnimatorCompat;
import android.text.Layout;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.MeasureSpec;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public class SnackbarContentLayout
extends LinearLayout
implements BaseTransientBottomBar.ContentViewCallback
{
private TextView a;
private Button b;
private int c;
private int d;
public SnackbarContentLayout(Context paramContext)
{
this(paramContext, null);
}
public SnackbarContentLayout(Context paramContext, AttributeSet paramAttributeSet)
{
super(paramContext, paramAttributeSet);
paramContext = paramContext.obtainStyledAttributes(paramAttributeSet, R.styleable.SnackbarLayout);
this.c = paramContext.getDimensionPixelSize(R.styleable.SnackbarLayout_android_maxWidth, -1);
this.d = paramContext.getDimensionPixelSize(R.styleable.SnackbarLayout_maxActionInlineWidth, -1);
paramContext.recycle();
}
private boolean a(int paramInt1, int paramInt2, int paramInt3)
{
boolean bool = false;
if (paramInt1 != getOrientation())
{
setOrientation(paramInt1);
bool = true;
}
TextView localTextView;
if ((this.a.getPaddingTop() != paramInt2) || (this.a.getPaddingBottom() != paramInt3))
{
localTextView = this.a;
if (!ViewCompat.isPaddingRelative(localTextView)) {
break label78;
}
ViewCompat.setPaddingRelative(localTextView, ViewCompat.getPaddingStart(localTextView), paramInt2, ViewCompat.getPaddingEnd(localTextView), paramInt3);
}
for (;;)
{
bool = true;
return bool;
label78:
localTextView.setPadding(localTextView.getPaddingLeft(), paramInt2, localTextView.getPaddingRight(), paramInt3);
}
}
public void animateContentIn(int paramInt1, int paramInt2)
{
ViewCompat.setAlpha(this.a, 0.0F);
ViewCompat.animate(this.a).alpha(1.0F).setDuration(paramInt2).setStartDelay(paramInt1).start();
if (this.b.getVisibility() == 0)
{
ViewCompat.setAlpha(this.b, 0.0F);
ViewCompat.animate(this.b).alpha(1.0F).setDuration(paramInt2).setStartDelay(paramInt1).start();
}
}
public void animateContentOut(int paramInt1, int paramInt2)
{
ViewCompat.setAlpha(this.a, 1.0F);
ViewCompat.animate(this.a).alpha(0.0F).setDuration(paramInt2).setStartDelay(paramInt1).start();
if (this.b.getVisibility() == 0)
{
ViewCompat.setAlpha(this.b, 1.0F);
ViewCompat.animate(this.b).alpha(0.0F).setDuration(paramInt2).setStartDelay(paramInt1).start();
}
}
public Button getActionView()
{
return this.b;
}
public TextView getMessageView()
{
return this.a;
}
protected void onFinishInflate()
{
super.onFinishInflate();
this.a = ((TextView)findViewById(R.id.snackbar_text));
this.b = ((Button)findViewById(R.id.snackbar_action));
}
protected void onMeasure(int paramInt1, int paramInt2)
{
super.onMeasure(paramInt1, paramInt2);
int i = paramInt1;
if (this.c > 0)
{
i = paramInt1;
if (getMeasuredWidth() > this.c)
{
i = View.MeasureSpec.makeMeasureSpec(this.c, 1073741824);
super.onMeasure(i, paramInt2);
}
}
int j = getResources().getDimensionPixelSize(R.dimen.design_snackbar_padding_vertical_2lines);
int k = getResources().getDimensionPixelSize(R.dimen.design_snackbar_padding_vertical);
if (this.a.getLayout().getLineCount() > 1)
{
paramInt1 = 1;
if ((paramInt1 == 0) || (this.d <= 0) || (this.b.getMeasuredWidth() <= this.d)) {
break label142;
}
if (!a(1, j, j - k)) {
break label170;
}
paramInt1 = 1;
}
for (;;)
{
if (paramInt1 != 0) {
super.onMeasure(i, paramInt2);
}
return;
paramInt1 = 0;
break;
label142:
if (paramInt1 != 0) {}
for (paramInt1 = j;; paramInt1 = k)
{
if (!a(0, paramInt1, paramInt1)) {
break label170;
}
paramInt1 = 1;
break;
}
label170:
paramInt1 = 0;
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/design/internal/SnackbarContentLayout.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/