Project

General

Profile

« Previous | Next » 

Revision b92ad5cd

Added by Leszek Koltunski over 2 years ago

Download Update icons - progress.

View differences:

src/main/java/org/distorted/network/RubikUpdates.java
35 35
    public final int mObjectMinorVersion;
36 36
    public final int mExtrasMinorVersion;
37 37
    public final int mPercent;
38
    public final int mIconPresent;
38 39
    public final boolean mUpdateObject;
39 40
    public final boolean mUpdateExtras;
40 41
    public Bitmap mIcon;
41 42

  
42 43
    public UpdateInfo(String shortName, String longName, String description, int objectMinor,
43
                      int extrasMinor, int percent, boolean updateO, boolean updateE)
44
                      int extrasMinor, int percent, int iconPresent, boolean updateO, boolean updateE)
44 45
      {
45 46
      mObjectShortName    = shortName;
46 47
      mObjectLongName     = longName;
......
48 49
      mObjectMinorVersion = objectMinor;
49 50
      mExtrasMinorVersion = extrasMinor;
50 51
      mPercent            = percent;
52
      mIconPresent        = iconPresent;
51 53
      mUpdateObject       = updateO;
52 54
      mUpdateExtras       = updateE;
53 55

  
......
89 91
    String objMinor    = elements[1].trim();
90 92
    String extMinor    = elements[2].trim();
91 93
    String percent     = elements[3].trim();
92
    String longName    = elements[4];
93
    String description = elements[5];
94
    int oMinor, eMinor, oPercent;
94
    String iconPresent = elements[4].trim();
95
    String longName    = elements[5];
96
    String description = elements[6];
97
    int oMinor, eMinor, oPercent, oIcon;
95 98

  
96 99
    try { oMinor = Integer.parseInt(objMinor); }
97 100
    catch (NumberFormatException ex) { oMinor = -1; }
......
99 102
    catch (NumberFormatException ex) { eMinor = -1; }
100 103
    try { oPercent = Integer.parseInt(percent); }
101 104
    catch (NumberFormatException ex) { oPercent = -1; }
105
    try { oIcon = Integer.parseInt(iconPresent); }
106
    catch (NumberFormatException ex) { oIcon = 0; }
102 107

  
103 108
    if( oMinor>=0 && eMinor>=0 && oPercent>=0 )
104 109
      {
......
114 119
        }
115 120
      if( updateO || updateE )
116 121
        {
117
        UpdateInfo info = new UpdateInfo(shortName,longName,description,oMinor,eMinor,oPercent,updateO,updateE);
122
        UpdateInfo info = new UpdateInfo(shortName,longName,description,oMinor,eMinor,oPercent,oIcon,updateO,updateE);
118 123
        if(oPercent>=100) mCompleted.add(info);
119 124
        else              mStarted.add(info);
120 125
        }
......
141 146
      for(int line=1; line<numLines; line++)
142 147
        {
143 148
        String[] elements = lines[line].split(",");
144
        if( elements.length>=6 ) parseLine(elements);
149
        if( elements.length>=7 ) parseLine(elements);
145 150
        }
146 151
      }
147 152
    }
......
202 207
    return mStarted.get(ordinal).mIcon;
203 208
    }
204 209

  
210
///////////////////////////////////////////////////////////////////////////////////////////////////
211

  
212
  public int getCompletedIconPresent(int ordinal)
213
    {
214
    return mCompleted.get(ordinal).mIconPresent;
215
    }
216

  
217
///////////////////////////////////////////////////////////////////////////////////////////////////
218

  
219
  public int getStartedIconPresent(int ordinal)
220
    {
221
    return mStarted.get(ordinal).mIconPresent;
222
    }
223

  
205 224
///////////////////////////////////////////////////////////////////////////////////////////////////
206 225

  
207 226
  public String getCompletedURL(int ordinal)

Also available in: Unified diff