Revision 8d1da3f1
Added by Leszek Koltunski almost 4 years ago
| build.gradle | ||
|---|---|---|
| 9 | 9 |
keyAlias = 'distorted' |
| 10 | 10 |
} |
| 11 | 11 |
} |
| 12 |
compileSdkVersion 30
|
|
| 12 |
compileSdkVersion 31
|
|
| 13 | 13 |
|
| 14 | 14 |
defaultConfig {
|
| 15 | 15 |
applicationId "org.distorted.magic" |
| ... | ... | |
| 40 | 40 |
implementation 'com.google.firebase:firebase-analytics:20.0.0' |
| 41 | 41 |
implementation 'com.google.firebase:firebase-crashlytics:18.2.4' |
| 42 | 42 |
implementation 'com.google.android.play:core:1.10.2' |
| 43 |
implementation 'androidx.appcompat:appcompat:1.3.1'
|
|
| 43 |
implementation 'androidx.appcompat:appcompat:1.4.0'
|
|
| 44 | 44 |
implementation 'com.google.android.material:material:1.4.0' |
| 45 | 45 |
implementation project(path: ':distorted-puzzle-jsons') |
| 46 | 46 |
implementation project(path: ':distorted-puzzle-dmesh') |
| src/main/java/org/distorted/helpers/TransparentImageButton.java | ||
|---|---|---|
| 38 | 38 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 39 | 39 |
|
| 40 | 40 |
public TransparentImageButton(Context context, int icon, int gravity, LinearLayout.LayoutParams params) |
| 41 |
{
|
|
| 42 |
super(context); |
|
| 43 |
|
|
| 44 |
setLayoutParams(params); |
|
| 45 |
setPadding(0,0,0,0); |
|
| 46 |
setIconResource(icon); |
|
| 47 |
setIconTint(null); |
|
| 48 |
|
|
| 49 |
switch(gravity) |
|
| 41 | 50 |
{
|
| 42 |
super(context); |
|
| 43 |
|
|
| 44 |
setLayoutParams(params); |
|
| 45 |
setPadding(0,0,0,0); |
|
| 46 |
setIconResource(icon); |
|
| 47 |
setIconTint(null); |
|
| 48 |
|
|
| 49 |
switch(gravity) |
|
| 50 |
{
|
|
| 51 |
case GRAVITY_START : setIconGravity(MaterialButton.ICON_GRAVITY_START ); break; |
|
| 52 |
case GRAVITY_MIDDLE: setIconGravity(MaterialButton.ICON_GRAVITY_TEXT_START); break; |
|
| 53 |
case GRAVITY_END : setIconGravity(MaterialButton.ICON_GRAVITY_END ); break; |
|
| 54 |
} |
|
| 55 |
|
|
| 56 |
TypedValue outValue = new TypedValue(); |
|
| 57 |
context.getTheme().resolveAttribute(android.R.attr.selectableItemBackgroundBorderless, outValue, true); |
|
| 58 |
setBackgroundResource(outValue.resourceId); |
|
| 51 |
case GRAVITY_START : setIconGravity(MaterialButton.ICON_GRAVITY_START ); break; |
|
| 52 |
case GRAVITY_MIDDLE: setIconGravity(MaterialButton.ICON_GRAVITY_TEXT_START); break; |
|
| 53 |
case GRAVITY_END : setIconGravity(MaterialButton.ICON_GRAVITY_END ); break; |
|
| 59 | 54 |
} |
| 55 |
|
|
| 56 |
TypedValue outValue = new TypedValue(); |
|
| 57 |
context.getTheme().resolveAttribute(android.R.attr.selectableItemBackgroundBorderless, outValue, true); |
|
| 58 |
setBackgroundResource(outValue.resourceId); |
|
| 59 |
} |
|
| 60 | 60 |
} |
| 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) |
| src/main/res/layout/dialog_tabbed.xml | ||
|---|---|---|
| 13 | 13 |
android:id="@+id/sliding_tabs" |
| 14 | 14 |
android:layout_width="wrap_content" |
| 15 | 15 |
android:layout_height="wrap_content" |
| 16 |
android:theme="@style/Theme.AppCompat.NoActionBar"
|
|
| 16 |
app:tabBackground="@drawable/tab_background"
|
|
| 17 | 17 |
app:tabMode="scrollable" |
| 18 |
app:tabMinWidth="20dp" |
|
| 19 |
app:tabGravity="fill" |
|
| 20 |
> |
|
| 18 |
app:tabMinWidth="25dp" |
|
| 19 |
app:tabGravity="fill"> |
|
| 21 | 20 |
</com.google.android.material.tabs.TabLayout> |
| 22 | 21 |
|
| 23 | 22 |
<androidx.viewpager.widget.ViewPager |
| src/main/res/layout/popup_object.xml | ||
|---|---|---|
| 7 | 7 |
<ScrollView |
| 8 | 8 |
android:id="@+id/objectScroll" |
| 9 | 9 |
android:layout_width="match_parent" |
| 10 |
android:layout_height="match_parent"
|
|
| 10 |
android:layout_height="0dp"
|
|
| 11 | 11 |
android:layout_weight="1"> |
| 12 | 12 |
|
| 13 | 13 |
<GridLayout |
| ... | ... | |
| 22 | 22 |
android:id="@+id/bottomLayout" |
| 23 | 23 |
android:background="@color/grey" |
| 24 | 24 |
android:layout_width="match_parent" |
| 25 |
android:layout_height="100dp" |
|
| 26 |
android:layout_weight="1" |
|
| 25 |
android:layout_height="wrap_content" |
|
| 27 | 26 |
android:paddingEnd="5dp" |
| 28 | 27 |
android:paddingStart="5dp" |
| 29 | 28 |
android:orientation="horizontal"> |
| 30 | 29 |
|
| 30 |
<ImageButton |
|
| 31 |
android:id="@+id/buttonTut" |
|
| 32 |
android:layout_width="wrap_content" |
|
| 33 |
android:layout_height="wrap_content" |
|
| 34 |
android:layout_weight="1.0"/> |
|
| 35 |
|
|
| 36 |
<Button |
|
| 37 |
android:id="@+id/buttonNul" |
|
| 38 |
android:layout_width="wrap_content" |
|
| 39 |
android:layout_height="wrap_content" |
|
| 40 |
android:layout_weight="1.0"/> |
|
| 41 |
|
|
| 42 |
<ImageButton |
|
| 43 |
android:id="@+id/buttonDet" |
|
| 44 |
android:layout_width="wrap_content" |
|
| 45 |
android:layout_height="wrap_content" |
|
| 46 |
android:layout_weight="1.0"/> |
|
| 47 |
|
|
| 31 | 48 |
</LinearLayout> |
| 32 | 49 |
|
| 33 | 50 |
</LinearLayout> |
Also available in: Unified diff
progress with UI.