SearchIndex.java
3.59 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
package com.bitstrips.imoji.search;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.bitstrips.imoji.manager.StickerPacksManager.OnStickerPacksChangedListener;
import com.bitstrips.imoji.models.Sticker;
import com.bitstrips.imoji.models.StickerPacks;
import hn;
import hn.a;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import javax.inject.Singleton;
@Singleton
public class SearchIndex
implements StickerPacksManager.OnStickerPacksChangedListener, hn.a
{
private Map<String, List<Sticker>> a = new HashMap();
private Map<String, List<Sticker>> b = new HashMap();
private Map<String, Sticker> c = new HashMap();
private WeakHashMap<OnIndexCompleteListener, Void> d = new WeakHashMap();
private AsyncTask e = null;
public void addOnIndexCompleteListener(OnIndexCompleteListener paramOnIndexCompleteListener)
{
this.d.put(paramOnIndexCompleteListener, null);
}
public void flush()
{
this.a = new HashMap();
this.b = new HashMap();
}
@Nullable
public Sticker getStickerForComicId(@NonNull String paramString)
{
return (Sticker)this.c.get(paramString);
}
@NonNull
public List<Sticker> getStickersForSupertag(String paramString)
{
List localList = (List)this.b.get(paramString);
paramString = localList;
if (localList == null) {
paramString = new ArrayList();
}
return paramString;
}
@NonNull
public List<Sticker> getStickersForTag(String paramString)
{
List localList = (List)this.a.get(paramString);
paramString = localList;
if (localList == null) {
paramString = new ArrayList();
}
return paramString;
}
@NonNull
public List<Sticker> getStickersForTags(List<String> paramList)
{
LinkedHashSet localLinkedHashSet = new LinkedHashSet();
paramList = paramList.iterator();
while (paramList.hasNext()) {
localLinkedHashSet.addAll(getStickersForTag((String)paramList.next()));
}
return new ArrayList(localLinkedHashSet);
}
public Collection<String> getTags()
{
return this.a.keySet();
}
public boolean hasResults()
{
return !this.a.isEmpty();
}
public void index(StickerPacks paramStickerPacks)
{
if (this.e != null) {
this.e.cancel(true);
}
this.e = new hn(this).execute(new StickerPacks[] { paramStickerPacks });
}
public void onIndexTaskComplete(Map<String, List<Sticker>> paramMap1, Map<String, List<Sticker>> paramMap2, Map<String, Sticker> paramMap)
{
this.a = paramMap1;
this.b = paramMap2;
this.c = paramMap;
this.e = null;
paramMap1 = this.d.keySet().iterator();
while (paramMap1.hasNext()) {
((OnIndexCompleteListener)paramMap1.next()).onIndexComplete(this);
}
}
public void onStickerPacksChanged(StickerPacks paramStickerPacks)
{
if (paramStickerPacks == null)
{
flush();
return;
}
index(paramStickerPacks);
}
public void removeOnIndexCompleteListener(OnIndexCompleteListener paramOnIndexCompleteListener)
{
this.d.remove(paramOnIndexCompleteListener);
}
public static abstract interface OnIndexCompleteListener
{
public abstract void onIndexComplete(SearchIndex paramSearchIndex);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/search/SearchIndex.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/