BitmojisView.java
5.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
package com.bitstrips.imoji.keyboard;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.ViewPropertyAnimator;
import com.bitstrips.imoji.InjectorApplication;
import com.bitstrips.imoji.analytics.AnalyticsWrapper;
import com.bitstrips.imoji.analytics.LegacyAnalyticsService;
import com.bitstrips.imoji.analytics.SearchSource;
import com.bitstrips.imoji.browser.BitmojiClickListener;
import com.bitstrips.imoji.browser.adapters.StickerCategoriesAdapter;
import com.bitstrips.imoji.browser.models.StickerCategory;
import com.bitstrips.imoji.browser.models.StickerCategory.EmptyStateType;
import com.bitstrips.imoji.browser.views.StickerViewHolder.OnStickerSelectedListener;
import com.bitstrips.imoji.models.Sticker;
import com.bitstrips.imoji.persistence.MediaCache;
import com.bitstrips.imoji.search.SearchIndex;
import com.crashlytics.android.Crashlytics;
import java.util.Collections;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
public class BitmojisView
extends RecyclerView
{
public static final int GRID_ROW_SIZE_LANDSCAPE = 5;
public static final int GRID_ROW_SIZE_PORTRAIT = 4;
@Inject
SearchIndex M;
@Inject
MediaCache N;
@Inject
LegacyAnalyticsService O;
@Inject
@Named("avatarId")
Provider<String> P;
protected BitmojiClickListener mBitmojiClickListener;
public BitmojisView(Context paramContext)
{
super(paramContext);
setUp(paramContext);
}
public BitmojisView(Context paramContext, AttributeSet paramAttributeSet)
{
super(paramContext, paramAttributeSet);
setUp(paramContext);
}
public BitmojisView(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
{
super(paramContext, paramAttributeSet, paramInt);
setUp(paramContext);
}
protected int getImojiColumnCount()
{
if (BitmojiOrientation.a(getContext()) == 0) {
return 4;
}
return 5;
}
@VisibleForTesting
BitmojiClickListener getmBitmojiClickListener()
{
return this.mBitmojiClickListener;
}
public void hide()
{
final float f = getX();
animate().translationX(getMeasuredWidth()).setListener(new Animator.AnimatorListener()
{
public final void onAnimationCancel(Animator paramAnonymousAnimator) {}
public final void onAnimationEnd(Animator paramAnonymousAnimator)
{
BitmojisView.this.setVisibility(8);
BitmojisView.this.setX(f);
}
public final void onAnimationRepeat(Animator paramAnonymousAnimator) {}
public final void onAnimationStart(Animator paramAnonymousAnimator) {}
});
}
public boolean isVisible()
{
return getVisibility() == 0;
}
protected void onAttachedToWindow()
{
super.onAttachedToWindow();
setHasFixedSize(true);
}
protected void populate(List<Sticker> paramList, @Nullable final String paramString)
{
String str = (String)this.P.get();
if (TextUtils.isEmpty(str))
{
Crashlytics.logException(new IllegalStateException("Trying to show Imoji grid with null avatar id!"));
return;
}
setLayoutManager(new GridLayoutManager(getContext(), getImojiColumnCount()));
paramList = new StickerCategoriesAdapter(str, Collections.singletonList(new StickerCategory(null, paramList, null, StickerCategory.EmptyStateType.IGNORE)), new StickerViewHolder.OnStickerSelectedListener()
{
public final void onStickerSelected(Sticker paramAnonymousSticker, String paramAnonymousString)
{
if (BitmojisView.this.mBitmojiClickListener != null)
{
paramAnonymousString = new AnalyticsWrapper().labelForImojiShare(paramAnonymousSticker, paramAnonymousString);
if (paramString != null) {
paramAnonymousString.updateLabelForSearch(paramString, SearchSource.TAG);
}
BitmojisView.this.mBitmojiClickListener.onClick(paramAnonymousSticker, paramAnonymousString);
}
}
}, this.N, this.O);
paramList.init();
setAdapter(paramList);
}
public void setClickListener(BitmojiClickListener paramBitmojiClickListener)
{
this.mBitmojiClickListener = paramBitmojiClickListener;
}
protected void setUp(Context paramContext)
{
((InjectorApplication)paramContext.getApplicationContext()).inject(this);
setVisibility(8);
setBackgroundColor(-1);
}
public void showFromSuperTag(String paramString)
{
populate(this.M.getStickersForSupertag(paramString), null);
setVisibility(0);
}
public void showFromTag(String paramString, boolean paramBoolean)
{
populate(this.M.getStickersForTag(paramString), paramString);
if (paramBoolean)
{
final float f = getX();
setX(getMeasuredWidth());
animate().translationX(f).setListener(new Animator.AnimatorListener()
{
public final void onAnimationCancel(Animator paramAnonymousAnimator) {}
public final void onAnimationEnd(Animator paramAnonymousAnimator)
{
BitmojisView.this.setX(f);
}
public final void onAnimationRepeat(Animator paramAnonymousAnimator) {}
public final void onAnimationStart(Animator paramAnonymousAnimator)
{
BitmojisView.this.setVisibility(0);
}
});
return;
}
setVisibility(0);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/keyboard/BitmojisView.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/