Revision 756f152c
Added by Leszek Koltunski almost 2 years ago
src/main/java/org/distorted/screens/RubikScreenPlay.java | ||
---|---|---|
77 | 77 |
private static final float BIG_BUTTON = 1.5f; |
78 | 78 |
private static final int[] mLocation = new int[2]; |
79 | 79 |
|
80 |
private TransparentImageButton mObjButton, mMenuButton, mExitButton;
|
|
80 |
private TransparentImageButton mObjButton, mMenuButton, mSolveButton, mScrambleButton;
|
|
81 | 81 |
private TransparentButton mPlayButton; |
82 | 82 |
private PopupWindow mObjectPopup, mMenuPopup, mPlayPopup; |
83 | 83 |
private LinearLayout mPlayLayout; |
... | ... | |
129 | 129 |
setupPlayButton(act,mScreenWidth); |
130 | 130 |
layoutTop.addView(mPlayButton); |
131 | 131 |
|
132 |
setupExitButton(act); |
|
133 |
createBottomPane(act,mExitButton,null); |
|
132 |
setupSolveButton(act); |
|
133 |
setupScrambleButton(act); |
|
134 |
createBottomPane(act,mSolveButton,mScrambleButton); |
|
134 | 135 |
} |
135 | 136 |
|
136 | 137 |
////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
468 | 469 |
|
469 | 470 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
470 | 471 |
|
471 |
void setupExitButton(final RubikActivity act)
|
|
472 |
void setupSolveButton(final RubikActivity act)
|
|
472 | 473 |
{ |
473 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_exit,R.drawable.ui_medium_exit, R.drawable.ui_big_exit, R.drawable.ui_huge_exit);
|
|
474 |
int icon = 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);
|
|
474 | 475 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
475 |
mExitButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE,params);
|
|
476 |
mSolveButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_END,params);
|
|
476 | 477 |
|
477 |
mExitButton.setOnClickListener( new View.OnClickListener()
|
|
478 |
mSolveButton.setOnClickListener( new View.OnClickListener()
|
|
478 | 479 |
{ |
479 | 480 |
@Override |
480 | 481 |
public void onClick(View v) |
481 | 482 |
{ |
482 |
act.finish(); |
|
483 |
act.getControl().solveObject(); |
|
484 |
mMovesController.clearMoves(act); |
|
485 |
} |
|
486 |
}); |
|
487 |
} |
|
488 |
|
|
489 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
490 |
|
|
491 |
private void setupScrambleButton(final RubikActivity act) |
|
492 |
{ |
|
493 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_scramble_new,R.drawable.ui_medium_cube_scramble_new, R.drawable.ui_big_cube_scramble_new, R.drawable.ui_huge_cube_scramble_new); |
|
494 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
|
495 |
mScrambleButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_START, params); |
|
496 |
|
|
497 |
mScrambleButton.setOnClickListener( new View.OnClickListener() |
|
498 |
{ |
|
499 |
@Override |
|
500 |
public void onClick(View v) |
|
501 |
{ |
|
502 |
int currObject = RubikObjectList.getCurrObject(); |
|
503 |
RubikObject object = RubikObjectList.getObject(currObject); |
|
504 |
int numScrambles = object==null ? 0 : object.getNumScramble(); |
|
505 |
mShouldReactToEndOfScrambling = false; |
|
506 |
act.getControl().scrambleObject(numScrambles); |
|
483 | 507 |
} |
484 | 508 |
}); |
485 | 509 |
} |
Also available in: Unified diff
Come back to solve/scramble in the main screen.