Project

General

Profile

« Previous | Next » 

Revision 756f152c

Added by Leszek Koltunski over 2 years ago

Come back to solve/scramble in the main screen.

View differences:

src/main/java/org/distorted/screens/RubikScreenFreePlay.java
107 107
      @Override
108 108
      public void onClick(View v)
109 109
        {
110
        ScreenList.goBack(act);
110
        if(act.getControl().isUINotBlocked()) ScreenList.goBack(act);
111 111
        }
112 112
      });
113 113
    }
......
125 125
      @Override
126 126
      public void onClick(View v)
127 127
        {
128
        Bundle bundle = new Bundle();
129
        bundle.putInt("scraPos", mScrambleDepth );
130
        bundle.putInt("animPos", mAnimationMode );
128
        if(act.getControl().isUINotBlocked())
129
          {
130
          Bundle bundle = new Bundle();
131
          bundle.putInt("scraPos", mScrambleDepth );
132
          bundle.putInt("animPos", mAnimationMode );
131 133

  
132
        RubikDialogFreePlaySettings setDiag = new RubikDialogFreePlaySettings();
133
        setDiag.setArguments(bundle);
134
        setDiag.show(act.getSupportFragmentManager(), null);
134
          RubikDialogFreePlaySettings setDiag = new RubikDialogFreePlaySettings();
135
          setDiag.setArguments(bundle);
136
          setDiag.show(act.getSupportFragmentManager(), null);
137
          }
135 138
        }
136 139
      });
137 140
    }
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