Revision 4918f19c
Added by Leszek Koltunski almost 5 years ago
src/main/java/org/distorted/magic/RubikActivity.java | ||
---|---|---|
218 | 218 |
|
219 | 219 |
public void Scores(View v) |
220 | 220 |
{ |
221 |
RubikScores scores = new RubikScores(); |
|
222 | 221 |
Bundle bundle = new Bundle(); |
223 |
bundle.putInt("button", mButton); |
|
222 |
bundle.putInt("tab", mButton); |
|
223 |
|
|
224 |
RubikScores scores = new RubikScores(); |
|
224 | 225 |
scores.setArguments(bundle); |
225 | 226 |
scores.show(getSupportFragmentManager(), null); |
226 | 227 |
} |
src/main/java/org/distorted/magic/RubikScores.java | ||
---|---|---|
63 | 63 |
} |
64 | 64 |
}); |
65 | 65 |
|
66 |
Bundle args = getArguments(); |
|
67 |
int curTab; |
|
68 |
|
|
69 |
try |
|
70 |
{ |
|
71 |
curTab = args.getInt("tab"); |
|
72 |
} |
|
73 |
catch(Exception e) |
|
74 |
{ |
|
75 |
curTab = 0; |
|
76 |
} |
|
77 |
|
|
66 | 78 |
LayoutInflater inflater = act.getLayoutInflater(); |
67 | 79 |
final View view = inflater.inflate(R.layout.scores, null); |
68 | 80 |
builder.setView(view); |
... | ... | |
72 | 84 |
mPagerAdapter = new RubikScoresPagerAdapter(act,viewPager); |
73 | 85 |
tabLayout.setupWithViewPager(viewPager); |
74 | 86 |
|
75 |
Bundle args = getArguments(); |
|
76 |
int button = args.getInt("button"); |
|
77 |
viewPager.setCurrentItem(button); |
|
87 |
viewPager.setCurrentItem(curTab); |
|
78 | 88 |
|
79 | 89 |
for (int i = 0; i< RubikSize.LENGTH; i++) |
80 | 90 |
{ |
src/main/java/org/distorted/magic/RubikScoresPagerAdapter.java | ||
---|---|---|
99 | 99 |
|
100 | 100 |
try |
101 | 101 |
{ |
102 |
Thread.sleep(50);
|
|
102 |
Thread.sleep(60);
|
|
103 | 103 |
} |
104 | 104 |
catch( InterruptedException ie) |
105 | 105 |
{ |
src/main/java/org/distorted/magic/RubikScoresView.java | ||
---|---|---|
26 | 26 |
import android.widget.FrameLayout; |
27 | 27 |
import android.widget.ImageView; |
28 | 28 |
import android.widget.LinearLayout; |
29 |
import android.widget.ScrollView; |
|
29 | 30 |
import android.widget.TextView; |
30 | 31 |
|
31 | 32 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
81 | 82 |
|
82 | 83 |
void addSection(FragmentActivity act, int scramble, final int[] country, final String[] name, final String[] time) |
83 | 84 |
{ |
84 |
LinearLayout level = (LinearLayout)inflate(act, R.layout.level_records, null);
|
|
85 |
TextView text = level.findViewById(R.id.levelTitle);
|
|
85 |
LinearLayout level = (LinearLayout)inflate(act, R.layout.scores_scramble_title, null);
|
|
86 |
TextView text = level.findViewById(R.id.scoresScrambleTitle);
|
|
86 | 87 |
text.setText(act.getString(R.string.sc_placeholder,(scramble+1))); |
87 | 88 |
|
88 | 89 |
for(int j=0; j<RubikScoresDownloader.MAX_PLACES; j++) |
89 | 90 |
{ |
90 | 91 |
if( name[j] != null ) |
91 | 92 |
{ |
92 |
View row = inflate(act, R.layout.level_row, null);
|
|
93 |
View row = inflate(act, R.layout.scores_scramble_row, null);
|
|
93 | 94 |
|
94 |
ImageView imgCoun = row.findViewById(R.id.level_row_country);
|
|
95 |
TextView textName = row.findViewById(R.id.level_row_name);
|
|
96 |
TextView textTime = row.findViewById(R.id.level_row_time);
|
|
95 |
ImageView imgCoun = row.findViewById(R.id.scoresScrambleRowCountry);
|
|
96 |
TextView textName = row.findViewById(R.id.scoresScrambleRowName);
|
|
97 |
TextView textTime = row.findViewById(R.id.scoresScrambleRowTime);
|
|
97 | 98 |
|
98 | 99 |
imgCoun.setImageResource(country[j]); |
99 | 100 |
textName.setText(name[j]); |
src/main/java/org/distorted/magic/RubikSettings.java | ||
---|---|---|
20 | 20 |
package org.distorted.magic; |
21 | 21 |
|
22 | 22 |
import android.app.Dialog; |
23 |
import android.content.DialogInterface; |
|
23 | 24 |
import android.os.Bundle; |
24 | 25 |
import android.support.annotation.NonNull; |
25 | 26 |
import android.support.v4.app.FragmentActivity; |
... | ... | |
74 | 75 |
LinearLayout outerLayout = new LinearLayout(act); |
75 | 76 |
LinearLayout.LayoutParams outerLayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT, 0.5f); |
76 | 77 |
outerLayoutParams.topMargin = margin; |
77 |
outerLayoutParams.bottomMargin = margin;
|
|
78 |
outerLayoutParams.bottomMargin = 0;
|
|
78 | 79 |
outerLayoutParams.leftMargin = margin; |
79 | 80 |
outerLayoutParams.rightMargin = margin; |
80 | 81 |
|
... | ... | |
205 | 206 |
{ |
206 | 207 |
FragmentActivity act = getActivity(); |
207 | 208 |
AlertDialog.Builder builder = new AlertDialog.Builder(act); |
208 |
builder.setCancelable(false); |
|
209 |
|
|
210 |
builder.setCancelable(true); |
|
211 |
builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener() |
|
212 |
{ |
|
213 |
@Override |
|
214 |
public void onClick(DialogInterface dialog, int which) |
|
215 |
{ |
|
216 |
|
|
217 |
} |
|
218 |
}); |
|
209 | 219 |
|
210 | 220 |
LayoutInflater inflater = act.getLayoutInflater(); |
211 | 221 |
final View view = inflater.inflate(R.layout.settings, null); |
src/main/res/layout/level_records.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
3 |
android:id="@+id/levelLayout" |
|
4 |
android:layout_width="match_parent" |
|
5 |
android:layout_height="wrap_content" |
|
6 |
android:background="@color/grey" |
|
7 |
|
|
8 |
android:paddingBottom="0dp" |
|
9 |
android:paddingTop="0dp" |
|
10 |
android:paddingLeft="5dp" |
|
11 |
android:paddingRight="5dp" |
|
12 |
android:orientation="vertical" > |
|
13 |
|
|
14 |
<TextView |
|
15 |
android:id="@+id/levelTitle" |
|
16 |
android:layout_width="match_parent" |
|
17 |
android:layout_height="32dp" |
|
18 |
android:textSize="24sp" |
|
19 |
android:gravity="center" |
|
20 |
android:background="@color/grey" |
|
21 |
android:paddingBottom="0dp" |
|
22 |
android:paddingTop="0dp" |
|
23 |
android:paddingLeft="5dp" |
|
24 |
android:paddingRight="5dp"/> |
|
25 |
|
|
26 |
</LinearLayout> |
src/main/res/layout/level_row.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
3 |
android:layout_width="fill_parent" |
|
4 |
android:layout_height="50dp" |
|
5 |
android:paddingBottom="2dp" |
|
6 |
android:paddingTop="2dp" |
|
7 |
android:orientation="horizontal" > |
|
8 |
|
|
9 |
<ImageView |
|
10 |
android:id="@+id/level_row_country" |
|
11 |
android:layout_width="match_parent" |
|
12 |
android:layout_height="match_parent" |
|
13 |
android:layout_weight="1.5" |
|
14 |
android:textSize="20sp" |
|
15 |
android:gravity="left" |
|
16 |
android:background="@color/black" |
|
17 |
android:paddingLeft="5dp"/> |
|
18 |
|
|
19 |
<TextView |
|
20 |
android:id="@+id/level_row_name" |
|
21 |
android:layout_width="match_parent" |
|
22 |
android:layout_height="match_parent" |
|
23 |
android:layout_weight="1" |
|
24 |
android:textSize="20sp" |
|
25 |
android:gravity="left" |
|
26 |
android:background="@color/black" |
|
27 |
/> |
|
28 |
|
|
29 |
<TextView |
|
30 |
android:id="@+id/level_row_time" |
|
31 |
android:layout_width="match_parent" |
|
32 |
android:layout_height="match_parent" |
|
33 |
android:layout_weight="1.5" |
|
34 |
android:textSize="20sp" |
|
35 |
android:gravity="right" |
|
36 |
android:background="@color/black" |
|
37 |
android:paddingRight="5dp" |
|
38 |
/> |
|
39 |
</LinearLayout> |
src/main/res/layout/scores_scramble_row.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
3 |
android:layout_width="fill_parent" |
|
4 |
android:layout_height="0dp" |
|
5 |
android:paddingBottom="2dp" |
|
6 |
android:paddingTop="2dp" |
|
7 |
android:orientation="horizontal" > |
|
8 |
|
|
9 |
<ImageView |
|
10 |
android:id="@+id/scoresScrambleRowCountry" |
|
11 |
android:layout_width="match_parent" |
|
12 |
android:layout_height="match_parent" |
|
13 |
android:layout_weight="1.5" |
|
14 |
android:textSize="20sp" |
|
15 |
android:gravity="left" |
|
16 |
android:background="@color/black" |
|
17 |
android:paddingLeft="0dp"/> |
|
18 |
|
|
19 |
<TextView |
|
20 |
android:id="@+id/scoresScrambleRowName" |
|
21 |
android:layout_width="match_parent" |
|
22 |
android:layout_height="match_parent" |
|
23 |
android:layout_weight="1" |
|
24 |
android:textSize="20sp" |
|
25 |
android:gravity="left" |
|
26 |
android:background="@color/black" |
|
27 |
/> |
|
28 |
|
|
29 |
<TextView |
|
30 |
android:id="@+id/scoresScrambleRowTime" |
|
31 |
android:layout_width="match_parent" |
|
32 |
android:layout_height="match_parent" |
|
33 |
android:layout_weight="1.5" |
|
34 |
android:textSize="20sp" |
|
35 |
android:gravity="right" |
|
36 |
android:background="@color/black" |
|
37 |
android:paddingRight="5dp" |
|
38 |
/> |
|
39 |
</LinearLayout> |
src/main/res/layout/scores_scramble_title.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
3 |
android:id="@+id/scoresScrambleLayout" |
|
4 |
android:layout_width="match_parent" |
|
5 |
android:layout_height="wrap_content" |
|
6 |
android:background="@color/grey" |
|
7 |
|
|
8 |
android:paddingBottom="0dp" |
|
9 |
android:paddingTop="0dp" |
|
10 |
android:paddingLeft="5dp" |
|
11 |
android:paddingRight="5dp" |
|
12 |
android:orientation="vertical" > |
|
13 |
|
|
14 |
<TextView |
|
15 |
android:id="@+id/scoresScrambleTitle" |
|
16 |
android:layout_width="match_parent" |
|
17 |
android:layout_height="32dp" |
|
18 |
android:textSize="24sp" |
|
19 |
android:gravity="center" |
|
20 |
android:background="@color/grey" |
|
21 |
android:paddingBottom="0dp" |
|
22 |
android:paddingTop="0dp" |
|
23 |
android:paddingLeft="5dp" |
|
24 |
android:paddingRight="5dp"/> |
|
25 |
|
|
26 |
</LinearLayout> |
Also available in: Unified diff
Various improvements.