Project

General

Profile

« Previous | Next » 

Revision 453ee65a

Added by Leszek Koltunski over 2 years ago

Exit button in the main screen.

View differences:

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, mSolveButton, mScrambleButton;
80
  private TransparentImageButton mObjButton, mMenuButton, mExitButton;
81 81
  private TransparentButton mPlayButton;
82 82
  private PopupWindow mObjectPopup, mMenuPopup, mPlayPopup;
83 83
  private LinearLayout mPlayLayout;
......
128 128
    setupPlayButton(act,mScreenWidth);
129 129
    layoutTop.addView(mPlayButton);
130 130

  
131
    setupSolveButton(act);
132
    setupScrambleButton(act);
133
    createBottomPane(act,mSolveButton,mScrambleButton);
131
    setupExitButton(act);
132
    createBottomPane(act,mExitButton,null);
134 133
    }
135 134

  
136 135
//////////////////////////////////////////////////////////////////////////////////////////////////
......
468 467

  
469 468
///////////////////////////////////////////////////////////////////////////////////////////////////
470 469

  
471
  void setupSolveButton(final RubikActivity act)
470
  void setupExitButton(final RubikActivity act)
472 471
    {
473 472
    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 473
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f);
475
    mSolveButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_END,params);
474
    mExitButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE,params);
476 475

  
477
    mSolveButton.setOnClickListener( new View.OnClickListener()
476
    mExitButton.setOnClickListener( new View.OnClickListener()
478 477
      {
479 478
      @Override
480 479
      public void onClick(View v)
481 480
        {
482
        act.getControl().solveObject();
483
        mMovesController.clearMoves(act);
484
        }
485
      });
486
    }
487

  
488
///////////////////////////////////////////////////////////////////////////////////////////////////
489

  
490
  private void setupScrambleButton(final RubikActivity act)
491
    {
492
    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);
493
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f);
494
    mScrambleButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_START, params);
495

  
496
    mScrambleButton.setOnClickListener( new View.OnClickListener()
497
      {
498
      @Override
499
      public void onClick(View v)
500
        {
501
        int currObject = RubikObjectList.getCurrObject();
502
        RubikObject object = RubikObjectList.getObject(currObject);
503
        int numScrambles = object==null ? 0 : object.getNumScramble();
504
        mShouldReactToEndOfScrambling = false;
505
        act.getControl().scrambleObject(numScrambles);
481
        act.finish();
506 482
        }
507 483
      });
508 484
    }

Also available in: Unified diff