Project

General

Profile

« Previous | Next » 

Revision 2dfe43d3

Added by Leszek Koltunski almost 5 years ago

Bugfix for downloading High Scores.

View differences:

src/main/java/org/distorted/dialog/RubikDialogScoresView.java
94 94

  
95 95
    int white = res.getColor(R.color.white);
96 96
    int red   = res.getColor(R.color.red);
97
    boolean equals;
97 98

  
98 99
    for(int j=0; j<MAX_PLACES-1; j++)
99 100
      {
......
106 107
          level.addView(row);
107 108
          }
108 109

  
109
        theirCountryID = res.getIdentifier( country[j], "drawable", packageName);
110
        theirTime = Float.toString(time[j]);
111
        View row = createRow(act, theirCountryID, name[j], theirTime, name[j].equals(myName) ? red:white);
112
        level.addView(row);
110
        equals = name[j].equals(myName);
111

  
112
        if( !inserted || !equals )
113
          {
114
          if( equals ) inserted=true;
115
          theirCountryID = res.getIdentifier( country[j], "drawable", packageName);
116
          theirTime = Float.toString(time[j]);
117
          View row = createRow(act, theirCountryID, name[j], theirTime, equals ? red:white);
118
          level.addView(row);
119
          }
113 120
        }
114 121
      }
115 122

  
src/main/java/org/distorted/scores/RubikScoresDownloader.java
165 165

  
166 166
      if( object>=0 && object<mTotal )
167 167
        {
168
        int level      = Integer.parseInt( row.substring(s1+1,s2) );
168
        int scramble   = Integer.parseInt( row.substring(s1+1,s2) );
169 169
        String name    = row.substring(s2+1, s3);
170 170
        int time       = Integer.parseInt( row.substring(s3+1,s4) );
171 171
        String country = row.substring(s4+1, s5);
172 172

  
173
        if(level>0 && level<=MAX_SCRAMBLE)
173
        if(scramble>=0 && scramble<MAX_SCRAMBLE)
174 174
          {
175
          int p = mPlaces[object][level];
176
          mPlaces[object][level]++;
175
          int p = mPlaces[object][scramble];
176
          mPlaces[object][scramble]++;
177 177

  
178
          mCountry[object][level-1][p] = country;
179
          mName   [object][level-1][p] = name;
180
          mTime   [object][level-1][p] = ((float)(time/100))/10.0f;
178
          mCountry[object][scramble][p] = country;
179
          mName   [object][scramble][p] = name;
180
          mTime   [object][scramble][p] = ((float)(time/100))/10.0f;
181 181
          }
182 182
        }
183 183
      }

Also available in: Unified diff