Project

General

Profile

« Previous | Next » 

Revision dd73fdab

Added by Leszek Koltunski over 4 years ago

Improvements

View differences:

src/main/java/org/distorted/magic/RubikActivity.java
39 39
{
40 40
    static final int DEFAULT_SIZE  = 3;
41 41
    static final int SMALLEST_SIZE = 2;
42
    private static final int[] button_ids  = {R.id.rubikSize2, R.id.rubikSize3, R.id.rubikSize4, R.id.rubikSize5};
43 42

  
44 43
    public static final int MIN_SCRAMBLE =  1;
45 44
    public static final int DEF_SCRAMBLE =  1;
......
54 53
      {
55 54
      mSize = size;
56 55

  
57
      for(int b=0; b<button_ids.length; b++)
56
      for(int b=0; b<RubikSize.LENGTH; b++)
58 57
        {
59
        Drawable d = findViewById(button_ids[b]).getBackground();
58
        Drawable d = findViewById(RubikSize.getSize(b).getImageButton()).getBackground();
60 59

  
61 60
        if( size == b+SMALLEST_SIZE )
62 61
          {
......
109 108
      return mSize;
110 109
      }
111 110

  
112
///////////////////////////////////////////////////////////////////////////////////////////////////
113

  
114
    static int getNumCubes()
115
      {
116
      return button_ids.length;
117
      }
118

  
119 111
///////////////////////////////////////////////////////////////////////////////////////////////////
120 112

  
121 113
    @Override
......
214 206
      {
215 207
      int size=0, id = v.getId();
216 208

  
217
      for(int b=0; b<button_ids.length; b++)
218
        if( button_ids[b] == id )
209
      for(int b=0; b<RubikSize.LENGTH; b++)
210
        if( RubikSize.getSize(b).getImageButton() == id )
219 211
          {
220 212
          size = b+SMALLEST_SIZE;
221 213
          break;

Also available in: Unified diff