Project

General

Profile

« Previous | Next » 

Revision 6f2a942e

Added by Leszek Koltunski about 4 years ago

Bugfixes for Pretty Patterns

View differences:

src/main/java/org/distorted/dialog/RubikDialogPattern.java
69 69

  
70 70
    LayoutInflater layoutInflater = act.getLayoutInflater();
71 71
    TextView tv = (TextView) layoutInflater.inflate(R.layout.dialog_title, null);
72
    tv.setText(R.string.patterns);
72
    tv.setText(R.string.choose_pattern);
73 73
    builder.setCustomTitle(tv);
74 74

  
75 75
    Bundle args = getArguments();
src/main/java/org/distorted/dialog/RubikDialogPatternView.java
149 149
        @Override
150 150
        public void onClick(View view)
151 151
          {
152
          RubikStatePattern state = (RubikStatePattern) RubikState.PATT.getStateClass();
153
          state.setPattern(act, mTab, category, ii);
154 152
          int[] sizes = RubikObjectList.CUBE.getSizes();
155 153
          RubikPattern pattern = RubikPattern.getInstance();
156 154
          int[][] moves = pattern.getMoves(mTab, category, ii);
157 155
          act.changeObject(RubikObjectList.CUBE,sizes[mTab],moves);
156
          RubikStatePattern state = (RubikStatePattern) RubikState.PATT.getStateClass();
157
          state.setPattern(act, mTab, category, ii);
158 158
          mDialog.rememberCategories();
159 159
          mDialog.dismiss();
160 160
          }
src/main/java/org/distorted/patterns/RubikPattern.java
154 154

  
155 155
  private static class Pattern implements RubikPostRender.ActionFinishedListener
156 156
    {
157
    private String name;
157
    private String nameStr, moveStr;
158 158
    private int[][] moves;
159 159
    private int curMove;
160 160
    private int numMove;
161 161
    private boolean mCanRotate;
162
    private boolean mInitialized;
162 163

  
163 164
  /////////////////////////////////////////////////////////////
164 165

  
165 166
    Pattern(String n, String m)
166 167
      {
167
      name=n;
168
      moves= movesParser(m);
169
      curMove=numMove;
170
      mCanRotate = true;
168
      nameStr = n;
169
      moveStr = m;
170
      mCanRotate   = true;
171
      mInitialized = false;
171 172
      }
172 173

  
173 174
  /////////////////////////////////////////////////////////////
......
175 176
    private int[][] movesParser(String moves)
176 177
      {
177 178
      numMove = moves.length()/4;
179
      curMove=numMove;
178 180

  
179 181
      int digit0, digit1, digit2;
180 182
      int[][] result = new int[numMove][3];
......
197 199

  
198 200
    String getName()
199 201
      {
200
      return name;
202
      return nameStr;
201 203
      }
202 204

  
203 205
  /////////////////////////////////////////////////////////////
204 206

  
205 207
    int getNumMove()
206 208
      {
209
      if( !mInitialized )
210
        {
211
        mInitialized = true;
212
        moves = movesParser(moveStr);
213
        moveStr = null;
214
        }
215

  
207 216
      return numMove;
208 217
      }
209 218

  
......
211 220

  
212 221
    int getCurMove()
213 222
      {
223
      if( !mInitialized )
224
        {
225
        mInitialized = true;
226
        moves = movesParser(moveStr);
227
        moveStr = null;
228
        }
229

  
214 230
      return curMove;
215 231
      }
216 232

  
......
218 234

  
219 235
    void makeMove(RubikPostRender post)
220 236
      {
237
      if( !mInitialized )
238
        {
239
        mInitialized = true;
240
        moves = movesParser(moveStr);
241
        moveStr = null;
242
        }
243

  
221 244
      curMove++;
222 245
      RubikObject object = post.getObject();
223 246

  
......
252 275

  
253 276
    void backMove(RubikPostRender post)
254 277
      {
278
      if( !mInitialized )
279
        {
280
        mInitialized = true;
281
        moves = movesParser(moveStr);
282
        moveStr = null;
283
        }
284

  
255 285
      curMove--;
256 286
      RubikObject object = post.getObject();
257 287

  
......
286 316

  
287 317
    int[][] getMoves()
288 318
      {
319
      if( !mInitialized )
320
        {
321
        mInitialized = true;
322
        moves = movesParser(moveStr);
323
        moveStr = null;
324
        }
325

  
326
      curMove = numMove;
289 327
      return moves;
290 328
      }
291 329

  
src/main/java/org/distorted/uistate/RubikStatePattern.java
163 163
        if( diag==null )
164 164
          {
165 165
          mText.setTextSize(DEFAULT_TEXT_SIZE);
166
          mText.setText(R.string.patterns);
167 166
          showDialog(mana);
168 167
          }
169 168
        else
src/main/res/values/strings.xml
9 9
    <string name="effects">Effects</string>
10 10
    <string name="scores">High Scores</string>
11 11
    <string name="patterns">Pretty Patterns</string>
12
    <string name="choose_pattern">Choose a Pattern</string>
12 13
    <string name="solver">3x3x3 Solver</string>
13 14
    <string name="about">About</string>
14 15
    <string name="solved">Solved</string>

Also available in: Unified diff