ImojiCategoriesViewController.java
4.01 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
package com.bitstrips.imoji.browser;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Rect;
import android.support.annotation.NonNull;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.GridLayoutManager.SpanSizeLookup;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ItemDecoration;
import android.support.v7.widget.RecyclerView.State;
import android.util.DisplayMetrics;
import android.view.View;
import com.bitstrips.imoji.analytics.LegacyAnalyticsService;
import com.bitstrips.imoji.browser.adapters.StickerCategoriesAdapter;
import com.bitstrips.imoji.browser.models.StickerCategory;
import com.bitstrips.imoji.browser.views.StickerViewHolder.OnStickerSelectedListener;
import com.bitstrips.imoji.persistence.MediaCache;
import java.util.Collections;
import java.util.List;
public class ImojiCategoriesViewController
{
private final RecyclerView a;
private final List<StickerCategory> b;
private final StickerViewHolder.OnStickerSelectedListener c;
private final MediaCache d;
private final LegacyAnalyticsService e;
private StickerCategoriesAdapter f;
public ImojiCategoriesViewController(RecyclerView paramRecyclerView, StickerCategory paramStickerCategory, StickerViewHolder.OnStickerSelectedListener paramOnStickerSelectedListener, MediaCache paramMediaCache, LegacyAnalyticsService paramLegacyAnalyticsService)
{
this(paramRecyclerView, Collections.singletonList(paramStickerCategory), paramOnStickerSelectedListener, paramMediaCache, paramLegacyAnalyticsService);
}
public ImojiCategoriesViewController(RecyclerView paramRecyclerView, List<StickerCategory> paramList, StickerViewHolder.OnStickerSelectedListener paramOnStickerSelectedListener, MediaCache paramMediaCache, LegacyAnalyticsService paramLegacyAnalyticsService)
{
this.a = paramRecyclerView;
this.b = paramList;
this.c = paramOnStickerSelectedListener;
this.d = paramMediaCache;
this.e = paramLegacyAnalyticsService;
}
public void init(Context paramContext, @NonNull String paramString)
{
paramContext = new GridLayoutManager(paramContext, 3);
final int i = (int)(8.0F * this.a.getResources().getDisplayMetrics().density);
paramContext.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup()
{
public final int getSpanSize(int paramAnonymousInt)
{
return ImojiCategoriesViewController.a(ImojiCategoriesViewController.this).getSpanSize(paramAnonymousInt, 3);
}
});
this.a.setHasFixedSize(true);
this.a.setLayoutManager(paramContext);
this.a.addItemDecoration(new RecyclerView.ItemDecoration()
{
public final void getItemOffsets(Rect paramAnonymousRect, View paramAnonymousView, RecyclerView paramAnonymousRecyclerView, RecyclerView.State paramAnonymousState)
{
int i = paramAnonymousRecyclerView.getChildAdapterPosition(paramAnonymousView);
float f2 = paramAnonymousRecyclerView.getWidth();
float f1 = f2 / 3.0F;
f2 = (f2 - this.a) / 3.0F;
paramAnonymousRect.bottom = i;
if (ImojiCategoriesViewController.a(ImojiCategoriesViewController.this).isItemImoji(i))
{
i = ImojiCategoriesViewController.a(ImojiCategoriesViewController.this).getCategoryPosition(i) % 3;
float f3 = i;
float f4 = i;
paramAnonymousRect.left = ((int)((f2 + i) * f4 + f3 - f1 * i));
paramAnonymousRect.right = (i - paramAnonymousRect.left);
if (i < 3) {
paramAnonymousRect.top = i;
}
}
}
});
reloadAdapter(paramString);
}
public void reloadAdapter(@NonNull String paramString)
{
this.f = new StickerCategoriesAdapter(paramString, this.b, this.c, this.d, this.e);
this.f.init();
this.a.setAdapter(this.f);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/browser/ImojiCategoriesViewController.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/