15 |
15 |
|
16 |
16 |
import android.app.Activity;
|
17 |
17 |
import android.content.Context;
|
|
18 |
import android.util.TypedValue;
|
|
19 |
import android.view.Gravity;
|
18 |
20 |
import android.view.LayoutInflater;
|
19 |
21 |
import android.view.View;
|
20 |
22 |
import android.view.ViewGroup;
|
... | ... | |
35 |
37 |
|
36 |
38 |
public class ObjectGridCreator
|
37 |
39 |
{
|
|
40 |
private static final float TITLE_SIZE = 0.8f;
|
|
41 |
private static final float TEXT_SIZE = 0.5f;
|
|
42 |
private static final float TITLE_PADDING = 0.15f;
|
|
43 |
|
38 |
44 |
private GridLayout mGrid;
|
39 |
45 |
private GridLayout[] mCategoryGrids;
|
40 |
46 |
private RubikObjectCategories mROC;
|
... | ... | |
126 |
132 |
layout.setPadding(0,mMargin,0,mMargin);
|
127 |
133 |
scrollView.addView(layout);
|
128 |
134 |
|
|
135 |
int height = (int)(TITLE_SIZE*mCubeSize);
|
|
136 |
|
129 |
137 |
mROC = new RubikObjectCategories(sortMode);
|
130 |
|
if( mROC.hasIcons() ) constructIconBasedGrid(act,layout,mROC,mCubeSize);
|
131 |
|
else constructIconlessGrid(act,layout,mROC,mCubeSize);
|
|
138 |
if( mROC.hasIcons() ) constructIconBasedGrid(act,layout,mROC,height);
|
|
139 |
else constructIconlessGrid(act,layout,mROC,height);
|
132 |
140 |
}
|
133 |
141 |
}
|
134 |
142 |
|
... | ... | |
175 |
183 |
ImageView view = new ImageView(act);
|
176 |
184 |
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,height);
|
177 |
185 |
view.setLayoutParams(params);
|
|
186 |
view.setBackgroundResource(R.color.dark_grey);
|
|
187 |
|
|
188 |
int p = (int)(TITLE_PADDING*height);
|
|
189 |
view.setPadding( p,p,p,p );
|
178 |
190 |
view.setImageResource(iconID);
|
179 |
191 |
|
180 |
192 |
return view;
|
... | ... | |
187 |
199 |
TextView view = new TextView(act);
|
188 |
200 |
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,height);
|
189 |
201 |
view.setLayoutParams(params);
|
|
202 |
view.setBackgroundResource(R.color.dark_grey);
|
|
203 |
view.setGravity(Gravity.CENTER);
|
|
204 |
|
|
205 |
int size = (int)(TEXT_SIZE*height);
|
|
206 |
view.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
|
190 |
207 |
view.setText(title);
|
191 |
208 |
|
192 |
209 |
return view;
|
progress