Revision 464ade4a
Added by Leszek Koltunski about 2 years ago
| build.gradle | ||
|---|---|---|
| 56 | 56 |
implementation ('com.google.android.play:core:1.10.3')
|
| 57 | 57 |
implementation ('androidx.appcompat:appcompat:1.6.1')
|
| 58 | 58 |
implementation ('androidx.work:work-runtime:2.8.1')
|
| 59 |
implementation ('com.google.android.material:material:1.9.0')
|
|
| 59 |
implementation ('com.google.android.material:material:1.10.0')
|
|
| 60 | 60 |
//implementation "com.android.billingclient:billing:5.1.0" |
| 61 | 61 |
implementation project(path: ':distorted-component-jsons') |
| 62 | 62 |
implementation project(path: ':distorted-component-dmesh') |
| src/main/java/org/distorted/bandaged/BandagedCreatorActivity.java | ||
|---|---|---|
| 346 | 346 |
{
|
| 347 | 347 |
return mObjectOrdinal; |
| 348 | 348 |
} |
| 349 |
|
|
| 350 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 351 |
|
|
| 352 |
public static int getDrawableSize() |
|
| 353 |
{
|
|
| 354 |
if( mScreenHeight<1000 ) return 0; |
|
| 355 |
if( mScreenHeight<1600 ) return 1; |
|
| 356 |
if( mScreenHeight<1900 ) return 2; |
|
| 357 |
return 3; |
|
| 358 |
} |
|
| 359 |
|
|
| 360 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 361 |
|
|
| 362 |
public static int getDrawable(int small, int medium, int big, int huge) |
|
| 363 |
{
|
|
| 364 |
int size = getDrawableSize(); |
|
| 365 |
|
|
| 366 |
switch(size) |
|
| 367 |
{
|
|
| 368 |
case 0 : return small; |
|
| 369 |
case 1 : return medium; |
|
| 370 |
case 2 : return big; |
|
| 371 |
default: return huge; |
|
| 372 |
} |
|
| 373 |
} |
|
| 374 | 349 |
} |
| src/main/java/org/distorted/bandaged/BandagedCreatorObjectView.java | ||
|---|---|---|
| 52 | 52 |
|
| 53 | 53 |
final int icon = R.drawable.ui_trash; |
| 54 | 54 |
LinearLayout.LayoutParams paramsB = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,3.0f); |
| 55 |
TransparentImageButton delButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, paramsB); |
|
| 56 |
|
|
| 57 |
int iconHeight = (int)(RATIO_ICON*(BandagedCreatorActivity.RATIO_SCROLL-2*RubikActivity.PADDING)*height); |
|
| 58 |
delButton.setIconSize(iconHeight); |
|
| 55 |
TransparentImageButton delButton = new TransparentImageButton(act,icon,paramsB); |
|
| 59 | 56 |
|
| 60 | 57 |
bottom.addView(plaButton); |
| 61 | 58 |
bottom.addView(delButton); |
| src/main/java/org/distorted/bandaged/BandagedCreatorScreen.java | ||
|---|---|---|
| 66 | 66 |
|
| 67 | 67 |
private void setupBackButton(final BandagedCreatorActivity act) |
| 68 | 68 |
{
|
| 69 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_smallback,R.drawable.ui_medium_smallback, R.drawable.ui_big_smallback, R.drawable.ui_huge_smallback); |
|
| 70 | 69 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT); |
| 71 |
mBackButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 70 |
mBackButton = new TransparentImageButton(act,R.drawable.ui_huge_smallback,params);
|
|
| 72 | 71 |
|
| 73 | 72 |
mBackButton.setOnClickListener( new View.OnClickListener() |
| 74 | 73 |
{
|
| ... | ... | |
| 84 | 83 |
|
| 85 | 84 |
private void setupDoneButton(final BandagedCreatorActivity act) |
| 86 | 85 |
{
|
| 87 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_done,R.drawable.ui_medium_done, R.drawable.ui_big_done, R.drawable.ui_huge_done); |
|
| 88 | 86 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT); |
| 89 |
mDoneButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 87 |
mDoneButton = new TransparentImageButton(act,R.drawable.ui_huge_done,params);
|
|
| 90 | 88 |
|
| 91 | 89 |
mDoneButton.setOnClickListener( new View.OnClickListener() |
| 92 | 90 |
{
|
| ... | ... | |
| 103 | 101 |
|
| 104 | 102 |
private void setupResetButton(final BandagedCreatorActivity act) |
| 105 | 103 |
{
|
| 106 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_reset,R.drawable.ui_medium_reset, R.drawable.ui_big_reset, R.drawable.ui_huge_reset); |
|
| 107 | 104 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT); |
| 108 |
mResetButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 105 |
mResetButton = new TransparentImageButton(act,R.drawable.ui_huge_reset,params);
|
|
| 109 | 106 |
|
| 110 | 107 |
mResetButton.setOnClickListener( new View.OnClickListener() |
| 111 | 108 |
{
|
| src/main/java/org/distorted/bandaged/BandagedPlayActivity.java | ||
|---|---|---|
| 278 | 278 |
return mScreen; |
| 279 | 279 |
} |
| 280 | 280 |
|
| 281 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 282 |
|
|
| 283 |
public static int getDrawableSize() |
|
| 284 |
{
|
|
| 285 |
if( mScreenHeight<1000 ) return 0; |
|
| 286 |
if( mScreenHeight<1600 ) return 1; |
|
| 287 |
if( mScreenHeight<1900 ) return 2; |
|
| 288 |
return 3; |
|
| 289 |
} |
|
| 290 |
|
|
| 291 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 292 |
|
|
| 293 |
public static int getDrawable(int small, int medium, int big, int huge) |
|
| 294 |
{
|
|
| 295 |
int size = getDrawableSize(); |
|
| 296 |
|
|
| 297 |
switch(size) |
|
| 298 |
{
|
|
| 299 |
case 0 : return small; |
|
| 300 |
case 1 : return medium; |
|
| 301 |
case 2 : return big; |
|
| 302 |
default: return huge; |
|
| 303 |
} |
|
| 304 |
} |
|
| 305 |
|
|
| 306 | 281 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 307 | 282 |
|
| 308 | 283 |
public boolean isVertical() |
| src/main/java/org/distorted/bandaged/BandagedPlayScreen.java | ||
|---|---|---|
| 45 | 45 |
|
| 46 | 46 |
private void setupBackButton(final BandagedPlayActivity act) |
| 47 | 47 |
{
|
| 48 |
int icon = BandagedPlayActivity.getDrawable(R.drawable.ui_small_smallback,R.drawable.ui_medium_smallback, R.drawable.ui_big_smallback, R.drawable.ui_huge_smallback); |
|
| 49 | 48 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT); |
| 50 |
mBackButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 49 |
mBackButton = new TransparentImageButton(act,R.drawable.ui_huge_smallback,params);
|
|
| 51 | 50 |
|
| 52 | 51 |
mBackButton.setOnClickListener( new View.OnClickListener() |
| 53 | 52 |
{
|
| ... | ... | |
| 63 | 62 |
|
| 64 | 63 |
private void setupSolveButton(final BandagedPlayActivity act) |
| 65 | 64 |
{
|
| 66 |
int icon = BandagedPlayActivity.getDrawable(R.drawable.ui_small_cube_solve,R.drawable.ui_medium_cube_solve, R.drawable.ui_big_cube_solve, R.drawable.ui_huge_cube_solve); |
|
| 67 | 65 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 68 |
mSolveButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE,params);
|
|
| 66 |
mSolveButton = new TransparentImageButton(act,R.drawable.ui_huge_cube_solve,params);
|
|
| 69 | 67 |
|
| 70 | 68 |
mSolveButton.setOnClickListener( new View.OnClickListener() |
| 71 | 69 |
{
|
| ... | ... | |
| 83 | 81 |
|
| 84 | 82 |
private void setupScrambleButton(final BandagedPlayActivity act) |
| 85 | 83 |
{
|
| 86 |
int icon = BandagedPlayActivity.getDrawable(R.drawable.ui_small_cube_scramble,R.drawable.ui_medium_cube_scramble, R.drawable.ui_big_cube_scramble, R.drawable.ui_huge_cube_scramble); |
|
| 87 | 84 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 88 |
mScrambleButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 85 |
mScrambleButton = new TransparentImageButton(act,R.drawable.ui_huge_cube_scramble,params);
|
|
| 89 | 86 |
|
| 90 | 87 |
mScrambleButton.setOnClickListener( new View.OnClickListener() |
| 91 | 88 |
{
|
| src/main/java/org/distorted/config/ConfigActivity.java | ||
|---|---|---|
| 261 | 261 |
return view.getObjectControl(); |
| 262 | 262 |
} |
| 263 | 263 |
|
| 264 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 265 |
|
|
| 266 |
public static int getDrawableSize() |
|
| 267 |
{
|
|
| 268 |
if( mScreenHeight<1000 ) |
|
| 269 |
{
|
|
| 270 |
return 0; |
|
| 271 |
} |
|
| 272 |
if( mScreenHeight<1600 ) |
|
| 273 |
{
|
|
| 274 |
return 1; |
|
| 275 |
} |
|
| 276 |
if( mScreenHeight<1900 ) |
|
| 277 |
{
|
|
| 278 |
return 2; |
|
| 279 |
} |
|
| 280 |
|
|
| 281 |
return 3; |
|
| 282 |
} |
|
| 283 |
|
|
| 284 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 285 |
|
|
| 286 |
public static int getDrawable(int small, int medium, int big, int huge) |
|
| 287 |
{
|
|
| 288 |
int size = getDrawableSize(); |
|
| 289 |
|
|
| 290 |
switch(size) |
|
| 291 |
{
|
|
| 292 |
case 0 : return small; |
|
| 293 |
case 1 : return medium; |
|
| 294 |
case 2 : return big; |
|
| 295 |
default: return huge; |
|
| 296 |
} |
|
| 297 |
} |
|
| 298 |
|
|
| 299 | 264 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 300 | 265 |
|
| 301 | 266 |
public boolean isVertical() |
| src/main/java/org/distorted/config/ConfigScreen.java | ||
|---|---|---|
| 103 | 103 |
|
| 104 | 104 |
private void setupBackButton(final ConfigActivity act) |
| 105 | 105 |
{
|
| 106 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_smallback,R.drawable.ui_medium_smallback, R.drawable.ui_big_smallback, R.drawable.ui_huge_smallback); |
|
| 107 | 106 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT); |
| 108 |
mBackButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 107 |
mBackButton = new TransparentImageButton(act,R.drawable.ui_huge_smallback,params);
|
|
| 109 | 108 |
|
| 110 | 109 |
mBackButton.setOnClickListener( new View.OnClickListener() |
| 111 | 110 |
{
|
| ... | ... | |
| 122 | 121 |
private void setupObjectButton(final ConfigActivity act, final int width, final int height) |
| 123 | 122 |
{
|
| 124 | 123 |
final int margin= (int)(height*MARGIN); |
| 125 |
final int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_menu,R.drawable.ui_medium_cube_menu, R.drawable.ui_big_cube_menu, R.drawable.ui_huge_cube_menu); |
|
| 126 | 124 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT); |
| 127 |
mObjectButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 125 |
mObjectButton = new TransparentImageButton(act,R.drawable.ui_huge_cube_menu,params);
|
|
| 128 | 126 |
|
| 129 | 127 |
mObjectButton.setOnClickListener( new View.OnClickListener() |
| 130 | 128 |
{
|
| ... | ... | |
| 215 | 213 |
|
| 216 | 214 |
private void setupPrevButton(final ConfigActivity act) |
| 217 | 215 |
{
|
| 218 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_left,R.drawable.ui_medium_left, R.drawable.ui_big_left, R.drawable.ui_huge_left); |
|
| 219 | 216 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 220 |
mPrevButton = new TransparentImageButton(act,icon,TransparentImageButton.GRAVITY_MIDDLE,params);
|
|
| 217 |
mPrevButton = new TransparentImageButton(act,R.drawable.ui_huge_left,params);
|
|
| 221 | 218 |
|
| 222 | 219 |
mPrevButton.setOnClickListener( new View.OnClickListener() |
| 223 | 220 |
{
|
| ... | ... | |
| 235 | 232 |
|
| 236 | 233 |
private void setupNextButton(final ConfigActivity act) |
| 237 | 234 |
{
|
| 238 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_right,R.drawable.ui_medium_right, R.drawable.ui_big_right, R.drawable.ui_huge_right); |
|
| 239 | 235 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 240 |
mNextButton = new TransparentImageButton(act,icon,TransparentImageButton.GRAVITY_MIDDLE,params);
|
|
| 236 |
mNextButton = new TransparentImageButton(act,R.drawable.ui_huge_right,params);
|
|
| 241 | 237 |
|
| 242 | 238 |
mNextButton.setOnClickListener( new View.OnClickListener() |
| 243 | 239 |
{
|
| src/main/java/org/distorted/helpers/LockController.java | ||
|---|---|---|
| 17 | 17 |
import android.widget.LinearLayout; |
| 18 | 18 |
|
| 19 | 19 |
import org.distorted.main.R; |
| 20 |
import org.distorted.main.RubikActivity; |
|
| 21 | 20 |
import org.distorted.objectlib.main.ObjectControl; |
| 22 | 21 |
|
| 23 | 22 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 46 | 45 |
{
|
| 47 | 46 |
control.toggleLock(); |
| 48 | 47 |
boolean locked = control.retLocked(); |
| 49 |
mLockButton.setIconResource(getLockIcon(locked,false));
|
|
| 48 |
mLockButton.setImageResource(getLockIcon(locked,false));
|
|
| 50 | 49 |
} |
| 51 | 50 |
|
| 52 | 51 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 53 | 52 |
|
| 54 | 53 |
private int getLockIcon(boolean locked, boolean red) |
| 55 | 54 |
{
|
| 56 |
if( locked ) |
|
| 57 |
{
|
|
| 58 |
if( red ) |
|
| 59 |
{
|
|
| 60 |
return RubikActivity.getDrawable(R.drawable.ui_small_locked_red, |
|
| 61 |
R.drawable.ui_medium_locked_red, |
|
| 62 |
R.drawable.ui_big_locked_red, |
|
| 63 |
R.drawable.ui_huge_locked_red); |
|
| 64 |
} |
|
| 65 |
else |
|
| 66 |
{
|
|
| 67 |
return RubikActivity.getDrawable(R.drawable.ui_small_locked, |
|
| 68 |
R.drawable.ui_medium_locked, |
|
| 69 |
R.drawable.ui_big_locked, |
|
| 70 |
R.drawable.ui_huge_locked); |
|
| 71 |
} |
|
| 72 |
} |
|
| 73 |
else |
|
| 74 |
{
|
|
| 75 |
return RubikActivity.getDrawable(R.drawable.ui_small_unlocked, |
|
| 76 |
R.drawable.ui_medium_unlocked, |
|
| 77 |
R.drawable.ui_big_unlocked, |
|
| 78 |
R.drawable.ui_huge_unlocked); |
|
| 79 |
} |
|
| 55 |
return locked ? (red? R.drawable.ui_huge_locked_red : R.drawable.ui_huge_locked) : R.drawable.ui_huge_unlocked; |
|
| 80 | 56 |
} |
| 81 | 57 |
|
| 82 | 58 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 89 | 65 |
public void run() |
| 90 | 66 |
{
|
| 91 | 67 |
if( mLockButton!=null ) |
| 92 |
mLockButton.setIconResource(getLockIcon(locked,red));
|
|
| 68 |
mLockButton.setImageResource(getLockIcon(locked,red));
|
|
| 93 | 69 |
} |
| 94 | 70 |
}); |
| 95 | 71 |
} |
| ... | ... | |
| 145 | 121 |
boolean locked = control.retLocked(); |
| 146 | 122 |
final int icon = getLockIcon(locked,false); |
| 147 | 123 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 148 |
mLockButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 124 |
mLockButton = new TransparentImageButton(act,icon,params);
|
|
| 149 | 125 |
|
| 150 | 126 |
mLockButton.setOnClickListener( new View.OnClickListener() |
| 151 | 127 |
{
|
| ... | ... | |
| 167 | 143 |
public void run() |
| 168 | 144 |
{
|
| 169 | 145 |
if( mLockButton!=null ) |
| 170 |
mLockButton.setIconResource(getLockIcon(locked,false));
|
|
| 146 |
mLockButton.setImageResource(getLockIcon(locked,false));
|
|
| 171 | 147 |
} |
| 172 | 148 |
}); |
| 173 | 149 |
} |
| src/main/java/org/distorted/helpers/MovesController.java | ||
|---|---|---|
| 20 | 20 |
import org.distorted.objectlib.main.ObjectControl; |
| 21 | 21 |
|
| 22 | 22 |
import org.distorted.main.R; |
| 23 |
import org.distorted.main.RubikActivity; |
|
| 24 | 23 |
|
| 25 | 24 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 26 | 25 |
|
| ... | ... | |
| 59 | 58 |
|
| 60 | 59 |
private int getPrevIcon(boolean on) |
| 61 | 60 |
{
|
| 62 |
if( on ) |
|
| 63 |
{
|
|
| 64 |
return RubikActivity.getDrawable(R.drawable.ui_small_cube_back, |
|
| 65 |
R.drawable.ui_medium_cube_back, |
|
| 66 |
R.drawable.ui_big_cube_back, |
|
| 67 |
R.drawable.ui_huge_cube_back); |
|
| 68 |
} |
|
| 69 |
else |
|
| 70 |
{
|
|
| 71 |
return RubikActivity.getDrawable(R.drawable.ui_small_cube_grey, |
|
| 72 |
R.drawable.ui_medium_cube_grey, |
|
| 73 |
R.drawable.ui_big_cube_grey, |
|
| 74 |
R.drawable.ui_huge_cube_grey); |
|
| 75 |
} |
|
| 61 |
return on ? R.drawable.ui_huge_cube_back : R.drawable.ui_huge_cube_grey; |
|
| 76 | 62 |
} |
| 77 | 63 |
|
| 78 | 64 |
////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 116 | 102 |
public void run() |
| 117 | 103 |
{
|
| 118 | 104 |
if( mPrevButton!=null ) |
| 119 |
mPrevButton.setIconResource(getPrevIcon(on));
|
|
| 105 |
mPrevButton.setImageResource(getPrevIcon(on));
|
|
| 120 | 106 |
} |
| 121 | 107 |
}); |
| 122 | 108 |
} |
| ... | ... | |
| 158 | 144 |
{
|
| 159 | 145 |
final int icon = getPrevIcon( !mMoves.isEmpty() ); |
| 160 | 146 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 161 |
mPrevButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 147 |
mPrevButton = new TransparentImageButton(act,icon,params);
|
|
| 162 | 148 |
|
| 163 | 149 |
mPrevButton.setOnClickListener( new View.OnClickListener() |
| 164 | 150 |
{
|
| src/main/java/org/distorted/helpers/TransparentImageButton.java | ||
|---|---|---|
| 14 | 14 |
import android.util.TypedValue; |
| 15 | 15 |
import android.widget.LinearLayout; |
| 16 | 16 |
|
| 17 |
import com.google.android.material.button.MaterialButton;
|
|
| 17 |
import androidx.appcompat.widget.AppCompatImageButton;
|
|
| 18 | 18 |
|
| 19 | 19 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 20 | 20 |
|
| 21 | 21 |
@SuppressLint("ViewConstructor")
|
| 22 |
public class TransparentImageButton extends MaterialButton
|
|
| 22 |
public class TransparentImageButton extends AppCompatImageButton
|
|
| 23 | 23 |
{
|
| 24 |
public static final int GRAVITY_START = 0; |
|
| 25 |
public static final int GRAVITY_MIDDLE = 1; |
|
| 26 |
public static final int GRAVITY_END = 2; |
|
| 27 |
|
|
| 28 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 29 |
|
|
| 30 |
public TransparentImageButton(Context context, int icon, int gravity, LinearLayout.LayoutParams params) |
|
| 24 |
public TransparentImageButton(Context context, int icon, LinearLayout.LayoutParams params) |
|
| 31 | 25 |
{
|
| 32 | 26 |
super(context); |
| 33 | 27 |
|
| 34 | 28 |
setLayoutParams(params); |
| 35 | 29 |
setPadding(0,0,0,0); |
| 36 |
setIconResource(icon); |
|
| 37 |
setIconTint(null); |
|
| 38 |
|
|
| 39 |
switch(gravity) |
|
| 40 |
{
|
|
| 41 |
case GRAVITY_START : setIconGravity(MaterialButton.ICON_GRAVITY_START ); break; |
|
| 42 |
case GRAVITY_MIDDLE: setIconGravity(MaterialButton.ICON_GRAVITY_TEXT_START); break; |
|
| 43 |
case GRAVITY_END : setIconGravity(MaterialButton.ICON_GRAVITY_END ); break; |
|
| 44 |
} |
|
| 30 |
setImageResource(icon); |
|
| 31 |
setScaleType(ScaleType.FIT_CENTER); |
|
| 45 | 32 |
|
| 46 | 33 |
TypedValue outValue = new TypedValue(); |
| 47 | 34 |
context.getTheme().resolveAttribute(android.R.attr.selectableItemBackgroundBorderless, outValue, true); |
| src/main/java/org/distorted/main/RubikActivity.java | ||
|---|---|---|
| 68 | 68 |
public static final boolean SHOW_IAP_DEBUG = true; |
| 69 | 69 |
public static final boolean USE_IAP = false; |
| 70 | 70 |
|
| 71 |
public static final float PADDING = 0.01f; |
|
| 71 |
public static final float PADDING = 0.010f;
|
|
| 72 | 72 |
public static final float SMALL_MARGIN = 0.004f; |
| 73 |
public static final float BUTTON_TEXT_SIZE = 0.05f; |
|
| 74 |
public static final float TITLE_TEXT_SIZE = 0.06f; |
|
| 75 |
public static final float PATTERN_GROUP_TEXT = 0.03f; |
|
| 76 |
public static final float PATTERN_CHILD_TEXT = 0.02f; |
|
| 73 |
public static final float BUTTON_TEXT_SIZE = 0.050f;
|
|
| 74 |
public static final float TITLE_TEXT_SIZE = 0.060f;
|
|
| 75 |
public static final float PATTERN_GROUP_TEXT = 0.030f;
|
|
| 76 |
public static final float PATTERN_CHILD_TEXT = 0.020f;
|
|
| 77 | 77 |
public static final float SCORES_LEVEL_TEXT = 0.035f; |
| 78 | 78 |
public static final float SCORES_ITEM_TEXT = 0.025f; |
| 79 | 79 |
public static final float TAB_WIDTH = 0.066f; |
| 80 | 80 |
public static final float TAB_HEIGHT = 0.066f; |
| 81 | 81 |
public static final float POPUP_PADDING = 0.028f; |
| 82 | 82 |
public static final float POPUP_MARGIN = 0.016f; |
| 83 |
public static final float RATIO_BAR = 0.10f; |
|
| 83 |
public static final float POPUP_BOTTOM = 0.090f; |
|
| 84 |
public static final float BUTT_PAD = 0.020f; |
|
| 85 |
public static final float RATIO_BAR = 0.100f; |
|
| 84 | 86 |
|
| 85 | 87 |
public static final int FLAGS = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
| 86 | 88 |
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
| ... | ... | |
| 616 | 618 |
control.changeIfDifferent(ordinal,name,meshState,iconMode,asset); |
| 617 | 619 |
} |
| 618 | 620 |
|
| 619 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 620 |
|
|
| 621 |
public static int getDrawableSize() |
|
| 622 |
{
|
|
| 623 |
if( mScreenHeight<1000 ) return 0; |
|
| 624 |
if( mScreenHeight<1600 ) return 1; |
|
| 625 |
if( mScreenHeight<1900 ) return 2; |
|
| 626 |
return 3; |
|
| 627 |
} |
|
| 628 |
|
|
| 629 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 630 |
|
|
| 631 |
public static int getDrawable(int small, int medium, int big, int huge) |
|
| 632 |
{
|
|
| 633 |
int size = getDrawableSize(); |
|
| 634 |
|
|
| 635 |
switch(size) |
|
| 636 |
{
|
|
| 637 |
case 0 : return small; |
|
| 638 |
case 1 : return medium; |
|
| 639 |
case 2 : return big; |
|
| 640 |
default: return huge; |
|
| 641 |
} |
|
| 642 |
} |
|
| 643 |
|
|
| 644 | 621 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 645 | 622 |
|
| 646 | 623 |
public void acceptPrivacy() |
| src/main/java/org/distorted/purchase/PurchaseActivity.java | ||
|---|---|---|
| 277 | 277 |
mScreen.blockUI(); |
| 278 | 278 |
} |
| 279 | 279 |
|
| 280 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 281 |
|
|
| 282 |
public static int getDrawableSize() |
|
| 283 |
{
|
|
| 284 |
if( mScreenHeight<1000 ) return 0; |
|
| 285 |
if( mScreenHeight<1600 ) return 1; |
|
| 286 |
if( mScreenHeight<1900 ) return 2; |
|
| 287 |
return 3; |
|
| 288 |
} |
|
| 289 |
|
|
| 290 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 291 |
|
|
| 292 |
public static int getDrawable(int small, int medium, int big, int huge) |
|
| 293 |
{
|
|
| 294 |
int size = getDrawableSize(); |
|
| 295 |
|
|
| 296 |
switch(size) |
|
| 297 |
{
|
|
| 298 |
case 0 : return small; |
|
| 299 |
case 1 : return medium; |
|
| 300 |
case 2 : return big; |
|
| 301 |
default: return huge; |
|
| 302 |
} |
|
| 303 |
} |
|
| 304 |
|
|
| 305 | 280 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 306 | 281 |
|
| 307 | 282 |
int getObjectPrice() |
| src/main/java/org/distorted/purchase/PurchaseScreen.java | ||
|---|---|---|
| 14 | 14 |
|
| 15 | 15 |
import org.distorted.helpers.TransparentImageButton; |
| 16 | 16 |
import org.distorted.main.R; |
| 17 |
import org.distorted.main.RubikActivity; |
|
| 18 | 17 |
|
| 19 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 20 | 19 |
|
| ... | ... | |
| 34 | 33 |
|
| 35 | 34 |
private void setupBackButton(final PurchaseActivity act) |
| 36 | 35 |
{
|
| 37 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_smallback,R.drawable.ui_medium_smallback, R.drawable.ui_big_smallback, R.drawable.ui_huge_smallback); |
|
| 38 | 36 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT); |
| 39 |
mBackButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 37 |
mBackButton = new TransparentImageButton(act,R.drawable.ui_huge_smallback,params);
|
|
| 40 | 38 |
|
| 41 | 39 |
mBackButton.setOnClickListener( new View.OnClickListener() |
| 42 | 40 |
{
|
| src/main/java/org/distorted/screens/RubikScreenDone.java | ||
|---|---|---|
| 76 | 76 |
|
| 77 | 77 |
private void setupBackButton(final RubikActivity act) |
| 78 | 78 |
{
|
| 79 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_back,R.drawable.ui_medium_back, R.drawable.ui_big_back, R.drawable.ui_huge_back); |
|
| 80 | 79 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 81 |
mBackButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 80 |
mBackButton = new TransparentImageButton(act,R.drawable.ui_huge_back,params);
|
|
| 82 | 81 |
|
| 83 | 82 |
mBackButton.setOnClickListener( new View.OnClickListener() |
| 84 | 83 |
{
|
| src/main/java/org/distorted/screens/RubikScreenPattern.java | ||
|---|---|---|
| 132 | 132 |
|
| 133 | 133 |
private void setupBackButton(final RubikActivity act) |
| 134 | 134 |
{
|
| 135 |
final int icon = RubikActivity.getDrawable(R.drawable.ui_small_back,R.drawable.ui_medium_back, R.drawable.ui_big_back, R.drawable.ui_huge_back); |
|
| 136 | 135 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 137 |
mBackButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 136 |
mBackButton = new TransparentImageButton(act,R.drawable.ui_huge_back,params);
|
|
| 138 | 137 |
|
| 139 | 138 |
mBackButton.setOnClickListener( new View.OnClickListener() |
| 140 | 139 |
{
|
| ... | ... | |
| 152 | 151 |
|
| 153 | 152 |
private void setupPrevButton(final RubikActivity act) |
| 154 | 153 |
{
|
| 155 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_left,R.drawable.ui_medium_left, R.drawable.ui_big_left, R.drawable.ui_huge_left); |
|
| 156 | 154 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 157 |
mPrevButton = new TransparentImageButton(act,icon,TransparentImageButton.GRAVITY_MIDDLE,params);
|
|
| 155 |
mPrevButton = new TransparentImageButton(act,R.drawable.ui_huge_left,params);
|
|
| 158 | 156 |
|
| 159 | 157 |
mPrevButton.setOnClickListener( new View.OnClickListener() |
| 160 | 158 |
{
|
| ... | ... | |
| 174 | 172 |
|
| 175 | 173 |
private void setupNextButton(final RubikActivity act) |
| 176 | 174 |
{
|
| 177 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_right,R.drawable.ui_medium_right, R.drawable.ui_big_right, R.drawable.ui_huge_right); |
|
| 178 | 175 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 179 |
mNextButton = new TransparentImageButton(act,icon,TransparentImageButton.GRAVITY_MIDDLE,params);
|
|
| 176 |
mNextButton = new TransparentImageButton(act,R.drawable.ui_huge_right,params);
|
|
| 180 | 177 |
|
| 181 | 178 |
mNextButton.setOnClickListener( new View.OnClickListener() |
| 182 | 179 |
{
|
| src/main/java/org/distorted/screens/RubikScreenPlay.java | ||
|---|---|---|
| 22 | 22 |
import android.view.Gravity; |
| 23 | 23 |
import android.view.LayoutInflater; |
| 24 | 24 |
import android.view.View; |
| 25 |
import android.view.ViewGroup; |
|
| 25 | 26 |
import android.widget.Button; |
| 26 | 27 |
import android.widget.GridLayout; |
| 27 | 28 |
import android.widget.ImageButton; |
| ... | ... | |
| 59 | 60 |
|
| 60 | 61 |
public class RubikScreenPlay extends RubikScreenBase implements RubikNetwork.Updatee |
| 61 | 62 |
{
|
| 63 |
private static final int MP = LinearLayout.LayoutParams.MATCH_PARENT; |
|
| 64 |
|
|
| 62 | 65 |
private static final float MENU_BUTTON_HEIGHT = 0.068f; |
| 63 | 66 |
private static final float MENU_TEXT_SIZE = 0.024f; |
| 64 | 67 |
private static final float MENU_MARGIN = 0.008f; |
| ... | ... | |
| 98 | 101 |
mScreenWidth = act.getScreenWidthInPixels(); |
| 99 | 102 |
mScreenHeight = act.getScreenHeightInPixels(); |
| 100 | 103 |
mUpperBarHeight = act.getHeightUpperBar(); |
| 101 |
|
|
| 102 | 104 |
mMenuButtonHeight = (int)(mScreenHeight*MENU_BUTTON_HEIGHT); |
| 103 | 105 |
mMenuTextSize = (int)(mScreenHeight*MENU_TEXT_SIZE); |
| 104 | 106 |
|
| ... | ... | |
| 125 | 127 |
private void setupObjectButton(final RubikActivity act, final float width) |
| 126 | 128 |
{
|
| 127 | 129 |
final int margin = (int)(width*RubikActivity.SMALL_MARGIN); |
| 128 |
final int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_menu,R.drawable.ui_medium_cube_menu, R.drawable.ui_big_cube_menu, R.drawable.ui_huge_cube_menu); |
|
| 129 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
|
| 130 |
mObjButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params); |
|
| 130 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(MP,MP,1.0f); |
|
| 131 |
mObjButton = new TransparentImageButton(act, R.drawable.ui_huge_cube_menu,params); |
|
| 131 | 132 |
|
| 132 | 133 |
mObjButton.setOnClickListener( new View.OnClickListener() |
| 133 | 134 |
{
|
| ... | ... | |
| 156 | 157 |
|
| 157 | 158 |
private void setupMenuButton(final RubikActivity act, final float width, final float height) |
| 158 | 159 |
{
|
| 159 |
final int icon = RubikActivity.getDrawable(R.drawable.ui_small_menu,R.drawable.ui_medium_menu, R.drawable.ui_big_menu, R.drawable.ui_huge_menu); |
|
| 160 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
|
| 161 |
mMenuButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params); |
|
| 160 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(MP,MP,1.0f); |
|
| 161 |
mMenuButton = new TransparentImageButton(act, R.drawable.ui_huge_menu,params); |
|
| 162 | 162 |
|
| 163 | 163 |
mMenuButton.setOnClickListener( new View.OnClickListener() |
| 164 | 164 |
{
|
| ... | ... | |
| 193 | 193 |
int cubeSize = (int)( (Math.min(width,(int)(height*0.7f))) / 9 ); |
| 194 | 194 |
int margin = (int)(height*RubikActivity.POPUP_MARGIN); |
| 195 | 195 |
int padding = (int)(height*RubikActivity.POPUP_PADDING); |
| 196 |
int botHeight= (int)(height*RubikActivity.POPUP_BOTTOM); |
|
| 196 | 197 |
mObjectSize = (int)(cubeSize + 2*margin + 0.5f); |
| 197 | 198 |
mMaxRowCount = (int)((height-1.8f*mUpperBarHeight)/mObjectSize); |
| 198 | 199 |
|
| 199 | 200 |
LinearLayout view = (LinearLayout)inflate( act, R.layout.popup_object, null); |
| 200 | 201 |
GridLayout objectGrid = view.findViewById(R.id.objectGrid); |
| 201 | 202 |
RelativeLayout bottomLayout = view.findViewById(R.id.bottomLayout); |
| 203 |
|
|
| 204 |
ViewGroup.LayoutParams params = bottomLayout.getLayoutParams(); |
|
| 205 |
params.height = botHeight; |
|
| 206 |
|
|
| 202 | 207 |
setupBottomLayout(act,bottomLayout); |
| 203 | 208 |
|
| 204 | 209 |
PopupCreator.createObjectGrid(objectGrid,act,mRowCount,mColCount,numObjects,margin,cubeSize,padding); |
| ... | ... | |
| 244 | 249 |
|
| 245 | 250 |
private void setupBottomLayout(final RubikActivity act, final RelativeLayout layout) |
| 246 | 251 |
{
|
| 247 |
int iconT = RubikActivity.getDrawable(R.drawable.ui_small_tutorial,R.drawable.ui_medium_tutorial, R.drawable.ui_big_tutorial, R.drawable.ui_huge_tutorial); |
|
| 248 |
int iconD = RubikActivity.getDrawable(R.drawable.ui_small_download,R.drawable.ui_medium_download, R.drawable.ui_big_download, R.drawable.ui_huge_download); |
|
| 249 |
int iconI = RubikActivity.getDrawable(R.drawable.ui_small_info,R.drawable.ui_medium_info, R.drawable.ui_big_info, R.drawable.ui_huge_info); |
|
| 250 |
|
|
| 251 | 252 |
ImageButton buttonTut = layout.findViewById(R.id.buttonTut); |
| 252 | 253 |
ImageButton buttonDow = layout.findViewById(R.id.buttonDow); |
| 253 | 254 |
ImageButton buttonInf = layout.findViewById(R.id.buttonInf); |
| 254 | 255 |
|
| 255 |
buttonTut.setImageResource(iconT);
|
|
| 256 |
buttonDow.setImageResource(iconD);
|
|
| 257 |
buttonInf.setImageResource(iconI);
|
|
| 256 |
buttonTut.setImageResource(R.drawable.ui_huge_tutorial);
|
|
| 257 |
buttonDow.setImageResource(R.drawable.ui_huge_download);
|
|
| 258 |
buttonInf.setImageResource(R.drawable.ui_huge_info);
|
|
| 258 | 259 |
|
| 259 | 260 |
TypedValue outValue = new TypedValue(); |
| 260 | 261 |
act.getTheme().resolveAttribute(android.R.attr.selectableItemBackgroundBorderless, outValue, true); |
| ... | ... | |
| 306 | 307 |
|
| 307 | 308 |
void setupSolveButton(final RubikActivity act) |
| 308 | 309 |
{
|
| 309 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_solve,R.drawable.ui_medium_cube_solve, R.drawable.ui_big_cube_solve, R.drawable.ui_huge_cube_solve); |
|
| 310 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
|
| 311 |
mSolveButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE,params); |
|
| 310 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(MP,MP,1.0f); |
|
| 311 |
mSolveButton = new TransparentImageButton(act, R.drawable.ui_huge_cube_solve,params); |
|
| 312 | 312 |
|
| 313 | 313 |
mSolveButton.setOnClickListener( new View.OnClickListener() |
| 314 | 314 |
{
|
| ... | ... | |
| 325 | 325 |
|
| 326 | 326 |
private void setupScrambleButton(final RubikActivity act) |
| 327 | 327 |
{
|
| 328 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_scramble,R.drawable.ui_medium_cube_scramble, R.drawable.ui_big_cube_scramble, R.drawable.ui_huge_cube_scramble); |
|
| 329 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
|
| 330 |
mScrambleButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params); |
|
| 328 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(MP,MP,1.0f); |
|
| 329 |
mScrambleButton = new TransparentImageButton(act, R.drawable.ui_huge_cube_scramble,params); |
|
| 331 | 330 |
|
| 332 | 331 |
mScrambleButton.setOnClickListener( new View.OnClickListener() |
| 333 | 332 |
{
|
| src/main/java/org/distorted/screens/RubikScreenReady.java | ||
|---|---|---|
| 57 | 57 |
|
| 58 | 58 |
private void setupBackButton(final RubikActivity act) |
| 59 | 59 |
{
|
| 60 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_back,R.drawable.ui_medium_back, R.drawable.ui_big_back, R.drawable.ui_huge_back); |
|
| 61 | 60 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 62 |
mBackButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 61 |
mBackButton = new TransparentImageButton(act,R.drawable.ui_huge_back,params);
|
|
| 63 | 62 |
|
| 64 | 63 |
mBackButton.setOnClickListener( new View.OnClickListener() |
| 65 | 64 |
{
|
| src/main/java/org/distorted/screens/RubikScreenSolution.java | ||
|---|---|---|
| 101 | 101 |
|
| 102 | 102 |
private void setupPrevButton(final RubikActivity act) |
| 103 | 103 |
{
|
| 104 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_left,R.drawable.ui_medium_left, R.drawable.ui_big_left, R.drawable.ui_huge_left); |
|
| 105 | 104 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 106 |
mPrevButton = new TransparentImageButton(act,icon,TransparentImageButton.GRAVITY_MIDDLE,params);
|
|
| 105 |
mPrevButton = new TransparentImageButton(act,R.drawable.ui_huge_left,params);
|
|
| 107 | 106 |
|
| 108 | 107 |
mPrevButton.setOnClickListener( new View.OnClickListener() |
| 109 | 108 |
{
|
| ... | ... | |
| 121 | 120 |
|
| 122 | 121 |
private void setupNextButton(final RubikActivity act) |
| 123 | 122 |
{
|
| 124 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_right,R.drawable.ui_medium_right, R.drawable.ui_big_right, R.drawable.ui_huge_right); |
|
| 125 | 123 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 126 |
mNextButton = new TransparentImageButton(act,icon,TransparentImageButton.GRAVITY_MIDDLE,params);
|
|
| 124 |
mNextButton = new TransparentImageButton(act,R.drawable.ui_huge_right,params);
|
|
| 127 | 125 |
|
| 128 | 126 |
mNextButton.setOnClickListener( new View.OnClickListener() |
| 129 | 127 |
{
|
| ... | ... | |
| 162 | 160 |
|
| 163 | 161 |
private void setupBackButton(final RubikActivity act) |
| 164 | 162 |
{
|
| 165 |
final int icon = RubikActivity.getDrawable(R.drawable.ui_small_back,R.drawable.ui_medium_back, R.drawable.ui_big_back, R.drawable.ui_huge_back); |
|
| 166 | 163 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 167 |
mBackButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE,params);
|
|
| 164 |
mBackButton = new TransparentImageButton(act,R.drawable.ui_huge_back,params);
|
|
| 168 | 165 |
|
| 169 | 166 |
mBackButton.setOnClickListener( new View.OnClickListener() |
| 170 | 167 |
{
|
| src/main/java/org/distorted/screens/RubikScreenSolver.java | ||
|---|---|---|
| 287 | 287 |
|
| 288 | 288 |
private void setupResetButton(final RubikActivity act) |
| 289 | 289 |
{
|
| 290 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_reset,R.drawable.ui_medium_reset, R.drawable.ui_big_reset, R.drawable.ui_huge_reset); |
|
| 291 | 290 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT); |
| 292 |
mResetButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 291 |
mResetButton = new TransparentImageButton(act, R.drawable.ui_huge_reset, params);
|
|
| 293 | 292 |
|
| 294 | 293 |
mResetButton.setOnClickListener( new View.OnClickListener() |
| 295 | 294 |
{
|
| ... | ... | |
| 306 | 305 |
|
| 307 | 306 |
private void setupSolveButton(final RubikActivity act) |
| 308 | 307 |
{
|
| 309 |
final int icon = RubikActivity.getDrawable(R.drawable.ui_small_solve,R.drawable.ui_medium_solve, R.drawable.ui_big_solve, R.drawable.ui_huge_solve); |
|
| 310 | 308 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 311 |
mSolveButton = new TransparentImageButton(act,icon,TransparentImageButton.GRAVITY_MIDDLE,params);
|
|
| 309 |
mSolveButton = new TransparentImageButton(act,R.drawable.ui_huge_solve,params);
|
|
| 312 | 310 |
|
| 313 | 311 |
mSolveButton.setOnClickListener( new View.OnClickListener() |
| 314 | 312 |
{
|
| ... | ... | |
| 330 | 328 |
|
| 331 | 329 |
private void setupBackButton(final RubikActivity act) |
| 332 | 330 |
{
|
| 333 |
final int icon = RubikActivity.getDrawable(R.drawable.ui_small_back,R.drawable.ui_medium_back, R.drawable.ui_big_back, R.drawable.ui_huge_back); |
|
| 334 | 331 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 335 |
mBackButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 332 |
mBackButton = new TransparentImageButton(act,R.drawable.ui_huge_back,params);
|
|
| 336 | 333 |
|
| 337 | 334 |
mBackButton.setOnClickListener( new View.OnClickListener() |
| 338 | 335 |
{
|
| src/main/java/org/distorted/screens/RubikScreenSolving.java | ||
|---|---|---|
| 82 | 82 |
|
| 83 | 83 |
private void setupBackButton(final RubikActivity act) |
| 84 | 84 |
{
|
| 85 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_back,R.drawable.ui_medium_back, R.drawable.ui_big_back, R.drawable.ui_huge_back); |
|
| 86 | 85 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 87 |
mBackButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 86 |
mBackButton = new TransparentImageButton(act,R.drawable.ui_huge_back,params);
|
|
| 88 | 87 |
|
| 89 | 88 |
mBackButton.setOnClickListener( new View.OnClickListener() |
| 90 | 89 |
{
|
| src/main/java/org/distorted/tutorials/TutorialActivity.java | ||
|---|---|---|
| 280 | 280 |
startActivity(intent); |
| 281 | 281 |
} |
| 282 | 282 |
|
| 283 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 284 |
|
|
| 285 |
public static int getDrawableSize() |
|
| 286 |
{
|
|
| 287 |
if( mScreenHeight<1000 ) return 0; |
|
| 288 |
if( mScreenHeight<1600 ) return 1; |
|
| 289 |
if( mScreenHeight<1900 ) return 2; |
|
| 290 |
return 3; |
|
| 291 |
} |
|
| 292 |
|
|
| 293 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 294 |
|
|
| 295 |
public static int getDrawable(int small, int medium, int big, int huge) |
|
| 296 |
{
|
|
| 297 |
int size = getDrawableSize(); |
|
| 298 |
|
|
| 299 |
switch(size) |
|
| 300 |
{
|
|
| 301 |
case 0 : return small; |
|
| 302 |
case 1 : return medium; |
|
| 303 |
case 2 : return big; |
|
| 304 |
default: return huge; |
|
| 305 |
} |
|
| 306 |
} |
|
| 307 |
|
|
| 308 | 283 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 309 | 284 |
|
| 310 | 285 |
public boolean isVertical() |
| src/main/java/org/distorted/tutorials/TutorialScreen.java | ||
|---|---|---|
| 17 | 17 |
|
| 18 | 18 |
import org.distorted.helpers.LockController; |
| 19 | 19 |
import org.distorted.main.R; |
| 20 |
import org.distorted.main.RubikActivity; |
|
| 21 | 20 |
import org.distorted.objects.RubikObject; |
| 22 | 21 |
import org.distorted.helpers.TransparentImageButton; |
| 23 | 22 |
|
| ... | ... | |
| 35 | 34 |
|
| 36 | 35 |
private void setupLockButton(final TutorialActivity act) |
| 37 | 36 |
{
|
| 38 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_locked,R.drawable.ui_medium_locked, R.drawable.ui_big_locked, R.drawable.ui_huge_locked); |
|
| 39 | 37 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 40 |
mLockButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 38 |
mLockButton = new TransparentImageButton(act,R.drawable.ui_huge_locked,params);
|
|
| 41 | 39 |
|
| 42 | 40 |
mLockButton.setOnClickListener( new View.OnClickListener() |
| 43 | 41 |
{
|
| ... | ... | |
| 80 | 78 |
|
| 81 | 79 |
private void setupSolveButton(final TutorialActivity act) |
| 82 | 80 |
{
|
| 83 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_solve,R.drawable.ui_medium_cube_solve, R.drawable.ui_big_cube_solve, R.drawable.ui_huge_cube_solve); |
|
| 84 | 81 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 85 |
mSolveButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 82 |
mSolveButton = new TransparentImageButton(act,R.drawable.ui_huge_cube_solve,params);
|
|
| 86 | 83 |
|
| 87 | 84 |
mSolveButton.setOnClickListener( new View.OnClickListener() |
| 88 | 85 |
{
|
| ... | ... | |
| 99 | 96 |
|
| 100 | 97 |
private void setupScrambleButton(final TutorialActivity act) |
| 101 | 98 |
{
|
| 102 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_scramble,R.drawable.ui_medium_cube_scramble, R.drawable.ui_big_cube_scramble, R.drawable.ui_huge_cube_scramble); |
|
| 103 | 99 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 104 |
mScrambleButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 100 |
mScrambleButton = new TransparentImageButton(act,R.drawable.ui_huge_cube_scramble,params);
|
|
| 105 | 101 |
|
| 106 | 102 |
mScrambleButton.setOnClickListener( new View.OnClickListener() |
| 107 | 103 |
{
|
| ... | ... | |
| 118 | 114 |
|
| 119 | 115 |
private void setupBackButton(final TutorialActivity act) |
| 120 | 116 |
{
|
| 121 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_smallback,R.drawable.ui_medium_smallback, R.drawable.ui_big_smallback, R.drawable.ui_huge_smallback); |
|
| 122 | 117 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
| 123 |
mBackButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
|
| 118 |
mBackButton = new TransparentImageButton(act,R.drawable.ui_huge_smallback,params);
|
|
| 124 | 119 |
|
| 125 | 120 |
mBackButton.setOnClickListener( new View.OnClickListener() |
| 126 | 121 |
{
|
| src/main/res/drawable/ui_big_spinner.xml | ||
|---|---|---|
| 1 |
<?xml version="1.0" encoding="utf-8"?> |
|
| 2 |
<selector xmlns:android="http://schemas.android.com/apk/res/android"> |
|
| 3 |
<item> |
|
| 4 |
<layer-list> |
|
| 5 |
<item> |
|
| 6 |
<shape android:shape="rectangle"> |
|
| 7 |
<solid android:color="@color/light_grey" /> |
|
| 8 |
<corners android:radius="6dip" /> |
|
| 9 |
<stroke |
|
| 10 |
android:color="@color/grey" |
|
| 11 |
android:width="2dp"/> |
|
| 12 |
</shape> |
|
| 13 |
</item> |
|
| 14 |
<item > |
|
| 15 |
<bitmap android:gravity="center_vertical|right" android:src="@drawable/ui_big_down"/> |
|
| 16 |
</item> |
|
| 17 |
</layer-list> |
|
| 18 |
</item> |
|
| 19 |
</selector> |
|
| src/main/res/drawable/ui_medium_spinner.xml | ||
|---|---|---|
| 1 |
<?xml version="1.0" encoding="utf-8"?> |
|
| 2 |
<selector xmlns:android="http://schemas.android.com/apk/res/android"> |
|
| 3 |
<item> |
|
| 4 |
<layer-list> |
|
| 5 |
<item> |
|
| 6 |
<shape android:shape="rectangle"> |
|
| 7 |
<solid android:color="@color/light_grey" /> |
|
| 8 |
<corners android:radius="6dip" /> |
|
| 9 |
<stroke |
|
| 10 |
android:color="@color/grey" |
|
| 11 |
android:width="2dp"/> |
|
| 12 |
</shape> |
|
| 13 |
</item> |
|
| 14 |
<item > |
|
| 15 |
<bitmap android:gravity="center_vertical|right" android:src="@drawable/ui_medium_down"/> |
|
| 16 |
</item> |
|
| 17 |
</layer-list> |
|
| 18 |
</item> |
|
| 19 |
</selector> |
|
| src/main/res/drawable/ui_small_spinner.xml | ||
|---|---|---|
| 1 |
<?xml version="1.0" encoding="utf-8"?> |
|
| 2 |
<selector xmlns:android="http://schemas.android.com/apk/res/android"> |
|
| 3 |
<item> |
|
| 4 |
<layer-list> |
|
| 5 |
<item> |
|
| 6 |
<shape android:shape="rectangle"> |
|
| 7 |
<solid android:color="@color/light_grey" /> |
|
| 8 |
<corners android:radius="6dip" /> |
|
| 9 |
<stroke |
|
| 10 |
android:color="@color/grey" |
|
| 11 |
android:width="2dp"/> |
|
| 12 |
</shape> |
|
| 13 |
</item> |
|
| 14 |
<item > |
|
| 15 |
<bitmap android:gravity="center_vertical|right" android:src="@drawable/ui_small_down"/> |
|
| 16 |
</item> |
|
| 17 |
</layer-list> |
|
| 18 |
</item> |
|
| 19 |
</selector> |
|
| src/main/res/layout/non_free_object.xml | ||
|---|---|---|
| 18 | 18 |
android:adjustViewBounds="true" |
| 19 | 19 |
android:paddingTop="-10dp" |
| 20 | 20 |
android:scaleType="fitStart" |
| 21 |
android:src="@drawable/ui_big_locked"/>
|
|
| 21 |
android:src="@drawable/ui_huge_locked"/>
|
|
| 22 | 22 |
|
| 23 | 23 |
</FrameLayout> |
| src/main/res/layout/popup_object.xml | ||
|---|---|---|
| 21 | 21 |
<RelativeLayout |
| 22 | 22 |
android:id="@+id/bottomLayout" |
| 23 | 23 |
android:layout_width="match_parent" |
| 24 |
android:layout_height="wrap_content"
|
|
| 24 |
android:layout_height="60dp"
|
|
| 25 | 25 |
android:background="@color/grey" |
| 26 | 26 |
android:paddingEnd="10dp" |
| 27 | 27 |
android:paddingStart="10dp"> |
| ... | ... | |
| 29 | 29 |
<ImageButton |
| 30 | 30 |
android:id="@+id/buttonTut" |
| 31 | 31 |
android:layout_alignParentStart="true" |
| 32 |
android:adjustViewBounds="true" |
|
| 33 |
android:scaleType="fitCenter" |
|
| 32 | 34 |
android:layout_width="wrap_content" |
| 33 |
android:layout_height="wrap_content"/>
|
|
| 35 |
android:layout_height="match_parent"/>
|
|
| 34 | 36 |
|
| 35 | 37 |
<ImageButton |
| 36 | 38 |
android:id="@+id/buttonDow" |
| 37 | 39 |
android:layout_centerHorizontal="true" |
| 40 |
android:adjustViewBounds="true" |
|
| 41 |
android:scaleType="fitCenter" |
|
| 38 | 42 |
android:layout_width="wrap_content" |
| 39 |
android:layout_height="wrap_content"/>
|
|
| 43 |
android:layout_height="match_parent"/>
|
|
| 40 | 44 |
<TextView |
| 41 | 45 |
android:id="@+id/bubbleUpdates" |
| 46 |
android:adjustViewBounds="true" |
|
| 42 | 47 |
android:layout_width="wrap_content" |
| 43 | 48 |
android:layout_height="wrap_content" |
| 44 | 49 |
android:layout_alignTop="@+id/buttonDow" |
| 45 | 50 |
android:layout_alignEnd="@+id/buttonDow" |
| 51 |
android:scaleType="fitCenter" |
|
| 46 | 52 |
android:textColor="#FFF" |
| 47 | 53 |
android:textSize="16sp" |
| 48 | 54 |
android:textStyle="bold" |
| ... | ... | |
| 50 | 56 |
|
| 51 | 57 |
<ImageButton |
| 52 | 58 |
android:id="@+id/buttonInf" |
| 59 |
android:adjustViewBounds="true" |
|
| 53 | 60 |
android:layout_alignParentEnd="true" |
| 61 |
android:scaleType="fitCenter" |
|
| 54 | 62 |
android:layout_width="wrap_content" |
| 55 |
android:layout_height="wrap_content"/>
|
|
| 63 |
android:layout_height="match_parent"/>
|
|
| 56 | 64 |
|
| 57 | 65 |
</RelativeLayout> |
| 58 | 66 |
|
Also available in: Unified diff
Unify the (small,medium,big,huge) UI graphics.