Snackbar.java
5.81 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
package android.support.design.widget;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.support.annotation.StringRes;
import android.support.design.R.layout;
import android.support.design.internal.SnackbarContentLayout;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.TextView;
public final class Snackbar
extends BaseTransientBottomBar<Snackbar>
{
public static final int LENGTH_INDEFINITE = -2;
public static final int LENGTH_LONG = 0;
public static final int LENGTH_SHORT = -1;
@Nullable
private BaseTransientBottomBar.BaseCallback<Snackbar> e;
private Snackbar(ViewGroup paramViewGroup, View paramView, BaseTransientBottomBar.ContentViewCallback paramContentViewCallback)
{
super(paramViewGroup, paramView, paramContentViewCallback);
}
@NonNull
public static Snackbar make(@NonNull View paramView, @StringRes int paramInt1, int paramInt2)
{
return make(paramView, paramView.getResources().getText(paramInt1), paramInt2);
}
@NonNull
public static Snackbar make(@NonNull View paramView, @NonNull CharSequence paramCharSequence, int paramInt)
{
View localView = null;
Object localObject2 = paramView;
if ((localObject2 instanceof CoordinatorLayout)) {}
for (paramView = (ViewGroup)localObject2;; paramView = (ViewGroup)localObject2)
{
label20:
localObject1 = (SnackbarContentLayout)LayoutInflater.from(paramView.getContext()).inflate(R.layout.design_layout_snackbar_include, paramView, false);
paramView = new Snackbar(paramView, (View)localObject1, (BaseTransientBottomBar.ContentViewCallback)localObject1);
paramView.setText(paramCharSequence);
paramView.setDuration(paramInt);
return paramView;
paramView = localView;
if (!(localObject2 instanceof FrameLayout)) {
break label100;
}
if (((View)localObject2).getId() != 16908290) {
break;
}
}
paramView = (ViewGroup)localObject2;
label100:
Object localObject1 = localObject2;
if (localObject2 != null)
{
localObject1 = ((View)localObject2).getParent();
if (!(localObject1 instanceof View)) {
break label139;
}
}
label139:
for (localObject1 = (View)localObject1;; localObject1 = null)
{
localObject2 = localObject1;
localView = paramView;
if (localObject1 != null) {
break;
}
break label20;
}
}
@NonNull
public final Snackbar setAction(@StringRes int paramInt, View.OnClickListener paramOnClickListener)
{
return setAction(getContext().getText(paramInt), paramOnClickListener);
}
@NonNull
public final Snackbar setAction(CharSequence paramCharSequence, final View.OnClickListener paramOnClickListener)
{
Button localButton = ((SnackbarContentLayout)this.c.getChildAt(0)).getActionView();
if ((TextUtils.isEmpty(paramCharSequence)) || (paramOnClickListener == null))
{
localButton.setVisibility(8);
localButton.setOnClickListener(null);
return this;
}
localButton.setVisibility(0);
localButton.setText(paramCharSequence);
localButton.setOnClickListener(new View.OnClickListener()
{
public final void onClick(View paramAnonymousView)
{
paramOnClickListener.onClick(paramAnonymousView);
Snackbar.this.a(1);
}
});
return this;
}
@NonNull
public final Snackbar setActionTextColor(@ColorInt int paramInt)
{
((SnackbarContentLayout)this.c.getChildAt(0)).getActionView().setTextColor(paramInt);
return this;
}
@NonNull
public final Snackbar setActionTextColor(ColorStateList paramColorStateList)
{
((SnackbarContentLayout)this.c.getChildAt(0)).getActionView().setTextColor(paramColorStateList);
return this;
}
@Deprecated
@NonNull
public final Snackbar setCallback(Callback paramCallback)
{
if (this.e != null) {
removeCallback(this.e);
}
if (paramCallback != null) {
addCallback(paramCallback);
}
this.e = paramCallback;
return this;
}
@NonNull
public final Snackbar setText(@StringRes int paramInt)
{
return setText(getContext().getText(paramInt));
}
@NonNull
public final Snackbar setText(@NonNull CharSequence paramCharSequence)
{
((SnackbarContentLayout)this.c.getChildAt(0)).getMessageView().setText(paramCharSequence);
return this;
}
public static class Callback
extends BaseTransientBottomBar.BaseCallback<Snackbar>
{
public static final int DISMISS_EVENT_ACTION = 1;
public static final int DISMISS_EVENT_CONSECUTIVE = 4;
public static final int DISMISS_EVENT_MANUAL = 3;
public static final int DISMISS_EVENT_SWIPE = 0;
public static final int DISMISS_EVENT_TIMEOUT = 2;
public void onDismissed(Snackbar paramSnackbar, int paramInt) {}
public void onShown(Snackbar paramSnackbar) {}
}
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public static final class SnackbarLayout
extends BaseTransientBottomBar.d
{
public SnackbarLayout(Context paramContext)
{
super();
}
public SnackbarLayout(Context paramContext, AttributeSet paramAttributeSet)
{
super(paramAttributeSet);
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/design/widget/Snackbar.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/