Revision 4c650458
Added by Leszek Koltunski almost 4 years ago
| src/main/java/org/distorted/screens/RubikScreenPlay.java | ||
|---|---|---|
| 246 | 246 |
mObjectSize = (int)(cubeWidth + 2*margin + 0.5f); |
| 247 | 247 |
mMaxRowCount = (int)((height-1.8f*mUpperBarHeight)/mObjectSize); |
| 248 | 248 |
int layoutH = (int)(1.5f*mObjectSize); |
| 249 |
int viewID = R.layout.popup_object; |
|
| 249 | 250 |
|
| 250 |
int viewID = mMaxRowCount<mRowCount ? R.layout.popup_object_withscroll : R.layout.popup_object_scrollless; |
|
| 251 |
View view = inflate( act, viewID, null); |
|
| 251 |
LinearLayout view = (LinearLayout)inflate( act, viewID, null); |
|
| 252 | 252 |
GridLayout objectGrid = view.findViewById(R.id.objectGrid); |
| 253 | 253 |
|
| 254 | 254 |
GridLayout.Spec[] rowSpecs = new GridLayout.Spec[mRowCount]; |
| ... | ... | |
| 407 | 407 |
|
| 408 | 408 |
void setupBottomLayout(final RubikActivity act, final LinearLayout layout, int width) |
| 409 | 409 |
{
|
| 410 |
int icon1 = RubikActivity.getDrawable(R.drawable.ui_small_cube_solve_new,R.drawable.ui_medium_cube_solve_new, R.drawable.ui_big_cube_solve_new, R.drawable.ui_huge_cube_solve_new);
|
|
| 411 |
LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(width,LinearLayout.LayoutParams.MATCH_PARENT,1.0f);
|
|
| 412 |
TransparentImageButton buttonTut = new TransparentImageButton(act, icon1, TransparentImageButton.GRAVITY_MIDDLE, params1);
|
|
| 410 |
int iconT = RubikActivity.getDrawable(R.drawable.ui_small_tutorial,R.drawable.ui_medium_tutorial, R.drawable.ui_big_tutorial, R.drawable.ui_huge_tutorial);
|
|
| 411 |
LinearLayout.LayoutParams paramsT = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f);
|
|
| 412 |
TransparentImageButton buttonTut = new TransparentImageButton(act, iconT, TransparentImageButton.GRAVITY_MIDDLE, paramsT);
|
|
| 413 | 413 |
|
| 414 |
int icon2 = RubikActivity.getDrawable(R.drawable.ui_small_cube_solve_new,R.drawable.ui_medium_cube_solve_new, R.drawable.ui_big_cube_solve_new, R.drawable.ui_huge_cube_solve_new);
|
|
| 415 |
LinearLayout.LayoutParams params2 = new LinearLayout.LayoutParams(width,LinearLayout.LayoutParams.MATCH_PARENT,1.0f);
|
|
| 416 |
TransparentImageButton buttonDet = new TransparentImageButton(act, icon2, TransparentImageButton.GRAVITY_MIDDLE, params2);
|
|
| 414 |
int iconD = RubikActivity.getDrawable(R.drawable.ui_small_info,R.drawable.ui_medium_info, R.drawable.ui_big_info, R.drawable.ui_huge_info);
|
|
| 415 |
LinearLayout.LayoutParams paramsD = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f);
|
|
| 416 |
TransparentImageButton buttonDet = new TransparentImageButton(act, iconD, TransparentImageButton.GRAVITY_MIDDLE, paramsD);
|
|
| 417 | 417 |
|
| 418 | 418 |
buttonTut.setOnClickListener( new View.OnClickListener() |
| 419 | 419 |
{
|
| 420 | 420 |
@Override |
| 421 | 421 |
public void onClick(View v) |
| 422 | 422 |
{
|
| 423 |
android.util.Log.e("D", "BUTTON TUT CLICKED!!");
|
|
| 423 |
if( mObjectPopup!=null ) mObjectPopup.dismiss(); |
|
| 424 |
RubikDialogTutorial tDiag = new RubikDialogTutorial(); |
|
| 425 |
tDiag.show( act.getSupportFragmentManager(), RubikDialogTutorial.getDialogTag() ); |
|
| 424 | 426 |
} |
| 425 | 427 |
}); |
| 426 | 428 |
|
| ... | ... | |
| 433 | 435 |
} |
| 434 | 436 |
}); |
| 435 | 437 |
|
| 436 |
LinearLayout.LayoutParams paramsNul = new LinearLayout.LayoutParams(width,LinearLayout.LayoutParams.MATCH_PARENT,1.0f);
|
|
| 438 |
LinearLayout.LayoutParams paramsNul = new LinearLayout.LayoutParams(width,LinearLayout.LayoutParams.MATCH_PARENT,2.0f);
|
|
| 437 | 439 |
Button buttonNul = new Button(act); |
| 438 | 440 |
buttonNul.setLayoutParams(paramsNul); |
| 439 | 441 |
buttonNul.setVisibility(View.INVISIBLE); |
| src/main/res/layout/popup_object.xml | ||
|---|---|---|
| 1 |
<?xml version="1.0" encoding="utf-8"?> |
|
| 2 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
| 3 |
android:layout_width="match_parent" |
|
| 4 |
android:layout_height="match_parent" |
|
| 5 |
android:orientation="vertical"> |
|
| 6 |
|
|
| 7 |
<ScrollView |
|
| 8 |
android:id="@+id/objectScroll" |
|
| 9 |
android:layout_width="match_parent" |
|
| 10 |
android:layout_height="match_parent" |
|
| 11 |
android:layout_weight="1"> |
|
| 12 |
|
|
| 13 |
<GridLayout |
|
| 14 |
android:id="@+id/objectGrid" |
|
| 15 |
android:layout_width="match_parent" |
|
| 16 |
android:layout_height="wrap_content"> |
|
| 17 |
</GridLayout> |
|
| 18 |
|
|
| 19 |
</ScrollView> |
|
| 20 |
|
|
| 21 |
<LinearLayout |
|
| 22 |
android:id="@+id/bottomLayout" |
|
| 23 |
android:background="@color/grey" |
|
| 24 |
android:layout_width="match_parent" |
|
| 25 |
android:layout_height="100dp" |
|
| 26 |
android:layout_weight="1" |
|
| 27 |
android:paddingEnd="5dp" |
|
| 28 |
android:paddingStart="5dp" |
|
| 29 |
android:orientation="horizontal"> |
|
| 30 |
|
|
| 31 |
</LinearLayout> |
|
| 32 |
|
|
| 33 |
</LinearLayout> |
|
| src/main/res/layout/popup_object_scrollless.xml | ||
|---|---|---|
| 1 |
<?xml version="1.0" encoding="utf-8"?> |
|
| 2 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
| 3 |
android:layout_width="match_parent" |
|
| 4 |
android:layout_height="match_parent" |
|
| 5 |
android:orientation="vertical"> |
|
| 6 |
|
|
| 7 |
<GridLayout |
|
| 8 |
android:id="@+id/objectGrid" |
|
| 9 |
android:layout_width="match_parent" |
|
| 10 |
android:layout_height="match_parent" |
|
| 11 |
android:layout_weight="1"> |
|
| 12 |
</GridLayout> |
|
| 13 |
|
|
| 14 |
<LinearLayout |
|
| 15 |
android:id="@+id/bottomLayout" |
|
| 16 |
android:background="@color/grey" |
|
| 17 |
android:layout_width="match_parent" |
|
| 18 |
android:layout_height="100dp" |
|
| 19 |
android:layout_weight="1" |
|
| 20 |
android:paddingEnd="5dp" |
|
| 21 |
android:paddingStart="5dp" |
|
| 22 |
android:orientation="horizontal"> |
|
| 23 |
|
|
| 24 |
</LinearLayout> |
|
| 25 |
|
|
| 26 |
</LinearLayout> |
|
| src/main/res/layout/popup_object_withscroll.xml | ||
|---|---|---|
| 1 |
<?xml version="1.0" encoding="utf-8"?> |
|
| 2 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
| 3 |
android:layout_width="match_parent" |
|
| 4 |
android:layout_height="match_parent" |
|
| 5 |
android:orientation="vertical"> |
|
| 6 |
|
|
| 7 |
<ScrollView |
|
| 8 |
android:id="@+id/objectScroll" |
|
| 9 |
android:layout_width="match_parent" |
|
| 10 |
android:layout_height="match_parent" |
|
| 11 |
android:layout_weight="1"> |
|
| 12 |
|
|
| 13 |
<GridLayout |
|
| 14 |
android:id="@+id/objectGrid" |
|
| 15 |
android:layout_width="match_parent" |
|
| 16 |
android:layout_height="wrap_content"> |
|
| 17 |
</GridLayout> |
|
| 18 |
|
|
| 19 |
</ScrollView> |
|
| 20 |
|
|
| 21 |
<LinearLayout |
|
| 22 |
android:id="@+id/bottomLayout" |
|
| 23 |
android:background="@color/grey" |
|
| 24 |
android:layout_width="match_parent" |
|
| 25 |
android:layout_height="100dp" |
|
| 26 |
android:layout_weight="1" |
|
| 27 |
android:paddingEnd="5dp" |
|
| 28 |
android:paddingStart="5dp" |
|
| 29 |
android:orientation="horizontal"> |
|
| 30 |
|
|
| 31 |
</LinearLayout> |
|
| 32 |
|
|
| 33 |
</LinearLayout> |
|
Also available in: Unified diff
Minor.