Project

General

Profile

« Previous | Next » 

Revision 9eeb9c88

Added by Leszek Koltunski over 2 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/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