Project

General

Profile

« Previous | Next » 

Revision 43c2812a

Added by Leszek Koltunski almost 3 years ago

Downloaded Objects: bugfixes

View differences:

src/main/java/org/distorted/dialogs/RubikDialogUpdateView.java
165 165
        android.util.Log.e("D", "Saving JSON "+name+" to a file "+oSuccess);
166 166

  
167 167
        JsonReader reader = JsonReader.getInstance();
168
        reader.parseJsonFileMetadata(act,name);
169
        mInfo.mNumScrambles = reader.getNumScrambles();
168
        mInfo.mNumScrambles = reader.readNumScrambles(act,name);
170 169

  
171 170
        android.util.Log.e("D", "Read from JSON numScrambles="+mInfo.mNumScrambles);
172 171
        }
src/main/java/org/distorted/main/RubikActivity.java
43 43
import com.google.firebase.analytics.FirebaseAnalytics;
44 44

  
45 45
import org.distorted.config.ConfigActivity;
46
import org.distorted.dmesh.ObjectMesh;
47
import org.distorted.jsons.ObjectJson;
48 46
import org.distorted.library.main.DistortedLibrary;
49 47

  
50 48
import org.distorted.objectlib.main.ObjectControl;
src/main/java/org/distorted/objects/RubikObject.java
51 51
  private int mNumScramble;
52 52
  private int mMeshState;
53 53
  private int mExtrasOrdinal;
54
  private Drawable mIconD;
54
  private Drawable mStaticIconD, mRescaledIconD;
55 55

  
56 56
///////////////////////////////////////////////////////////////////////////////////////////////////
57 57

  
......
77 77
    mObjectMinor = JsonWriter.VERSION_OBJECT_MINOR;
78 78
    mExtrasMinor = JsonWriter.VERSION_EXTRAS_MINOR;
79 79

  
80
    mIconD = null;
80
    mStaticIconD  = null;
81
    mRescaledIconD= null;
81 82
    }
82 83

  
83 84
///////////////////////////////////////////////////////////////////////////////////////////////////
......
86 87
    {
87 88
    android.util.Log.e("D", "new downloaded RubikObject "+object.shortName+" added");
88 89

  
89

  
90 90
    mLowerName     = object.shortName;
91 91
    mUpperName     = object.shortName.toUpperCase();
92 92
    mNumScramble   = object.numScrambles;
......
134 134

  
135 135
///////////////////////////////////////////////////////////////////////////////////////////////////
136 136

  
137
  private void createIconDrawable(Activity act)
137
  private void createStaticIconDrawable(Activity act)
138
    {
139
    if( mIconID>0 )
140
      {
141
      mStaticIconD = act.getDrawable(mIconID);
142
      }
143
    else
144
      {
145
      RubikFiles files = RubikFiles.getInstance();
146
      Bitmap bmp = files.getIcon(act,mLowerName+".png");
147
      mStaticIconD = new BitmapDrawable(act.getResources(), bmp);
148
      }
149
    }
150

  
151
///////////////////////////////////////////////////////////////////////////////////////////////////
152

  
153
  private void createRescaledIconDrawable(Activity act)
138 154
    {
139 155
    if( mIconID>0 )
140 156
      {
141
      mIconD = act.getDrawable(mIconID);
157
      mRescaledIconD = act.getDrawable(mIconID);
142 158
      }
143 159
    else
144 160
      {
145 161
      RubikFiles files = RubikFiles.getInstance();
146 162
      Bitmap bmp = files.getIcon(act,mLowerName+".png");
147
      mIconD = new BitmapDrawable(act.getResources(), bmp);
163
      mRescaledIconD = new BitmapDrawable(act.getResources(), bmp);
148 164
      }
149 165
    }
150 166

  
......
216 232

  
217 233
  public void setIconTo(Activity act,ImageButton button)
218 234
    {
219
    if( mIconD==null ) createIconDrawable(act);
220
    button.setBackground(mIconD);
235
    if( mStaticIconD==null ) createStaticIconDrawable(act);
236
    button.setBackground(mStaticIconD);
221 237
    }
222 238

  
223 239
///////////////////////////////////////////////////////////////////////////////////////////////////
224 240

  
225 241
  public void setIconTo(Activity act,ImageView view)
226 242
    {
227
    if( mIconD==null ) createIconDrawable(act);
228
    view.setImageDrawable(mIconD);
243
    if( mRescaledIconD==null ) createRescaledIconDrawable(act);
244
    view.setImageDrawable(mRescaledIconD);
229 245
    }
230 246

  
231 247
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff