Revision 211b48f2
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/magic/RubikScoresDownloader.java | ||
---|---|---|
26 | 26 |
import java.net.URL; |
27 | 27 |
import java.net.UnknownHostException; |
28 | 28 |
|
29 |
import org.distorted.uistate.RubikStatePlay; |
|
30 |
|
|
29 | 31 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
30 | 32 |
|
31 |
class RubikScoresDownloader implements Runnable |
|
33 |
public class RubikScoresDownloader implements Runnable
|
|
32 | 34 |
{ |
33 |
interface Receiver |
|
35 |
public interface Receiver
|
|
34 | 36 |
{ |
35 | 37 |
void receive(int[][][] country, String[][][] name, String[][][] time); |
36 | 38 |
void exception(String exception); |
37 | 39 |
} |
38 | 40 |
|
39 |
static final int MAX_PLACES = 12; |
|
41 |
public static final int MAX_PLACES = 12;
|
|
40 | 42 |
|
41 | 43 |
private static final int DOWNLOAD = 0; |
42 | 44 |
private static final int SUBMIT = 1; |
... | ... | |
86 | 88 |
private static String mPackageName; |
87 | 89 |
|
88 | 90 |
private static String mScores = ""; |
89 |
private static int[][][] mCountry = new int [RubikSize.LENGTH][RubikSurfaceView.MAX_SCRAMBLE][MAX_PLACES];
|
|
90 |
private static String[][][] mName = new String[RubikSize.LENGTH][RubikSurfaceView.MAX_SCRAMBLE][MAX_PLACES];
|
|
91 |
private static String[][][] mTime = new String[RubikSize.LENGTH][RubikSurfaceView.MAX_SCRAMBLE][MAX_PLACES];
|
|
91 |
private static int[][][] mCountry = new int [RubikSize.LENGTH][RubikStatePlay.MAX_SCRAMBLE][MAX_PLACES];
|
|
92 |
private static String[][][] mName = new String[RubikSize.LENGTH][RubikStatePlay.MAX_SCRAMBLE][MAX_PLACES];
|
|
93 |
private static String[][][] mTime = new String[RubikSize.LENGTH][RubikStatePlay.MAX_SCRAMBLE][MAX_PLACES];
|
|
92 | 94 |
|
93 | 95 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
94 | 96 |
|
... | ... | |
129 | 131 |
String country = row.substring(s5+1, s6); |
130 | 132 |
String realTime= String.valueOf(time/10.0f); |
131 | 133 |
|
132 |
if(level>=0 && level<RubikSurfaceView.MAX_SCRAMBLE && place>=0 && place<MAX_PLACES)
|
|
134 |
if(level>=0 && level<RubikStatePlay.MAX_SCRAMBLE && place>=0 && place<MAX_PLACES)
|
|
133 | 135 |
{ |
134 | 136 |
int resID = mResources.getIdentifier( country, "drawable", mPackageName); |
135 | 137 |
mCountry[size][level][place] = resID!=0 ? resID:R.drawable.unk; |
... | ... | |
250 | 252 |
|
251 | 253 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
252 | 254 |
|
253 |
void download(Receiver receiver, Resources resources, String packageName) |
|
255 |
public void download(Receiver receiver, Resources resources, String packageName)
|
|
254 | 256 |
{ |
255 | 257 |
mReceiver = receiver; |
256 | 258 |
mResources= resources; |
Also available in: Unified diff
Separate the States (and also Dialogues) into their own package.