Project

General

Profile

« Previous | Next » 

Revision a8be1a23

Added by Leszek Koltunski almost 2 years ago

Close assets after use.

View differences:

src/main/java/org/distorted/bandaged/BandagedCreatorActivity.java
276 276
      {
277 277
      RubikFiles files = RubikFiles.getInstance();
278 278
      InputStream jsonStream = files.openFile(this,name+"_object.json");
279
      InitAssets assets = new InitAssets(jsonStream);
279
      InitAssets assets = new InitAssets(jsonStream,null);
280 280

  
281 281
      if( !assets.noJsonStream() )
282 282
        {
283
        int meshState= TwistyObject.MESH_NICE;
284
        int iconMode = TwistyObject.MODE_NORM;
285
        SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
286
        SharedPreferences.Editor editor = preferences.edit();
287
        TwistyObject object = new TwistyJson( meshState, iconMode, null, null, 1.0f, assets);
288
        if( !object.getError() ) object.removePreferences(editor);
289
        editor.apply();
283
        TwistyObject object = new TwistyJson( TwistyObject.MESH_NICE, TwistyObject.MODE_NORM, null, null, 1.0f, assets);
284

  
285
        if( !object.getError() )
286
          {
287
          SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
288
          SharedPreferences.Editor editor = preferences.edit();
289
          object.removePreferences(editor);
290
          editor.apply();
291
          }
290 292
        }
291 293

  
292 294
      mScreen.deleteObject(this,name);
src/main/java/org/distorted/bandaged/BandagedPlayActivity.java
241 241
      int meshState          = TwistyObject.MESH_NICE;
242 242
      int iconMode           = TwistyObject.MODE_NORM;
243 243
      InputStream jsonStream = files.openFile(this,name+"_object.json");
244
      InputStream meshStream = null;
244
      InitAssets asset       = new InitAssets(jsonStream,null);
245 245
      int ordinal            = 0; // if jsonStream!=null, this doesn't matter
246
      InitAssets asset       = new InitAssets(jsonStream,meshStream);
247 246

  
248 247
      control.changeIfDifferent(ordinal,name,meshState,iconMode,asset);
249 248
      }

Also available in: Unified diff