Project

General

Profile

« Previous | Next » 

Revision c5fca790

Added by Leszek Koltunski almost 2 years ago

Progress with new UI

View differences:

src/main/java/org/distorted/screens/RubikScreenPlay.java
42 42
import org.distorted.main.RubikActivity;
43 43
import org.distorted.dialogs.RubikDialogAbout;
44 44
import org.distorted.helpers.TransparentImageButton;
45
import org.distorted.objects.RubikObject;
46
import org.distorted.objects.RubikObjectList;
45
import org.distorted.objects.MainEntry;
46
import org.distorted.objects.MainEntryList;
47 47

  
48 48
///////////////////////////////////////////////////////////////////////////////////////////////////
49 49

  
......
56 56
  private TextView mBubbleUpdates;
57 57
  private int mCurrentBubbleNumber;
58 58
  private int mLevelValue;
59
  private int mColCount, mRowCount;
59
  private int mColCount, mRowCount, mNumObjects;
60 60
  private float mScreenWidth;
61 61
  private WeakReference<RubikActivity> mWeakAct;
62 62

  
......
75 75
    {
76 76
    act.switchRenderingOff();
77 77
    mWeakAct = new WeakReference<>(act);
78
    int numObjects = RubikObjectList.getNumObjects();
79 78
    mScreenWidth = act.getScreenWidthInPixels();
80 79
    int screenHeight= act.getScreenHeightInPixels();
81 80
    int upperBarHeight = act.getHeightUpperBar();
82 81
    int lowerBarHeight = act.getHeightLowerBar();
83 82

  
84
    mRowCount = (numObjects + NUM_COLUMNS-1) / NUM_COLUMNS;
85
    mColCount = NUM_COLUMNS;
83
    computeRowAndColCounts();
86 84

  
87 85
    float titleSize = mScreenWidth*RubikActivity.TITLE_TEXT_SIZE;
88 86
    LayoutInflater inflater = act.getLayoutInflater();
......
228 226
      colSpecs[col] = GridLayout.spec(col);
229 227
      }
230 228

  
231
    int numObjects = RubikObjectList.getNumObjects();
229
    MainEntryList list = MainEntryList.getInstance();
232 230

  
233
    for(int object=0; object<numObjects; object++)
231
    for(int index=0; index<mNumObjects; index++)
234 232
      {
235
      final int ordinal = object;
236
      RubikObject rObject = RubikObjectList.getObject(ordinal);
237
      int row = object/NUM_COLUMNS;
233
      MainEntry entry = list.getEntry(index);
234
      int row = index/NUM_COLUMNS;
238 235
      ImageButton button = new ImageButton(act);
239
      if( rObject!=null ) rObject.setIconTo(act,button);
236
      if( entry!=null ) entry.setIconTo(act,button);
240 237

  
241 238
      button.setOnClickListener( new View.OnClickListener()
242 239
        {
243 240
        @Override
244 241
        public void onClick(View v)
245 242
          {
246
          // TODO
247
          android.util.Log.e("D", "object "+ordinal+" clicked");
243
          entry.onClick(act);
248 244
          }
249 245
        });
250 246

  
......
290 286

  
291 287
  public void recreateListOfObjects()
292 288
    {
293
    int numObjects = RubikObjectList.getNumObjects();
294
    mRowCount = (numObjects + NUM_COLUMNS-1) / NUM_COLUMNS;
295
    mColCount = NUM_COLUMNS;
296

  
289
    computeRowAndColCounts();
297 290
    RubikActivity act = mWeakAct.get();
298 291
    LayoutInflater inflater = act.getLayoutInflater();
299 292

  
......
314 307
      });
315 308
    }
316 309

  
310
///////////////////////////////////////////////////////////////////////////////////////////////////
311

  
312
  private void computeRowAndColCounts()
313
    {
314
    MainEntryList list = MainEntryList.getInstance();
315
    mNumObjects = list.getNumOfEntries();
316
    mRowCount = (mNumObjects + NUM_COLUMNS-1) / NUM_COLUMNS;
317
    mColCount = NUM_COLUMNS;
318
    }
319

  
317 320
///////////////////////////////////////////////////////////////////////////////////////////////////
318 321

  
319 322
  private void updateNumberOfNewObjects()

Also available in: Unified diff