Revision 8d1da3f1
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/screens/RubikScreenPlay.java | ||
---|---|---|
245 | 245 |
int margin = (int)(width*RubikActivity.LARGE_MARGIN); |
246 | 246 |
mObjectSize = (int)(cubeWidth + 2*margin + 0.5f); |
247 | 247 |
mMaxRowCount = (int)((height-1.8f*mUpperBarHeight)/mObjectSize); |
248 |
int layoutH = (int)(1.5f*mObjectSize); |
|
249 |
int viewID = R.layout.popup_object; |
|
250 | 248 |
|
251 |
LinearLayout view = (LinearLayout)inflate( act, viewID, null);
|
|
249 |
LinearLayout view = (LinearLayout)inflate( act, R.layout.popup_object, null);
|
|
252 | 250 |
GridLayout objectGrid = view.findViewById(R.id.objectGrid); |
253 | 251 |
|
254 | 252 |
GridLayout.Spec[] rowSpecs = new GridLayout.Spec[mRowCount]; |
... | ... | |
258 | 256 |
objectGrid.setRowCount(mRowCount); |
259 | 257 |
|
260 | 258 |
LinearLayout bottomLayout = view.findViewById(R.id.bottomLayout); |
261 |
setupBottomLayout(act,bottomLayout,layoutH); |
|
262 |
|
|
263 |
ViewGroup.LayoutParams paramsB = bottomLayout.getLayoutParams(); |
|
264 |
paramsB.height = layoutH; |
|
265 |
bottomLayout.setLayoutParams(paramsB); |
|
259 |
setupBottomLayout(act,bottomLayout,2*mObjectSize,mObjectSize); |
|
266 | 260 |
|
267 | 261 |
mObjectPopup = new PopupWindow(act); |
268 | 262 |
mObjectPopup.setFocusable(true); |
... | ... | |
318 | 312 |
} |
319 | 313 |
} |
320 | 314 |
|
315 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
316 |
|
|
317 |
private void setupBottomLayout(final RubikActivity act, final LinearLayout layout, int width, int height) |
|
318 |
{ |
|
319 |
int iconD = RubikActivity.getDrawable(R.drawable.ui_small_info,R.drawable.ui_medium_info, R.drawable.ui_big_info, R.drawable.ui_huge_info); |
|
320 |
int iconT = RubikActivity.getDrawable(R.drawable.ui_small_tutorial,R.drawable.ui_medium_tutorial, R.drawable.ui_big_tutorial, R.drawable.ui_huge_tutorial); |
|
321 |
|
|
322 |
ImageButton buttonTut = layout.findViewById(R.id.buttonTut); |
|
323 |
Button buttonNul = layout.findViewById(R.id.buttonNul); |
|
324 |
ImageButton buttonDet = layout.findViewById(R.id.buttonDet); |
|
325 |
|
|
326 |
buttonTut.setImageResource(iconT); |
|
327 |
buttonDet.setImageResource(iconD); |
|
328 |
buttonNul.setVisibility(View.INVISIBLE); |
|
329 |
|
|
330 |
buttonNul.setWidth(width); |
|
331 |
|
|
332 |
TypedValue outValue = new TypedValue(); |
|
333 |
act.getTheme().resolveAttribute(android.R.attr.selectableItemBackgroundBorderless, outValue, true); |
|
334 |
buttonTut.setBackgroundResource(outValue.resourceId); |
|
335 |
buttonDet.setBackgroundResource(outValue.resourceId); |
|
336 |
|
|
337 |
buttonTut.setOnClickListener( new View.OnClickListener() |
|
338 |
{ |
|
339 |
@Override |
|
340 |
public void onClick(View v) |
|
341 |
{ |
|
342 |
if( mObjectPopup!=null ) mObjectPopup.dismiss(); |
|
343 |
RubikDialogTutorial tDiag = new RubikDialogTutorial(); |
|
344 |
tDiag.show( act.getSupportFragmentManager(), RubikDialogTutorial.getDialogTag() ); |
|
345 |
} |
|
346 |
}); |
|
347 |
|
|
348 |
buttonDet.setOnClickListener( new View.OnClickListener() |
|
349 |
{ |
|
350 |
@Override |
|
351 |
public void onClick(View v) |
|
352 |
{ |
|
353 |
android.util.Log.e("D", "BUTTON DET CLICKED!!"); |
|
354 |
} |
|
355 |
}); |
|
356 |
} |
|
357 |
|
|
321 | 358 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
322 | 359 |
|
323 | 360 |
private void setupMenuWindow(final RubikActivity act, final float width) |
... | ... | |
403 | 440 |
} |
404 | 441 |
} |
405 | 442 |
|
406 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
407 |
|
|
408 |
void setupBottomLayout(final RubikActivity act, final LinearLayout layout, int width) |
|
409 |
{ |
|
410 |
int iconT = RubikActivity.getDrawable(R.drawable.ui_small_tutorial,R.drawable.ui_medium_tutorial, R.drawable.ui_big_tutorial, R.drawable.ui_huge_tutorial); |
|
411 |
LinearLayout.LayoutParams paramsT = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
|
412 |
TransparentImageButton buttonTut = new TransparentImageButton(act, iconT, TransparentImageButton.GRAVITY_MIDDLE, paramsT); |
|
413 |
|
|
414 |
int iconD = RubikActivity.getDrawable(R.drawable.ui_small_info,R.drawable.ui_medium_info, R.drawable.ui_big_info, R.drawable.ui_huge_info); |
|
415 |
LinearLayout.LayoutParams paramsD = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
|
416 |
TransparentImageButton buttonDet = new TransparentImageButton(act, iconD, TransparentImageButton.GRAVITY_MIDDLE, paramsD); |
|
417 |
|
|
418 |
buttonTut.setOnClickListener( new View.OnClickListener() |
|
419 |
{ |
|
420 |
@Override |
|
421 |
public void onClick(View v) |
|
422 |
{ |
|
423 |
if( mObjectPopup!=null ) mObjectPopup.dismiss(); |
|
424 |
RubikDialogTutorial tDiag = new RubikDialogTutorial(); |
|
425 |
tDiag.show( act.getSupportFragmentManager(), RubikDialogTutorial.getDialogTag() ); |
|
426 |
} |
|
427 |
}); |
|
428 |
|
|
429 |
buttonDet.setOnClickListener( new View.OnClickListener() |
|
430 |
{ |
|
431 |
@Override |
|
432 |
public void onClick(View v) |
|
433 |
{ |
|
434 |
android.util.Log.e("D", "BUTTON DET CLICKED!!"); |
|
435 |
} |
|
436 |
}); |
|
437 |
|
|
438 |
LinearLayout.LayoutParams paramsNul = new LinearLayout.LayoutParams(width,LinearLayout.LayoutParams.MATCH_PARENT,2.0f); |
|
439 |
Button buttonNul = new Button(act); |
|
440 |
buttonNul.setLayoutParams(paramsNul); |
|
441 |
buttonNul.setVisibility(View.INVISIBLE); |
|
442 |
|
|
443 |
layout.addView(buttonTut); |
|
444 |
layout.addView(buttonNul); |
|
445 |
layout.addView(buttonDet); |
|
446 |
} |
|
447 |
|
|
448 | 443 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
449 | 444 |
|
450 | 445 |
void setupSolveButton(final RubikActivity act) |
Also available in: Unified diff
progress with UI.