Revision 3a9d19ed
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/dialog/RubikDialogPatternPagerAdapter.java | ||
---|---|---|
37 | 37 |
private RubikDialogPattern mDialog; |
38 | 38 |
private int mNumTabs; |
39 | 39 |
|
40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
41 |
|
|
42 |
private String[] createCategories(int pos) |
|
43 |
{ |
|
44 |
RubikPattern pattern = RubikPattern.getInstance(); |
|
45 |
int numCat = pattern.getNumCategories(pos); |
|
46 |
|
|
47 |
String[] ret = new String[numCat]; |
|
48 |
|
|
49 |
for(int i=0; i<numCat; i++) |
|
50 |
{ |
|
51 |
ret[i] = pattern.getCategoryName(pos,i); |
|
52 |
} |
|
53 |
|
|
54 |
return ret; |
|
55 |
} |
|
56 |
|
|
57 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
58 | 41 |
|
59 | 42 |
RubikDialogPatternPagerAdapter(FragmentActivity act, ViewPager viewPager, RubikDialogPattern dialog) |
... | ... | |
73 | 56 |
@NonNull |
74 | 57 |
public Object instantiateItem(@NonNull ViewGroup collection, final int position) |
75 | 58 |
{ |
76 |
String[] categories = createCategories(position); |
|
77 |
mViews[position] = new RubikDialogPatternView(mAct, mDialog, categories); |
|
59 |
mViews[position] = new RubikDialogPatternView(mAct, mDialog, position); |
|
78 | 60 |
collection.addView(mViews[position]); |
79 | 61 |
|
80 | 62 |
return mViews[position]; |
Also available in: Unified diff
Progress with Pretty Patterns.