Revision b498f3f6
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/dialog/RubikDialogPattern.java | ||
---|---|---|
37 | 37 |
import android.widget.TextView; |
38 | 38 |
|
39 | 39 |
import org.distorted.magic.R; |
40 |
import org.distorted.patterns.RubikPattern; |
|
40 |
import org.distorted.object.RubikObjectList; |
|
41 |
import org.distorted.patterns.RubikPatternList; |
|
41 | 42 |
|
42 | 43 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
43 | 44 |
|
... | ... | |
94 | 95 |
tabLayout.setupWithViewPager(viewPager); |
95 | 96 |
viewPager.setCurrentItem(curTab); |
96 | 97 |
|
97 |
int[] iconID = { R.drawable.cube2, R.drawable.cube3, R.drawable.cube4, R.drawable.cube5 }; |
|
98 |
|
|
99 |
for(int i=0; i< RubikPattern.NUM_CUBES; i++) |
|
98 |
for(int i=0; i< RubikPatternList.NUM_OBJECTS; i++) |
|
100 | 99 |
{ |
100 |
RubikObjectList list = RubikPatternList.getObject(i); |
|
101 |
int size = RubikPatternList.getSize(i); |
|
102 |
int sizeIndex = RubikObjectList.getSizeIndex(list.ordinal(),size); |
|
103 |
int iconID = list.getIconIDs()[sizeIndex]; |
|
104 |
|
|
101 | 105 |
ImageView imageView = new ImageView(act); |
102 |
imageView.setImageResource(iconID[i]);
|
|
106 |
imageView.setImageResource(iconID); |
|
103 | 107 |
TabLayout.Tab tab = tabLayout.getTabAt(i); |
104 | 108 |
if(tab!=null) tab.setCustomView(imageView); |
105 | 109 |
} |
Also available in: Unified diff
Introduce RubikPatternsList. Now, if one wants to contribute patterns for a new object, all one has to be is give the list of strings describing the patterns and add them to the List.