ImojiPagerAdapter.java
3.22 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
package com.bitstrips.imoji.browser.adapters;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.app.FragmentTransaction;
import android.view.ViewGroup;
import com.bitstrips.imoji.browser.fragments.ImojiBrowserFragment;
import com.bitstrips.imoji.ui.fragments.FavouriteFragment;
import com.bitstrips.imoji.ui.fragments.SearchContainerFragment;
import com.bitstrips.imoji.ui.fragments.SearchResultFragment;
import java.lang.ref.WeakReference;
import java.util.List;
public class ImojiPagerAdapter
extends FragmentStatePagerAdapter
{
public static final int POSITION_FAVOURITE_FRAGMENT = 1;
public static final int POSITION_SEARCH_FRAGMENT = 0;
private static final String d = ImojiPagerAdapter.class.getCanonicalName();
private List<String> a;
private FragmentManager b;
private WeakReference<SearchContainerFragment> c;
public ImojiPagerAdapter(FragmentManager paramFragmentManager, List<String> paramList)
{
super(paramFragmentManager);
this.b = paramFragmentManager;
this.a = paramList;
}
public void destroyItem(ViewGroup paramViewGroup, int paramInt, Object paramObject)
{
if (paramInt != 0) {}
for (;;)
{
FragmentTransaction localFragmentTransaction;
try
{
Fragment localFragment = (Fragment)paramObject;
localFragmentTransaction = this.b.beginTransaction();
localFragmentTransaction.remove(localFragment);
localFragmentTransaction.commitAllowingStateLoss();
super.destroyItem(paramViewGroup, paramInt, paramObject);
return;
}
catch (IllegalStateException localIllegalStateException)
{
new StringBuilder("Caught unexpected exception while destroying item: ").append(localIllegalStateException.getMessage());
continue;
}
SearchResultFragment localSearchResultFragment = (SearchResultFragment)this.b.findFragmentByTag("fragments.SearchResultFragment");
if (localSearchResultFragment != null)
{
localFragmentTransaction = this.b.beginTransaction();
localFragmentTransaction.remove(localSearchResultFragment);
localFragmentTransaction.commitAllowingStateLoss();
this.b.popBackStack();
}
}
}
public int getCount()
{
return this.a.size() + 1;
}
public Fragment getItem(int paramInt)
{
if (paramInt == 0) {
return getOrCreateSearchFragment();
}
if (paramInt == 1) {
return FavouriteFragment.newInstance();
}
return ImojiBrowserFragment.newInstance((String)this.a.get(paramInt - 1));
}
public int getItemPosition(Object paramObject)
{
return -2;
}
public SearchContainerFragment getOrCreateSearchFragment()
{
if (!hasSearchFragment()) {
this.c = new WeakReference(SearchContainerFragment.newInstance());
}
return (SearchContainerFragment)this.c.get();
}
public boolean hasSearchFragment()
{
return (this.c != null) && (this.c.get() != null);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/browser/adapters/ImojiPagerAdapter.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/