Project

General

Profile

« Previous | Next » 

Revision 74d088c3

Added by Leszek Koltunski over 2 years ago

Progress with ConfigScreen.

View differences:

src/main/java/org/distorted/config/ConfigScreen.java
52 52
  private TransparentImageButton mBackButton, mObjectButton, mPrevButton, mNextButton;
53 53
  private TextView mMovesText;
54 54
  private PopupWindow mObjectPopup;
55
  private LinearLayout mDetailsLayout, mComplexLayout, mMeshLayout;
55
  private ConfigScreenPane mPane;
56 56
  private int mObjectOrdinal;
57 57
  private int mColCount, mRowCount, mMaxRowCount;
58 58
  private int mObjectSize;
......
117 117
            mObjectOrdinal = ordinal;
118 118
            act.changeObject(type);
119 119
            mMovesText.setText(act.getString(R.string.mo_placeholder,mObjectOrdinal+1,NUM_OBJECTS));
120
            setupInfo(act);
120
            mPane.updatePane(act,mObjectOrdinal);
121 121
            }
122 122

  
123 123
          mObjectPopup.dismiss();
......
242 242
    ObjectType type = ObjectType.getObject(mObjectOrdinal);
243 243
    act.changeObject(type);
244 244

  
245
    setupInfo(act);
245
    mPane.updatePane(act,mObjectOrdinal);
246 246
    }
247 247

  
248 248
///////////////////////////////////////////////////////////////////////////////////////////////////
......
255 255
    ObjectType type = ObjectType.getObject(mObjectOrdinal);
256 256
    act.changeObject(type);
257 257

  
258
    setupInfo(act);
258
    mPane.updatePane(act,mObjectOrdinal);
259 259
    }
260 260

  
261 261
///////////////////////////////////////////////////////////////////////////////////////////////////
......
317 317
    mMovesText.setText(act.getString(R.string.mo_placeholder,mObjectOrdinal+1,NUM_OBJECTS));
318 318
    }
319 319

  
320

  
321
///////////////////////////////////////////////////////////////////////////////////////////////////
322

  
323
  private LinearLayout createLayout(ConfigActivity act, final int marginT, final int marginB, final int marginS, final int color)
324
    {
325
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,200);//LinearLayout.LayoutParams.WRAP_CONTENT);
326
    params.bottomMargin = marginB;
327
    params.topMargin    = marginT;
328
    params.leftMargin   = marginS;
329
    params.rightMargin  = marginS;
330

  
331
    LinearLayout layout = new LinearLayout(act);
332
    layout.setLayoutParams(params);
333
    layout.setBackgroundColor(color);
334

  
335
    return layout;
336
    }
337

  
338 320
///////////////////////////////////////////////////////////////////////////////////////////////////
339 321

  
340
  private void setupDetailsLayout(ConfigActivity act, final float width)
341
    {
342

  
343
    }
344

  
345
///////////////////////////////////////////////////////////////////////////////////////////////////
346

  
347
  private void setupComplexLayout(ConfigActivity act, final float width)
348
    {
349

  
350

  
351
    }
352

  
353
///////////////////////////////////////////////////////////////////////////////////////////////////
354

  
355
  private void setupMeshLayout(ConfigActivity act, final float width)
356
    {
357

  
358

  
359
    }
360

  
361
///////////////////////////////////////////////////////////////////////////////////////////////////
362

  
363
  private void setupInfo(ConfigActivity act)
364
    {
365
    int width = act.getScreenWidthInPixels();
366

  
367
    setupDetailsLayout(act,width);
368
    setupComplexLayout(act,width);
369
    setupMeshLayout(act,width);
370
    }
371

  
372
///////////////////////////////////////////////////////////////////////////////////////////////////
373

  
374
  void enterScreen(final ConfigActivity act, final int objectOrdinal)
322
  void onAttachedToWindow(final ConfigActivity act, final int objectOrdinal)
375 323
    {
376 324
    int width = act.getScreenWidthInPixels();
377 325
    mBarHeight = act.getHeightBar();
......
382 330

  
383 331
    mObjectOrdinal = objectOrdinal;
384 332

  
385
    LinearLayout.LayoutParams paramsL = new LinearLayout.LayoutParams((int)(width/4),LinearLayout.LayoutParams.MATCH_PARENT);
386
    LinearLayout.LayoutParams paramsM = new LinearLayout.LayoutParams((int)(width/2),LinearLayout.LayoutParams.MATCH_PARENT);
387
    LinearLayout.LayoutParams paramsR = new LinearLayout.LayoutParams((int)(width/4),LinearLayout.LayoutParams.MATCH_PARENT);
333
    LinearLayout.LayoutParams paramsL = new LinearLayout.LayoutParams(width/4, LinearLayout.LayoutParams.MATCH_PARENT);
334
    LinearLayout.LayoutParams paramsM = new LinearLayout.LayoutParams(width/2, LinearLayout.LayoutParams.MATCH_PARENT);
335
    LinearLayout.LayoutParams paramsR = new LinearLayout.LayoutParams(width/4, LinearLayout.LayoutParams.MATCH_PARENT);
388 336

  
389 337
    LinearLayout layoutLeft = new LinearLayout(act);
390 338
    layoutLeft.setLayoutParams(paramsL);
......
411 359
    layout.addView(layoutMid);
412 360
    layout.addView(layoutRight);
413 361

  
414
    int color = act.getResources().getColor(R.color.light_grey);
415
    int margin = (int)(1.5f*width*RubikActivity.PADDING);
416

  
417
    mDetailsLayout = createLayout(act,2*margin,  margin, 2*margin, color);
418
    mComplexLayout = createLayout(act,  margin,  margin, 2*margin, color);
419
    mMeshLayout    = createLayout(act,  margin,2*margin, 2*margin, color);
420

  
421
    LinearLayout configLayout = act.findViewById(R.id.configLayout);
422
    configLayout.removeAllViews();
423
    configLayout.addView(mDetailsLayout);
424
    configLayout.addView(mComplexLayout);
425
    configLayout.addView(mMeshLayout);
362
    mPane = new ConfigScreenPane(act,mObjectOrdinal);
426 363
    }
427 364
}

Also available in: Unified diff