AvatarBottomBarViewHolder.java
7.77 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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
package com.bitstrips.imoji.abv3.bottombar;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.PorterDuff.Mode;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.FrameLayout.LayoutParams;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import hi;
import java.util.Iterator;
import java.util.List;
public class AvatarBottomBarViewHolder
{
private static final String a = AvatarBottomBarViewHolder.class.getSimpleName();
private boolean b;
private View c;
private final ImageView d;
private final LinearLayout e;
private AvatarBottomBarItem f;
private hi g;
private int h;
private int i;
private int j;
private int k;
private int l;
private boolean m;
public AvatarBottomBarViewHolder(View paramView, AvatarBottomBarItem paramAvatarBottomBarItem, int paramInt)
{
this.c = paramView;
this.d = ((ImageView)this.c.findViewById(2131689575));
this.e = ((LinearLayout)this.c.findViewById(2131689871));
a(paramAvatarBottomBarItem, paramInt);
}
private void a(AvatarBottomBarItem paramAvatarBottomBarItem, int paramInt)
{
this.f = paramAvatarBottomBarItem;
this.e.removeAllViews();
this.h = this.c.getContext().getResources().getColor(2131623948);
this.i = this.c.getContext().getResources().getColor(2131623947);
this.k = this.c.getResources().getDimensionPixelSize(2131361903);
this.j = this.c.getResources().getDimensionPixelSize(2131361902);
this.l = this.c.getResources().getDimensionPixelSize(2131361901);
this.d.setImageResource(paramAvatarBottomBarItem.getIconResource());
this.d.setLayoutParams(new FrameLayout.LayoutParams(paramInt, this.j));
Context localContext = this.c.getContext();
paramAvatarBottomBarItem = paramAvatarBottomBarItem.getSubCategories().iterator();
while (paramAvatarBottomBarItem.hasNext())
{
final AvatarBottomBarSubCategory localAvatarBottomBarSubCategory = (AvatarBottomBarSubCategory)paramAvatarBottomBarItem.next();
ImageView localImageView = new ImageView(localContext);
localImageView.setImageResource(localAvatarBottomBarSubCategory.getIconResource());
LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(this.k, this.j);
this.e.addView(localImageView, localLayoutParams);
localImageView.setOnClickListener(new View.OnClickListener()
{
public final void onClick(View paramAnonymousView)
{
if (AvatarBottomBarViewHolder.a(AvatarBottomBarViewHolder.this) != null) {
AvatarBottomBarViewHolder.a(AvatarBottomBarViewHolder.this).onSelected(AvatarBottomBarViewHolder.this, localAvatarBottomBarSubCategory.getCategoryKey());
}
}
});
}
this.d.setOnClickListener(new View.OnClickListener()
{
public final void onClick(View paramAnonymousView)
{
if (AvatarBottomBarViewHolder.a(AvatarBottomBarViewHolder.this) != null) {
AvatarBottomBarViewHolder.a(AvatarBottomBarViewHolder.this).onSelected(AvatarBottomBarViewHolder.this, ((AvatarBottomBarSubCategory)AvatarBottomBarViewHolder.b(AvatarBottomBarViewHolder.this).getSubCategories().get(0)).getCategoryKey());
}
}
});
}
public int getContainerWidth()
{
return this.k * this.e.getChildCount() + this.l * 2;
}
public View getView()
{
return this.c;
}
public int indexOf(@NonNull String paramString)
{
int n = 0;
while (n < this.f.getSubCategories().size())
{
if (paramString.equals(((AvatarBottomBarSubCategory)this.f.getSubCategories().get(n)).getCategoryKey())) {
return n;
}
n += 1;
}
return -1;
}
public void setAnimationsEnabled(boolean paramBoolean)
{
this.m = paramBoolean;
}
public void setListener(hi paramhi)
{
this.g = paramhi;
}
public void setSelected(int paramInt)
{
if (this.f.isSingleCategory())
{
new StringBuilder("Selected: ").append(((AvatarBottomBarSubCategory)this.f.getSubCategories().get(0)).getCategoryKey());
this.d.setColorFilter(this.c.getContext().getResources().getColor(2131623948), PorterDuff.Mode.SRC_IN);
return;
}
new StringBuilder("Selected group ").append(this.b);
Object localObject;
long l1;
label124:
int n;
if (!this.b)
{
this.b = true;
localObject = ValueAnimator.ofFloat(new float[] { 0.0F, 1.0F });
if (this.m)
{
l1 = 250L;
((ValueAnimator)localObject).setDuration(l1);
((ValueAnimator)localObject).addUpdateListener(new ValueAnimator.AnimatorUpdateListener()
{
public final void onAnimationUpdate(ValueAnimator paramAnonymousValueAnimator)
{
float f = ((Float)paramAnonymousValueAnimator.getAnimatedValue()).floatValue();
paramAnonymousValueAnimator = new FrameLayout.LayoutParams((int)(AvatarBottomBarViewHolder.this.getContainerWidth() * f), -1);
AvatarBottomBarViewHolder.c(AvatarBottomBarViewHolder.this).setLayoutParams(paramAnonymousValueAnimator);
AvatarBottomBarViewHolder.c(AvatarBottomBarViewHolder.this).setAlpha(f);
AvatarBottomBarViewHolder.d(AvatarBottomBarViewHolder.this).setAlpha(1.0F - f);
}
});
((ValueAnimator)localObject).start();
}
}
else
{
n = 0;
label151:
if (n < this.e.getChildCount())
{
localObject = (ImageView)this.e.getChildAt(n);
if (n != paramInt) {
break label204;
}
((ImageView)localObject).setColorFilter(this.h, PorterDuff.Mode.SRC_IN);
}
}
for (;;)
{
n += 1;
break label151;
break;
l1 = 0L;
break label124;
label204:
((ImageView)localObject).setColorFilter(this.i, PorterDuff.Mode.SRC_IN);
}
}
public void setUnselected()
{
if (this.f.isSingleCategory())
{
new StringBuilder("Unselected: ").append(((AvatarBottomBarSubCategory)this.f.getSubCategories().get(0)).getCategoryKey());
this.d.setColorFilter(this.i, PorterDuff.Mode.SRC_IN);
return;
}
new StringBuilder("Unselected group ").append(this.b);
final int n;
ValueAnimator localValueAnimator;
if (this.b)
{
this.b = false;
n = getContainerWidth();
localValueAnimator = ValueAnimator.ofFloat(new float[] { 1.0F, 0.0F });
if (!this.m) {
break label187;
}
}
label187:
for (long l1 = 250L;; l1 = 0L)
{
localValueAnimator.setDuration(l1);
localValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener()
{
public final void onAnimationUpdate(ValueAnimator paramAnonymousValueAnimator)
{
float f = ((Float)paramAnonymousValueAnimator.getAnimatedValue()).floatValue();
paramAnonymousValueAnimator = new FrameLayout.LayoutParams((int)(n * f), -1);
AvatarBottomBarViewHolder.c(AvatarBottomBarViewHolder.this).setLayoutParams(paramAnonymousValueAnimator);
AvatarBottomBarViewHolder.c(AvatarBottomBarViewHolder.this).setAlpha(f);
AvatarBottomBarViewHolder.d(AvatarBottomBarViewHolder.this).setAlpha(1.0F - f);
}
});
localValueAnimator.start();
n = 0;
while (n < this.e.getChildCount())
{
((ImageView)this.e.getChildAt(n)).setColorFilter(this.i, PorterDuff.Mode.SRC_IN);
n += 1;
}
break;
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/abv3/bottombar/AvatarBottomBarViewHolder.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/