Project

General

Profile

« Previous | Next » 

Revision 7fe62d1f

Added by Leszek Koltunski about 2 years ago

Download the icons only once and save to local storage.

View differences:

src/main/java/org/distorted/external/RubikUpdates.java
21 21

  
22 22
import java.io.InputStream;
23 23
import java.util.ArrayList;
24

  
25
import android.content.Context;
24 26
import android.graphics.Bitmap;
25 27
import org.distorted.objects.RubikObjectList;
26 28

  
......
158 160

  
159 161
  public void updateDone(String shortName)
160 162
    {
161
    for( UpdateInfo info : mCompleted)
163
    for( UpdateInfo info : mCompleted )
162 164
      {
163 165
      if( info.mObjectShortName.equals(shortName) )
164 166
        {
......
198 200

  
199 201
///////////////////////////////////////////////////////////////////////////////////////////////////
200 202

  
201
  public Bitmap getCompletedIcon(int ordinal)
203
  public Bitmap getCompletedIcon(Context context, int ordinal)
202 204
    {
203
    return mCompleted.get(ordinal).mIcon;
205
    UpdateInfo info = mCompleted.get(ordinal);
206
    Bitmap bmp = info.mIcon;
207
    if( bmp!=null ) return bmp;
208

  
209
    RubikFiles files = RubikFiles.getInstance();
210
    bmp = files.getIcon(context,info.mObjectShortName+".png");
211
    info.mIcon = bmp;
212
    return bmp;
204 213
    }
205 214

  
206 215
///////////////////////////////////////////////////////////////////////////////////////////////////
207 216

  
208
  public Bitmap getStartedIcon(int ordinal)
217
  public Bitmap getStartedIcon(Context context, int ordinal)
209 218
    {
210
    return mStarted.get(ordinal).mIcon;
219
    UpdateInfo info = mStarted.get(ordinal);
220
    Bitmap bmp = info.mIcon;
221
    if( bmp!=null ) return bmp;
222

  
223
    RubikFiles files = RubikFiles.getInstance();
224
    bmp = files.getIcon(context,info.mObjectShortName+".png");
225
    info.mIcon = bmp;
226
    return bmp;
211 227
    }
212 228

  
213 229
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff