Project

General

Profile

« Previous | Next » 

Revision 0501a4b8

Added by Leszek Koltunski about 3 years ago

Transpose the Object Popup

View differences:

src/main/java/org/distorted/states/RubikStatePlay.java
238 238
    objectGrid.setColumnCount(mColCount);
239 239
    objectGrid.setRowCount(mRowCount);
240 240

  
241
    int[] nextInColumn = new int[mColCount];
241
    int[] nextInRow = new int[mRowCount];
242 242

  
243 243
    for(int row=0; row<mRowCount; row++)
244 244
      {
245 245
      rowSpecs[row] = GridLayout.spec(row);
246
      nextInRow[row]= 0;
246 247
      }
247 248
    for(int col=0; col<mColCount; col++)
248 249
      {
249 250
      colSpecs[col] = GridLayout.spec(col);
250
      nextInColumn[col] =0;
251 251
      }
252 252

  
253 253
    mObjectPopup = new PopupWindow(act);
......
260 260
    int margin = (int)(width*RubikActivity.LARGE_MARGIN);
261 261
    mObjectSize = (int)(cubeWidth + 2*margin + 0.5f);
262 262

  
263
    for(int object = 0; object< ObjectList.NUM_OBJECTS; object++)
263
    for(int object=0; object< ObjectList.NUM_OBJECTS; object++)
264 264
      {
265 265
      final ObjectList list = ObjectList.getObject(object);
266 266
      final int[] sizes = list.getSizes();
267 267
      int[] icons = list.getIconIDs();
268 268
      int len = sizes.length;
269 269
      final int obj = object;
270
      int col = indices[object];
270
      int row = indices[object];
271 271

  
272 272
      for(int i=0; i<len; i++)
273 273
        {
......
293 293
            }
294 294
          });
295 295

  
296
        GridLayout.LayoutParams params = new GridLayout.LayoutParams(rowSpecs[nextInColumn[col]],colSpecs[col]);
296
        GridLayout.LayoutParams params = new GridLayout.LayoutParams(rowSpecs[row],colSpecs[nextInRow[row]]);
297 297
        params.bottomMargin = margin;
298 298
        params.topMargin    = margin;
299 299
        params.leftMargin   = margin;
300 300
        params.rightMargin  = margin;
301 301

  
302
        nextInColumn[col]++;
302
        nextInRow[row]++;
303 303

  
304 304
        objectGrid.addView(button, params);
305 305
        }

Also available in: Unified diff