Project

General

Profile

« Previous | Next » 

Revision 707f79ff

Added by Leszek Koltunski over 2 years ago

Actually remove preferences of a deleted bandaged cube in a safe way.

View differences:

src/main/java/org/distorted/bandaged/BandagedCreatorActivity.java
19 19

  
20 20
package org.distorted.bandaged;
21 21

  
22
import java.io.InputStream;
23

  
22 24
import android.content.Intent;
23 25
import android.content.SharedPreferences;
24 26
import android.graphics.Bitmap;
......
40 42
import org.distorted.library.main.DistortedLibrary;
41 43
import org.distorted.main.R;
42 44
import org.distorted.main.RubikActivity;
45
import org.distorted.objectlib.main.TwistyJson;
46
import org.distorted.objectlib.main.TwistyObject;
43 47

  
44 48
///////////////////////////////////////////////////////////////////////////////////////////////////
45 49

  
......
266 270

  
267 271
    public void deleteObject(String name)
268 272
      {
269
      mScreen.deleteObject(this,name);
270

  
271 273
      RubikFiles files = RubikFiles.getInstance();
272
      files.deleteIcon(this,name);
273
      files.deleteJsonObject(this,name);
274

  
275
      /*
276 274
      SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
277 275
      SharedPreferences.Editor editor = preferences.edit();
278
      // TODO: remove the cubit quats
276

  
277
      int meshState          = TwistyObject.MESH_NICE;
278
      int iconMode           = TwistyObject.MODE_NORM;
279
      InputStream jsonStream = files.openFile(this,name+"_object.json");
280
      TwistyObject object = new TwistyJson( jsonStream, meshState, iconMode, null, null, 1.0f, null);
281
      object.removePreferences(editor);
282

  
279 283
      editor.apply();
280
      */
284

  
285
      mScreen.deleteObject(this,name);
286
      files.deleteIcon(this,name);
287
      files.deleteJsonObject(this,name);
281 288
      }
282 289

  
283 290
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff