Revision 10d04892
Added by Leszek Koltunski about 1 year ago
src/main/java/org/distorted/dialogs/RubikDialogScores.java | ||
---|---|---|
56 | 56 |
public boolean hasArgument() { return true; } |
57 | 57 |
public int getPositive() { return R.string.ok; } |
58 | 58 |
public int getNegative() { return -1; } |
59 |
|
|
60 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
61 |
|
|
62 |
public void positiveAction() |
|
63 |
{ |
|
64 |
RubikDialogScoresThread thr = RubikDialogScoresThread.getInstance(); |
|
65 |
thr.exit(); |
|
66 |
} |
|
67 |
|
|
68 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
69 |
|
|
70 |
public void negativeAction() |
|
71 |
{ |
|
72 |
|
|
73 |
} |
|
59 |
public void positiveAction() { RubikDialogScoresThread.getInstance().exit(); } |
|
60 |
public void negativeAction() { } |
|
74 | 61 |
|
75 | 62 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
76 | 63 |
|
src/main/java/org/distorted/dialogs/RubikDialogScoresPagerAdapter.java | ||
---|---|---|
161 | 161 |
|
162 | 162 |
synchronized(mObj) |
163 | 163 |
{ |
164 |
view = new RubikDialogScoresView(mAct, metrics.heightPixels, mIsSubmitting); |
|
164 |
view = new RubikDialogScoresView(mAct, metrics.heightPixels, mIsSubmitting, mNetworkState==NETWORK_SUCCESS );
|
|
165 | 165 |
collection.addView(view); |
166 | 166 |
|
167 | 167 |
if( mNetworkState==NETWORK_SUCCESS ) |
... | ... | |
171 | 171 |
String[][] n = mName[position]; |
172 | 172 |
int[][] tm = mTime[position]; |
173 | 173 |
|
174 |
for(int l=0; l<=num; l++) |
|
175 |
{ |
|
176 |
String title = (l==num ? mAct.getString(R.string.levelM) : mAct.getString(R.string.lv_placeholder, l+1)); |
|
177 |
LinearLayout section = view.createSection(mAct, position, title, l, c[l], n[l], tm[l]); |
|
178 |
view.addSection(mAct,section); |
|
179 |
} |
|
174 |
RubikDialogScoresThread thr = RubikDialogScoresThread.getInstance(); |
|
175 |
thr.equip(mAct,mViewPager); |
|
176 |
|
|
177 |
for(int l=0; l<=num; l++) thr.newWork(position, l, num, view, c[l], n[l], tm[l]); |
|
180 | 178 |
} |
181 | 179 |
else if( mNetworkState==NETWORK_FAILURE ) |
182 | 180 |
{ |
src/main/java/org/distorted/dialogs/RubikDialogScoresView.java | ||
---|---|---|
49 | 49 |
|
50 | 50 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
51 | 51 |
|
52 |
public RubikDialogScoresView(Context context, int height, boolean isSubmitting) |
|
52 |
public RubikDialogScoresView(Context context, int height, boolean isSubmitting, boolean downloadedAlready )
|
|
53 | 53 |
{ |
54 | 54 |
super(context); |
55 | 55 |
|
56 | 56 |
mHeight = height; |
57 | 57 |
|
58 |
View view = inflate(context, R.layout.dialog_scores_downloading, null); |
|
59 |
addView(view); |
|
60 |
TextView text = findViewById(R.id.message_text); |
|
61 |
text.setText( context.getString(isSubmitting ? R.string.submitting : R.string.downloading) ); |
|
58 |
if( !downloadedAlready ) |
|
59 |
{ |
|
60 |
View view = inflate(context, R.layout.dialog_scores_downloading, null); |
|
61 |
addView(view); |
|
62 |
TextView text = findViewById(R.id.message_text); |
|
63 |
text.setText(context.getString(isSubmitting ? R.string.submitting : R.string.downloading)); |
|
64 |
} |
|
62 | 65 |
} |
63 | 66 |
|
64 | 67 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Speed up the time when the HighScores Dialog appears