AvatarOptionAdapter.java
6.58 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
package com.bitstrips.imoji.abv3.option;
import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView.Adapter;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import com.bitstrips.imoji.abv3.category.AvatarCategoryDetails;
import com.bitstrips.imoji.abv3.model.AvatarOption;
import com.bitstrips.imoji.persistence.MediaCache;
import java.util.List;
public class AvatarOptionAdapter
extends RecyclerView.Adapter
{
private AvatarOptionListener a;
private final AvatarOptionProvider b;
private final List<AvatarOption> c;
private final AvatarCategoryDetails d;
private final MediaCache e;
public AvatarOptionAdapter(@NonNull AvatarOptionProvider paramAvatarOptionProvider, @NonNull AvatarCategoryDetails paramAvatarCategoryDetails, @NonNull List<AvatarOption> paramList, MediaCache paramMediaCache)
{
this.c = paramList;
this.d = paramAvatarCategoryDetails;
this.b = paramAvatarOptionProvider;
this.e = paramMediaCache;
}
private static int a(AvatarOption paramAvatarOption)
{
int i = paramAvatarOption.getValue();
if (i == -1) {
return -1;
}
for (paramAvatarOption = Integer.toHexString(i); paramAvatarOption.length() < 6; paramAvatarOption = "0" + paramAvatarOption) {}
return Color.parseColor("#" + paramAvatarOption);
}
public int getItemCount()
{
if (isHeaderPresent()) {
return this.c.size() + 1;
}
return this.c.size();
}
public int getItemViewType(int paramInt)
{
if ((isHeaderPresent()) && (paramInt == 0)) {
return 0;
}
return 1;
}
public AvatarOption getOptionAtViewHolderPosition(int paramInt)
{
int i = paramInt;
if (isHeaderPresent()) {
i = paramInt - 1;
}
if (i == -1) {
return null;
}
return (AvatarOption)this.c.get(i);
}
public boolean isHeaderPresent()
{
Integer localInteger = this.b.getSelectedOptionValue("hat");
return ("hair".equals(this.d.getCategoryKey())) && (!isOptionValueBlank(localInteger));
}
public boolean isOptionValueBlank(Integer paramInteger)
{
return (paramInteger == null) || (paramInteger.intValue() == -1);
}
public void onBindViewHolder(RecyclerView.ViewHolder paramViewHolder, int paramInt)
{
if (getItemViewType(paramInt) == 0)
{
paramViewHolder = (AvatarOptionHeaderViewHolder)paramViewHolder;
if ("hair".equals(this.d.getCategoryKey())) {
paramViewHolder.setText(2131230824);
}
return;
}
final AvatarOption localAvatarOption = getOptionAtViewHolderPosition(paramInt);
String str = this.d.getDisplayType();
paramInt = -1;
switch (str.hashCode())
{
default:
switch (paramInt)
{
default:
((AvatarOptionViewHolder)paramViewHolder).setOption(this.b.getUri(this.d, localAvatarOption));
}
break;
}
for (;;)
{
paramViewHolder.itemView.setOnClickListener(new View.OnClickListener()
{
public final void onClick(View paramAnonymousView)
{
if (AvatarOptionAdapter.a(AvatarOptionAdapter.this) != null) {
AvatarOptionAdapter.a(AvatarOptionAdapter.this).onOptionSelected(AvatarOptionAdapter.b(AvatarOptionAdapter.this), localAvatarOption);
}
}
});
return;
if (!str.equals("makeup")) {
break;
}
paramInt = 0;
break;
if (!str.equals("color")) {
break;
}
paramInt = 1;
break;
if (!str.equals("eye-color")) {
break;
}
paramInt = 2;
break;
if (!str.equals("thumbnail")) {
break;
}
paramInt = 3;
break;
((AvatarMakeupViewHolder)paramViewHolder).setOption(this.d.getCategoryKey(), a(localAvatarOption));
continue;
((AvatarOptionColorViewHolder)paramViewHolder).setOption(a(localAvatarOption));
continue;
((AvatarOptionEyeViewHolder)paramViewHolder).setOption(a(localAvatarOption));
continue;
((AvatarOptionThumbnailViewHolder)paramViewHolder).setOption(localAvatarOption.getDisplayContent());
}
}
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup paramViewGroup, int paramInt)
{
if (paramInt == 0) {
return new AvatarOptionHeaderViewHolder(LayoutInflater.from(paramViewGroup.getContext()).inflate(2130903074, paramViewGroup, false));
}
if ("makeup".equals(this.d.getDisplayType())) {
return new AvatarMakeupViewHolder(LayoutInflater.from(paramViewGroup.getContext()).inflate(2130903177, paramViewGroup, false), paramViewGroup.getContext());
}
if ("body-fixed".equals(this.d.getDisplayType())) {
return new AvatarOptionViewHolder(LayoutInflater.from(paramViewGroup.getContext()).inflate(2130903162, paramViewGroup, false), this.e);
}
if ("color".equals(this.d.getDisplayType())) {
return new AvatarOptionColorViewHolder(LayoutInflater.from(paramViewGroup.getContext()).inflate(2130903163, paramViewGroup, false));
}
if ("thumbnail".equals(this.d.getDisplayType())) {
return new AvatarOptionThumbnailViewHolder(LayoutInflater.from(paramViewGroup.getContext()).inflate(2130903166, paramViewGroup, false));
}
if ("eye-color".equals(this.d.getDisplayType())) {
return new AvatarOptionEyeViewHolder(LayoutInflater.from(paramViewGroup.getContext()).inflate(2130903164, paramViewGroup, false));
}
return new AvatarOptionViewHolder(LayoutInflater.from(paramViewGroup.getContext()).inflate(2130903161, paramViewGroup, false), this.e);
}
public void onViewAttachedToWindow(RecyclerView.ViewHolder paramViewHolder)
{
super.onViewAttachedToWindow(paramViewHolder);
AvatarOption localAvatarOption = getOptionAtViewHolderPosition(paramViewHolder.getAdapterPosition());
if (localAvatarOption == null) {
return;
}
Integer localInteger = this.b.getSelectedOptionValue(this.d.getCategoryKey());
paramViewHolder = (AvatarOptionBaseViewHolder)paramViewHolder;
if ((localInteger != null) && (localAvatarOption.getValue() == localInteger.intValue())) {}
for (boolean bool = true;; bool = false)
{
paramViewHolder.setSelected(bool);
return;
}
}
public void setListener(AvatarOptionListener paramAvatarOptionListener)
{
this.a = paramAvatarOptionListener;
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/abv3/option/AvatarOptionAdapter.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/