AvatarFlowBuilder.java
7.55 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 com.bitstrips.imoji.abv3;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.graphics.Color;
import com.bitstrips.imoji.abv3.bottombar.AvatarBottomBarItem;
import com.bitstrips.imoji.abv3.bottombar.AvatarBottomBarSubCategory;
import com.bitstrips.imoji.abv3.category.AvatarCategoryDetails;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import org.apache.commons.lang3.StringUtils;
public class AvatarFlowBuilder
{
public static final String TYPE_BODY = "body";
public static final String TYPE_CREATE = "create";
public static final String TYPE_EDIT = "edit";
private final Resources a;
private final String b;
private final BottomBarJson c;
private final AvatarCategoryDetailsJson d;
public AvatarFlowBuilder(String paramString1, Resources paramResources, String paramString2)
throws IOException
{
this.a = paramResources;
this.b = paramString2;
paramResources = a("avatar-builder/bottom_bar.json");
this.c = ((BottomBarJson)new Gson().fromJson(paramResources, BottomBarJson.class));
paramString1 = a(paramString1);
this.d = ((AvatarCategoryDetailsJson)new Gson().fromJson(paramString1, AvatarCategoryDetailsJson.class));
}
private String a(String paramString)
throws IOException
{
paramString = new Scanner(this.a.getAssets().open(paramString)).useDelimiter("\\A");
if (paramString.hasNext()) {
return paramString.next();
}
return "";
}
public AvatarBuilderFlow getFlow(AvatarBuilderStyle paramAvatarBuilderStyle, AvatarBuilderGender paramAvatarBuilderGender, String paramString)
{
Object localObject1 = this.c.bitstrips;
if (paramAvatarBuilderStyle == AvatarBuilderStyle.STYLE_BITMOJI)
{
localObject1 = this.c.bitmoji;
paramAvatarBuilderStyle = ((BottomBarJsonStyle)localObject1).create;
if (!"body".equals(paramString)) {
break label419;
}
paramAvatarBuilderStyle = ((BottomBarJsonStyle)localObject1).body;
}
label46:
label152:
label255:
label419:
label443:
label503:
label515:
for (;;)
{
paramString = paramAvatarBuilderStyle.male;
if (paramAvatarBuilderGender == AvatarBuilderGender.GENDER_FEMALE) {}
for (paramAvatarBuilderStyle = paramAvatarBuilderStyle.female;; paramAvatarBuilderStyle = paramString)
{
paramString = new ArrayList();
localObject1 = new ArrayList();
Iterator localIterator1 = paramAvatarBuilderStyle.iterator();
Object localObject2;
int k;
if (localIterator1.hasNext())
{
paramAvatarBuilderStyle = (BottomBarJsonItem)localIterator1.next();
localObject2 = paramAvatarBuilderStyle.iconName;
k = this.a.getIdentifier((String)localObject2, "drawable", this.b);
localObject2 = new ArrayList();
Iterator localIterator2 = paramAvatarBuilderStyle.subCategoryKeys.iterator();
if (localIterator2.hasNext())
{
String str = (String)localIterator2.next();
AvatarCategoryDetailsJsonItem localAvatarCategoryDetailsJsonItem = (AvatarCategoryDetailsJsonItem)this.d.categoryDetailsMap.get(str);
paramAvatarBuilderStyle = "";
if (!StringUtils.isEmpty(localAvatarCategoryDetailsJsonItem.titleStringResource))
{
i = this.a.getIdentifier(localAvatarCategoryDetailsJsonItem.titleStringResource, "string", this.b);
paramAvatarBuilderStyle = this.a.getString(i);
}
if (localAvatarCategoryDetailsJsonItem.backgroundColor != null)
{
i = Color.parseColor(localAvatarCategoryDetailsJsonItem.backgroundColor);
if (localAvatarCategoryDetailsJsonItem.backgroundColor == null) {
break label443;
}
}
for (int j = Color.parseColor(localAvatarCategoryDetailsJsonItem.titleColor);; j = -16777216)
{
((List)localObject1).add(new AvatarCategoryDetails(paramAvatarBuilderStyle, str, localAvatarCategoryDetailsJsonItem.columnCount, localAvatarCategoryDetailsJsonItem.displayType, localAvatarCategoryDetailsJsonItem.previewDisplayType, localAvatarCategoryDetailsJsonItem.rotation, i, j));
j = this.a.getIdentifier(localAvatarCategoryDetailsJsonItem.iconResource, "drawable", this.b);
i = j;
if (paramAvatarBuilderGender == AvatarBuilderGender.GENDER_FEMALE)
{
i = j;
if (localAvatarCategoryDetailsJsonItem.femaleIconResource != null) {
i = this.a.getIdentifier(localAvatarCategoryDetailsJsonItem.femaleIconResource, "drawable", this.b);
}
}
((List)localObject2).add(new AvatarBottomBarSubCategory(i, str));
break label152;
if (paramAvatarBuilderStyle != AvatarBuilderStyle.STYLE_CM) {
break;
}
localObject1 = this.c.cm;
break;
if (!"edit".equals(paramString)) {
break label515;
}
paramAvatarBuilderStyle = ((BottomBarJsonStyle)localObject1).edit;
break label46;
i = -1;
break label255;
}
}
if (k != 0) {
break label503;
}
}
for (int i = ((AvatarBottomBarSubCategory)((List)localObject2).get(0)).getIconResource();; i = k)
{
paramString.add(new AvatarBottomBarItem(i, (List)localObject2));
break;
return new AvatarBuilderFlow((List)localObject1, paramString);
}
}
}
}
public static class AvatarCategoryDetailsJson
{
@SerializedName("category_details")
public Map<String, AvatarFlowBuilder.AvatarCategoryDetailsJsonItem> categoryDetailsMap;
}
public static class AvatarCategoryDetailsJsonItem
{
@SerializedName("background_color")
public String backgroundColor;
@SerializedName("column_count")
public int columnCount;
@SerializedName("display_type")
public String displayType;
@SerializedName("female_icon_resource")
public String femaleIconResource;
@SerializedName("icon_resource")
public String iconResource;
@SerializedName("preview_display_type")
public String previewDisplayType;
@SerializedName("rotation")
public int rotation;
@SerializedName("title_color")
public String titleColor;
@SerializedName("title_string_resource")
public String titleStringResource;
}
public static class BottomBarJson
{
public AvatarFlowBuilder.BottomBarJsonStyle bitmoji;
public AvatarFlowBuilder.BottomBarJsonStyle bitstrips;
public AvatarFlowBuilder.BottomBarJsonStyle cm;
}
public static class BottomBarJsonItem
{
public String iconName;
public List<String> subCategoryKeys;
}
public static class BottomBarJsonStyle
{
public AvatarFlowBuilder.BottomBarJsonType body;
public AvatarFlowBuilder.BottomBarJsonType create;
public AvatarFlowBuilder.BottomBarJsonType edit;
}
public static class BottomBarJsonType
{
public List<AvatarFlowBuilder.BottomBarJsonItem> female;
public List<AvatarFlowBuilder.BottomBarJsonItem> male;
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/abv3/AvatarFlowBuilder.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/