Revision d7e539d0
Added by Leszek Koltunski about 5 years ago
| src/main/java/org/distorted/scores/RubikScores.java | ||
|---|---|---|
| 348 | 348 |     if( mCountry.equals("do") ) mCountry = "dm";  // see above
 | 
| 349 | 349 | } | 
| 350 | 350 |  | 
| 351 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 352 |  | |
| 353 | public boolean isSolved(int object, int size, int level) | |
| 354 |     {
 | |
| 355 | int maxsize = RubikObjectList.getObject(object).getSizes().length; | |
| 356 |  | |
| 357 | if( object>=0 && object<NUM_OBJECTS && size>=0 && size<maxsize && level>=0 && level<MAX_LEVEL ) | |
| 358 |       {
 | |
| 359 | return mRecords[object][size][level]<NO_RECORD; | |
| 360 | } | |
| 361 |  | |
| 362 | return false; | |
| 363 | } | |
| 364 |  | |
| 351 | 365 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 352 | 366 |  | 
| 353 | 367 | public long getRecord(int object, int size, int level) | 
| src/main/java/org/distorted/states/RubikStatePlay.java | ||
|---|---|---|
| 40 | 40 | import org.distorted.main.RubikPreRender; | 
| 41 | 41 | import org.distorted.objects.RubikObject; | 
| 42 | 42 | import org.distorted.objects.RubikObjectList; | 
| 43 | import org.distorted.scores.RubikScores; | |
| 43 | 44 |  | 
| 44 | 45 | import java.util.ArrayList; | 
| 45 | 46 |  | 
| ... | ... | |
| 595 | 596 |  | 
| 596 | 597 | mPlayLayout.removeAllViews(); | 
| 597 | 598 |  | 
| 599 | int realSize= RubikObjectList.getSizeIndex(mObject,mSize); | |
| 600 | RubikScores scores = RubikScores.getInstance(); | |
| 601 |  | |
| 598 | 602 | for(int i=0; i<maxLevel; i++) | 
| 599 | 603 |       {
 | 
| 600 | 604 | final int but = i; | 
| ... | ... | |
| 603 | 607 | button.setText(levels[i]); | 
| 604 | 608 | button.setTextSize(TypedValue.COMPLEX_UNIT_PX, mMenuTextSize); | 
| 605 | 609 |  | 
| 610 | int icon = scores.isSolved(mObject, realSize, i) ? R.drawable.ui_solved : R.drawable.ui_notsolved; | |
| 611 | button.setCompoundDrawablesWithIntrinsicBounds(icon,0,0,0); | |
| 612 |  | |
| 606 | 613 | button.setOnClickListener( new View.OnClickListener() | 
| 607 | 614 |         {
 | 
| 608 | 615 | @Override | 
| src/main/res/layout/main.xml | ||
|---|---|---|
| 8 | 8 | android:id="@+id/upperBar" | 
| 9 | 9 | android:layout_width="fill_parent" | 
| 10 | 10 | android:layout_height="0dp" | 
| 11 | android:layout_weight="0.1" | |
| 11 |         android:layout_weight="0.12"
 | |
| 12 | 12 | android:gravity="center" | 
| 13 | 13 | android:orientation="horizontal"> | 
| 14 | 14 | </LinearLayout> | 
| ... | ... | |
| 23 | 23 | android:id="@+id/lowerBar" | 
| 24 | 24 | android:layout_width="match_parent" | 
| 25 | 25 | android:layout_height="0dp" | 
| 26 | android:layout_weight="0.1" | |
| 26 |         android:layout_weight="0.12"
 | |
| 27 | 27 | android:orientation="horizontal"> | 
| 28 | 28 |  | 
| 29 | 29 | <LinearLayout | 
Also available in: Unified diff
Progress with Play state.