Project

General

Profile

« Previous | Next » 

Revision 264af0ad

Added by Leszek Koltunski about 4 years ago

More support for the 3x3x3 Solver.

View differences:

src/main/java/org/distorted/uistate/RubikStateSolver.java
49 49

  
50 50
  private static Bitmap[] mBitmap;
51 51
  private ImageButton[] mColorButton;
52
  private Button mBackButton;
52
  private Button mBackButton, mSolveButton;
53 53

  
54 54
///////////////////////////////////////////////////////////////////////////////////////////////////
55 55

  
......
77 77
    for(ImageButton button: mColorButton) layoutTop.addView(button);
78 78

  
79 79
    // BOT ////////////////////////////
80
    if( mSolveButton==null ) setupSolveButton(act,scale);
81

  
82
    LinearLayout layoutLeft = act.findViewById(R.id.mainBarLeft);
83
    layoutLeft.removeAllViews();
84
    layoutLeft.addView(mSolveButton);
85

  
80 86
    if( mBackButton==null ) setupBackButton(act,scale);
81 87

  
82 88
    LinearLayout layoutRight = act.findViewById(R.id.mainBarRight);
......
143 149
      }
144 150
    }
145 151

  
152
///////////////////////////////////////////////////////////////////////////////////////////////////
153

  
154
  private void setupSolveButton(final RubikActivity act, final float scale)
155
    {
156
    int padding = (int)(3*scale + 0.5f);
157
    LinearLayout.LayoutParams backParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);
158
    mSolveButton = new Button(act);
159
    mSolveButton.setLayoutParams(backParams);
160
    mSolveButton.setPadding(padding,0,padding,0);
161
    mSolveButton.setText(R.string.solve);
162

  
163
    mSolveButton.setOnClickListener( new View.OnClickListener()
164
      {
165
      @Override
166
      public void onClick(View v)
167
        {
168
        RubikState.switchState(act,RubikState.SOLU);
169
        }
170
      });
171
    }
172

  
146 173
///////////////////////////////////////////////////////////////////////////////////////////////////
147 174

  
148 175
  private void setupBackButton(final RubikActivity act, final float scale)

Also available in: Unified diff