Project

General

Profile

« Previous | Next » 

Revision 9eeb9c88

Added by Leszek Koltunski almost 3 years ago

Make sure we always display some icon in the Popup dialog, even if we fail to download one (improvement)

View differences:

src/main/java/org/distorted/main/RubikActivity.java
65 65

  
66 66
public class RubikActivity extends AppCompatActivity
67 67
{
68
    public static final boolean SHOW_DOWNLOADED_DEBUG = false;
68
    public static final boolean SHOW_DOWNLOADED_DEBUG = true;
69 69

  
70 70
    public static final float PADDING             = 0.01f;
71 71
    public static final float SMALL_MARGIN        = 0.004f;
src/main/java/org/distorted/objects/RubikObject.java
102 102
    mMeshID        =  0;
103 103
    mJsonID        = -1;
104 104
    mExtrasID      = -1;
105

  
106
    if( object.icon )  // icon successfully downloaded
107
      {
108
      if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", object.shortName+" : icon downloaded");
109
      mIconID = -1;  // i.e. look for the icon in local per-app storage
110
      }
111
    else
112
      {
113
      if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", object.shortName+" : icon failed to download");
114
      mIconID = R.drawable.unknown_icon;
115
      }
105
    mIconID        = -1;
116 106
    }
117 107

  
118 108
///////////////////////////////////////////////////////////////////////////////////////////////////
......
156 146
      {
157 147
      RubikFiles files = RubikFiles.getInstance();
158 148
      Bitmap bmp = files.getIcon(act,mLowerName+".png");
159
      mStaticIconD = new BitmapDrawable(act.getResources(), bmp);
149
      if( bmp==null ) mStaticIconD = act.getDrawable(R.drawable.unknown_icon);
150
      else            mStaticIconD = new BitmapDrawable(act.getResources(), bmp);
160 151
      }
161 152
    }
162 153

  
......
172 163
      {
173 164
      RubikFiles files = RubikFiles.getInstance();
174 165
      Bitmap bmp = files.getIcon(act,mLowerName+".png");
175
      mRescaledIconD = new BitmapDrawable(act.getResources(), bmp);
166
      if( bmp==null ) mRescaledIconD = act.getDrawable(R.drawable.unknown_icon);
167
      else            mRescaledIconD = new BitmapDrawable(act.getResources(), bmp);
176 168
      }
177 169
    }
178 170

  

Also available in: Unified diff