StickerPreloader.java
2.96 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
package com.bitstrips.imoji.ui;
import com.bitstrips.imoji.manager.StickerPacksManager;
import com.bitstrips.imoji.models.Sticker;
import com.bitstrips.imoji.models.StickerPack;
import com.bitstrips.imoji.models.StickerPacks;
import com.bitstrips.imoji.persistence.MediaCache;
import com.bitstrips.imoji.util.PreferenceUtils;
import com.squareup.picasso.Callback;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
@Singleton
public class StickerPreloader
{
private static final Object a = new Object();
private final PreferenceUtils b;
private final StickerPacksManager c;
private final MediaCache d;
private List<Sticker> e;
private List<Sticker> f;
private int g = 0;
@Inject
StickerPreloader(PreferenceUtils paramPreferenceUtils, StickerPacksManager paramStickerPacksManager, MediaCache paramMediaCache)
{
this.b = paramPreferenceUtils;
this.c = paramStickerPacksManager;
this.d = paramMediaCache;
}
private void a()
{
int i = 2;
int j = this.g;
this.g = (j + 1);
if (j >= 3) {
return;
}
synchronized (a)
{
if (this.e.size() == 0) {
return;
}
}
final Object localObject3 = this.e;
if (this.e.size() < 2) {
i = this.e.size();
}
this.f = new ArrayList(((List)localObject3).subList(0, i));
Collections.reverse(this.f);
this.e = new ArrayList(this.e.subList(this.f.size(), this.e.size()));
i = this.f.size() - 1;
while (i >= 0)
{
localObject3 = (Sticker)this.f.get(i);
String str = ((Sticker)localObject3).getImageUrl();
if ((str == null) || (str.contains("null"))) {
break;
}
this.d.preload(str, new Callback()
{
public final void onError()
{
StickerPreloader.a(StickerPreloader.this, localObject3);
}
public final void onSuccess()
{
StickerPreloader.a(StickerPreloader.this, localObject3);
}
});
i -= 1;
}
}
public String getLastPreloadedAvatarId()
{
return this.b.getString(2131231263, null);
}
public void load()
{
Object localObject1 = this.b.getString(2131231175, null);
Object localObject2 = this.c.getStickerPacks();
this.g = 0;
this.e = new ArrayList();
this.b.putString(2131231263, (String)localObject1);
if (localObject2 != null)
{
localObject1 = ((StickerPack)((StickerPacks)localObject2).get().get(0)).getStickers().iterator();
while (((Iterator)localObject1).hasNext())
{
localObject2 = (Sticker)((Iterator)localObject1).next();
if (((Sticker)localObject2).isSolomoji()) {
this.e.add(localObject2);
}
}
}
a();
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/ui/StickerPreloader.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/