Revision 4f470e00
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/dialog/RubikDialogPatternPagerAdapter.java | ||
---|---|---|
25 | 25 |
import android.support.v4.view.ViewPager; |
26 | 26 |
import android.view.View; |
27 | 27 |
import android.view.ViewGroup; |
28 |
import android.widget.LinearLayout; |
|
29 | 28 |
|
30 | 29 |
import org.distorted.patterns.RubikPattern; |
31 | 30 |
|
... | ... | |
35 | 34 |
{ |
36 | 35 |
private FragmentActivity mAct; |
37 | 36 |
private RubikDialogPatternView[] mViews; |
37 |
private RubikDialogPattern mDialog; |
|
38 | 38 |
private int mNumTabs; |
39 | 39 |
|
40 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
41 |
// TODO: temporary mockup |
|
42 | 41 |
|
43 | 42 |
private String[] createCategories(int pos) |
44 | 43 |
{ |
45 |
String[] ret = new String[8]; |
|
44 |
RubikPattern pattern = RubikPattern.getInstance(); |
|
45 |
int numCat = pattern.getNumCategories(pos); |
|
46 | 46 |
|
47 |
for(int i=0; i<8; i++) |
|
47 |
String[] ret = new String[numCat]; |
|
48 |
|
|
49 |
for(int i=0; i<numCat; i++) |
|
48 | 50 |
{ |
49 |
ret[i] = "CATEGORY "+pos+" "+i;
|
|
51 |
ret[i] = pattern.getCategoryName(pos,i);
|
|
50 | 52 |
} |
51 | 53 |
|
52 | 54 |
return ret; |
... | ... | |
54 | 56 |
|
55 | 57 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
56 | 58 |
|
57 |
RubikDialogPatternPagerAdapter(FragmentActivity act, ViewPager viewPager) |
|
59 |
RubikDialogPatternPagerAdapter(FragmentActivity act, ViewPager viewPager, RubikDialogPattern dialog)
|
|
58 | 60 |
{ |
59 | 61 |
mAct = act; |
62 |
mDialog = dialog; |
|
60 | 63 |
mNumTabs = RubikPattern.NUM_CUBES; |
61 | 64 |
mViews = new RubikDialogPatternView[mNumTabs]; |
62 | 65 |
|
... | ... | |
71 | 74 |
public Object instantiateItem(@NonNull ViewGroup collection, final int position) |
72 | 75 |
{ |
73 | 76 |
String[] categories = createCategories(position); |
74 |
mViews[position] = new RubikDialogPatternView(mAct, categories); |
|
77 |
mViews[position] = new RubikDialogPatternView(mAct, mDialog, categories);
|
|
75 | 78 |
collection.addView(mViews[position]); |
76 | 79 |
|
77 | 80 |
return mViews[position]; |
Also available in: Unified diff
Progress with Pretty Patterns.