Project

General

Profile

« Previous | Next » 

Revision fad10885

Added by Leszek Koltunski over 1 year ago

Move the 'bandaged' button back to the main menu.

View differences:

src/main/java/org/distorted/screens/RubikScreenPlay.java
43 43
import org.distorted.dialogs.RubikDialogTutorial;
44 44
import org.distorted.helpers.TransparentImageButton;
45 45
import org.distorted.objectlib.main.ObjectControl;
46
import org.distorted.objects.MainEntry;
47
import org.distorted.objects.MainEntryList;
48 46
import org.distorted.objects.RubikObject;
49 47
import org.distorted.objects.RubikObjectList;
50 48

  
......
56 54
  {
57 55
  public static final int NUM_COLUMNS  = 5;
58 56
  public static final int LEVELS_SHOWN = 8;
59
  private static final int NUM_BUTTONS = 5;
57
  private static final int NUM_BUTTONS = 6;
60 58
  private static final int[] mLocation = new int[2];
61 59

  
62 60
  private TransparentImageButton mObjButton, mMenuButton, mSolveButton, mScrambleButton;
......
173 171

  
174 172
  private void setupObjectWindow(final RubikActivity act, final float width, final float height)
175 173
    {
176
    MainEntryList list = MainEntryList.getInstance();
177
    int numEntries = list.getNumOfEntries();
178
    mRowCount = (numEntries + NUM_COLUMNS-1) / NUM_COLUMNS;
174
    int numObjects = RubikObjectList.getNumObjects();
175
    mRowCount = (numObjects + NUM_COLUMNS-1) / NUM_COLUMNS;
179 176
    mColCount = NUM_COLUMNS;
180 177

  
181 178
    int cubeSize = (int)(width/9);
......
211 208
      colSpecs[col] = GridLayout.spec(col);
212 209
      }
213 210

  
214
    for(int entry=0; entry<numEntries; entry++)
211
    for(int object=0; object<numObjects; object++)
215 212
      {
216
      final MainEntry mainEntry = list.getEntry(entry);
217
      int row = entry/NUM_COLUMNS;
213
      final int ordinal = object;
214
      final RubikObject rObject = RubikObjectList.getObject(object);
215
      int row = object/NUM_COLUMNS;
218 216
      ImageButton button = new ImageButton(act);
219
      if( mainEntry!=null ) mainEntry.setIconTo(act,button);
217
      if( rObject!=null ) rObject.setIconTo(act,button);
220 218

  
221 219
      button.setOnClickListener( new View.OnClickListener()
222 220
        {
......
225 223
          {
226 224
          if( act.getControl().isUINotBlocked() && ScreenList.getCurrentScreen()== ScreenList.PLAY )
227 225
            {
228
            int type = mainEntry!=null ? mainEntry.getType() : -1;
229

  
230
            if( type==MainEntry.TYPE_OBJECT )
231
              {
232
              int ordinal = mainEntry.getOrdinal();
233
              RubikObjectList.setCurrObject(ordinal);
234
              act.changeObject(ordinal,true);
235
              if( mMenuPopup!=null ) setupLevelColors(act);
236
              mMovesController.clearMoves(act);
237
              }
238
            else if( type==MainEntry.TYPE_CREATOR )
239
              {
240
              act.switchToBandagedCreator();
241
              }
226
            RubikObjectList.setCurrObject(ordinal);
227
            act.changeObject(ordinal,true);
228
            if( mMenuPopup!=null ) setupLevelColors(act);
229
            mMovesController.clearMoves(act);
242 230
            }
243 231

  
244 232
          if( mObjectPopup!=null ) mObjectPopup.dismiss();
......
433 421
          }
434 422
        });
435 423

  
424
    Button bandaged = layout.findViewById(R.id.menuBandaged);
425
    bandaged.setTextSize(TypedValue.COMPLEX_UNIT_PX, mMenuTextSize);
426
    bandaged.setOnClickListener( new View.OnClickListener()
427
        {
428
        @Override
429
        public void onClick(View v)
430
          {
431
          mMenuPopup.dismiss();
432
          act.switchToBandagedCreator();
433
          }
434
        });
435

  
436 436
    Button about = layout.findViewById(R.id.menuAbout);
437 437
    about.setTextSize(TypedValue.COMPLEX_UNIT_PX, mMenuTextSize);
438 438
    about.setOnClickListener( new View.OnClickListener()

Also available in: Unified diff