Project

General

Profile

Download (22.8 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / main / RubikActivity.java @ 296219b4

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is proprietary software licensed under an EULA which you should have received      //
7
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html        //
8
///////////////////////////////////////////////////////////////////////////////////////////////////
9

    
10
package org.distorted.main;
11

    
12
import java.io.InputStream;
13
import java.util.Locale;
14

    
15
import android.content.Intent;
16
import android.content.SharedPreferences;
17
import android.content.pm.PackageInfo;
18
import android.content.pm.PackageManager;
19
import android.os.Build;
20
import android.os.Bundle;
21
import android.os.LocaleList;
22
import android.preference.PreferenceManager;
23

    
24
import android.util.DisplayMetrics;
25
import android.view.DisplayCutout;
26
import android.view.View;
27
import android.view.ViewGroup;
28
import android.view.WindowManager;
29
import android.widget.LinearLayout;
30

    
31
import androidx.appcompat.app.AppCompatActivity;
32

    
33
import com.google.firebase.analytics.FirebaseAnalytics;
34
import com.google.firebase.inappmessaging.FirebaseInAppMessaging;
35

    
36
import org.distorted.config.ConfigActivity;
37
import org.distorted.bandaged.BandagedCreatorActivity;
38
import org.distorted.library.main.DistortedLibrary;
39

    
40
import org.distorted.messaging.RubikInAppMessanging;
41
import org.distorted.objectlib.main.ObjectControl;
42
import org.distorted.objectlib.main.TwistyObject;
43
import org.distorted.objectlib.effects.BaseEffect;
44

    
45
import org.distorted.dialogs.RubikDialogError;
46
import org.distorted.dialogs.RubikDialogPrivacy;
47
import org.distorted.external.RubikScores;
48
import org.distorted.external.RubikNetwork;
49
import org.distorted.objects.RubikObject;
50
import org.distorted.objects.RubikObjectList;
51
import org.distorted.screens.RubikScreenSolving;
52
import org.distorted.screens.ScreenList;
53
import org.distorted.screens.RubikScreenPlay;
54
import org.distorted.tutorials.TutorialActivity;
55

    
56
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE;
57

    
58
///////////////////////////////////////////////////////////////////////////////////////////////////
59

    
60
public class RubikActivity extends AppCompatActivity
61
{
62
    public static final boolean SHOW_DOWNLOADED_DEBUG = false;
63

    
64
    public static final float PADDING             = 0.01f;
65
    public static final float SMALL_MARGIN        = 0.004f;
66
    public static final float MEDIUM_MARGIN       = 0.015f;
67
    public static final float LARGE_MARGIN        = 0.025f;
68
    public static final float BUTTON_TEXT_SIZE    = 0.05f;
69
    public static final float TITLE_TEXT_SIZE     = 0.06f;
70
    public static final float SOLVER_BMP_H_SIZE   = 0.11f;
71
    public static final float SOLVER_BMP_V_SIZE   = 0.06f;
72
    public static final float PATTERN_GROUP_TEXT  = 0.03f;
73
    public static final float PATTERN_CHILD_TEXT  = 0.02f;
74
    public static final float SCORES_LEVEL_TEXT   = 0.035f;
75
    public static final float SCORES_ITEM_TEXT    = 0.030f;
76
    public static final float TUTORIAL_ITEM_TEXT  = 0.100f;
77
    public static final float DIALOG_BUTTON_SIZE  = 0.06f;
78
    public static final float MENU_BIG_TEXT_SIZE  = 0.05f;
79
    public static final float MENU_MAIN_TEXT_SIZE = 0.047f;
80
    public static final float MENU_MED_TEXT_SIZE  = 0.04f;
81
    public static final float MENU_SMALL_TEXT_SIZE= 0.035f;
82
    public static final float TAB_WIDTH           = 0.100f;
83
    public static final float TAB_HEIGHT          = 0.100f;
84
    public static final float MENU_BUTTON_HEIGHT  = 0.120f;
85

    
86
    public static final int FLAGS =  View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
87
                                   | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
88
                                   | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
89
                                   | View.SYSTEM_UI_FLAG_FULLSCREEN
90
                                   | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
91

    
92
    private static final int ACTIVITY_NUMBER = 0;
93
    private static final float RATIO_BAR  = 0.10f;
94
    private static final float RATIO_INSET= 0.09f;
95

    
96
    private static final String KEY_PLAY = "movesController_play";
97
    private static final String KEY_SOLV = "movesController_solv";
98

    
99
    private boolean mJustStarted;
100
    private FirebaseAnalytics mFirebaseAnalytics;
101
    private static int mScreenWidth, mScreenHeight;
102
    private boolean mPolicyAccepted, mIsChinese;
103
    private int mCurrentApiVersion;
104
    private int mHeightUpperBar, mHeightLowerBar;
105

    
106
///////////////////////////////////////////////////////////////////////////////////////////////////
107

    
108
    @Override
109
    protected void onCreate(Bundle savedState)
110
      {
111
      super.onCreate(savedState);
112
      DistortedLibrary.onCreate(ACTIVITY_NUMBER);
113

    
114
      setTheme(R.style.MaterialThemeNoActionBar);
115
      setContentView(R.layout.main);
116

    
117
      mJustStarted = true;
118
      mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
119
      mIsChinese = localeIsChinese();
120

    
121
      DisplayMetrics displaymetrics = new DisplayMetrics();
122
      getWindowManager().getDefaultDisplay().getRealMetrics(displaymetrics);
123
      mScreenWidth =displaymetrics.widthPixels;
124
      mScreenHeight=displaymetrics.heightPixels;
125

    
126
      hideNavigationBar();
127
      cutoutHack();
128
      computeBarHeights();
129

    
130
      RubikInAppMessanging listener = new RubikInAppMessanging();
131
      FirebaseInAppMessaging.getInstance().addClickListener(listener);
132
      }
133

    
134
///////////////////////////////////////////////////////////////////////////////////////////////////
135
// this does not include possible insets
136

    
137
    private void computeBarHeights()
138
      {
139
      int barHeight = (int)(mScreenHeight*RATIO_BAR);
140
      mHeightLowerBar = barHeight;
141
      mHeightUpperBar = barHeight;
142

    
143
      LinearLayout layoutTop = findViewById(R.id.upperBar);
144
      LinearLayout layoutBot = findViewById(R.id.lowerBar);
145

    
146
      ViewGroup.LayoutParams paramsTop = layoutTop.getLayoutParams();
147
      paramsTop.height = mHeightUpperBar;
148
      layoutTop.setLayoutParams(paramsTop);
149
      ViewGroup.LayoutParams paramsBot = layoutBot.getLayoutParams();
150
      paramsBot.height = mHeightLowerBar;
151
      layoutBot.setLayoutParams(paramsBot);
152
      }
153

    
154
///////////////////////////////////////////////////////////////////////////////////////////////////
155

    
156
    private void hideNavigationBar()
157
      {
158
      mCurrentApiVersion = Build.VERSION.SDK_INT;
159

    
160
      if(mCurrentApiVersion >= Build.VERSION_CODES.KITKAT)
161
        {
162
        final View decorView = getWindow().getDecorView();
163

    
164
        decorView.setSystemUiVisibility(FLAGS);
165

    
166
        decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener()
167
          {
168
          @Override
169
          public void onSystemUiVisibilityChange(int visibility)
170
            {
171
            if((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0)
172
              {
173
              decorView.setSystemUiVisibility(FLAGS);
174
              }
175
            }
176
          });
177
        }
178
      }
179

    
180
///////////////////////////////////////////////////////////////////////////////////////////////////
181

    
182
    @Override
183
    public void onAttachedToWindow()
184
      {
185
      super.onAttachedToWindow();
186

    
187
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
188
        {
189
        DisplayCutout cutout = getWindow().getDecorView().getRootWindowInsets().getDisplayCutout();
190
        int insetHeight = cutout!=null ? cutout.getSafeInsetTop() : 0;
191

    
192
        LinearLayout layoutHid = findViewById(R.id.hiddenBar);
193
        ViewGroup.LayoutParams paramsHid = layoutHid.getLayoutParams();
194
        paramsHid.height = (int)(insetHeight*RATIO_INSET);
195
        layoutHid.setLayoutParams(paramsHid);
196
        mHeightUpperBar += paramsHid.height;
197
        }
198
      }
199

    
200
///////////////////////////////////////////////////////////////////////////////////////////////////
201
// do not avoid cutouts
202

    
203
    private void cutoutHack()
204
      {
205
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
206
        {
207
        getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
208
        }
209
      }
210

    
211
///////////////////////////////////////////////////////////////////////////////////////////////////
212

    
213
    @Override
214
    public void onWindowFocusChanged(boolean hasFocus)
215
      {
216
      super.onWindowFocusChanged(hasFocus);
217

    
218
      if(mCurrentApiVersion >= Build.VERSION_CODES.KITKAT && hasFocus)
219
        {
220
        getWindow().getDecorView().setSystemUiVisibility(FLAGS);
221
        }
222
      }
223

    
224
///////////////////////////////////////////////////////////////////////////////////////////////////
225
    
226
    @Override
227
    protected void onPause() 
228
      {
229
      super.onPause();
230
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
231
      view.onPause();
232
      DistortedLibrary.onPause(ACTIVITY_NUMBER);
233
      RubikNetwork.onPause();
234
      savePreferences();
235
      }
236

    
237
///////////////////////////////////////////////////////////////////////////////////////////////////
238
    
239
    @Override
240
    protected void onResume() 
241
      {
242
      super.onResume();
243
      DistortedLibrary.onResume(ACTIVITY_NUMBER);
244
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
245
      view.onResume();
246
      restorePreferences();
247

    
248
      ScreenList.setScreen(this);
249
      unblockEverything();
250

    
251
      restoreMoves();
252

    
253
      if( mJustStarted )
254
        {
255
        mJustStarted = false;
256
        RubikScores scores = RubikScores.getInstance();
257
        scores.incrementNumRuns();
258
        scores.setCountry(this);
259
        SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
260
        RubikObjectList.restoreMeshState(preferences);
261
        }
262

    
263
      int object = RubikObjectList.getCurrObject();
264
      changeIfDifferent(object,view.getObjectControl());
265

    
266
      if( mIsChinese && !mPolicyAccepted ) PrivacyPolicy();
267
      }
268
    
269
///////////////////////////////////////////////////////////////////////////////////////////////////
270
    
271
    @Override
272
    protected void onDestroy() 
273
      {
274
      DistortedLibrary.onDestroy(ACTIVITY_NUMBER);
275
      super.onDestroy();
276
      }
277

    
278
///////////////////////////////////////////////////////////////////////////////////////////////////
279

    
280
    private String getAppVers()
281
      {
282
      try
283
        {
284
        PackageInfo pInfo = getPackageManager().getPackageInfo( getPackageName(), 0);
285
        return pInfo.versionName;
286
        }
287
      catch (PackageManager.NameNotFoundException e)
288
        {
289
        return "unknown";
290
        }
291
      }
292

    
293
///////////////////////////////////////////////////////////////////////////////////////////////////
294

    
295
    private void savePreferences()
296
      {
297
      SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
298
      SharedPreferences.Editor editor = preferences.edit();
299

    
300
      editor.putBoolean("policyAccepted", mPolicyAccepted);
301
      editor.putString("appVersion", getAppVers() );
302

    
303
      for (int i=0; i<BaseEffect.Type.LENGTH; i++)
304
        {
305
        BaseEffect.Type.getType(i).savePreferences(editor);
306
        }
307

    
308
      for (int i = 0; i< ScreenList.LENGTH; i++)
309
        {
310
        ScreenList.getScreen(i).getScreenClass().savePreferences(editor);
311
        }
312

    
313
      RubikObjectList.savePreferences(editor);
314
      RubikObjectList.saveMeshState(editor);
315
      ScreenList.savePreferences(editor);
316
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
317
      view.getObjectControl().savePreferences(editor);
318

    
319
      ScreenList curr = ScreenList.getCurrentScreen();
320

    
321
      if( curr==ScreenList.PLAY )
322
        {
323
        RubikScreenPlay play = (RubikScreenPlay)ScreenList.PLAY.getScreenClass();
324
        play.saveMovePreferences(KEY_PLAY,editor);
325
        }
326
      if( curr==ScreenList.SOLV )
327
        {
328
        RubikScreenSolving solv = (RubikScreenSolving)ScreenList.SOLV.getScreenClass();
329
        solv.saveMovePreferences(KEY_SOLV,editor);
330
        }
331

    
332
      editor.apply();
333
      }
334

    
335
///////////////////////////////////////////////////////////////////////////////////////////////////
336

    
337
    private void restorePreferences()
338
      {
339
      SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
340

    
341
      mPolicyAccepted = preferences.getBoolean("policyAccepted", false);
342
      String oldVersion = preferences.getString("appVersion","");
343

    
344
      RubikObjectList.restorePreferences(this,preferences);
345

    
346
      for (int i=0; i<BaseEffect.Type.LENGTH; i++)
347
        {
348
        BaseEffect.Type.getType(i).restorePreferences(preferences);
349
        }
350

    
351
      for (int i=0; i<ScreenList.LENGTH; i++)
352
        {
353
        ScreenList.getScreen(i).getScreenClass().restorePreferences(preferences);
354
        }
355

    
356
      ScreenList.restorePreferences(preferences);
357
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
358

    
359
      // Versions <= 1.8.6 did not save their 'appVersion' to preferences, therefore in their
360
      // case the 'mOldVersion' - version of the app which saved the preferences on the last
361
      // go - is empty.
362
      // Between versions 1.8.6 and 1.9.0, the order of the cubits in TwistyCube has changed.
363
      // If someone has scrambled the cube with v. 1.8.6, then upgraded to 1.9.0 and re-started
364
      // the app, because of the different order of the cubits - his cube would be messed up.
365
      // So in such case, i.e. on fresh upgrade from version<=1.8.6 to version>=1.9.0, do not
366
      // restore the object scrambling.
367

    
368
      if( !oldVersion.equals("") )
369
        {
370
        view.getObjectControl().restorePreferences(preferences);
371
        }
372

    
373
      RubikScores scores = RubikScores.getInstance();
374

    
375
      if( scores.isVerified() )
376
        {
377
        FirebaseAnalytics analytics = getAnalytics();
378
        analytics.setUserId(scores.getName());
379
        }
380
      }
381

    
382
///////////////////////////////////////////////////////////////////////////////////////////////////
383

    
384
    private void restoreMoves()
385
      {
386
      SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
387
      ScreenList curr = ScreenList.getCurrentScreen();
388

    
389
      if( curr==ScreenList.PLAY )
390
        {
391
        RubikScreenPlay play = (RubikScreenPlay)ScreenList.PLAY.getScreenClass();
392
        play.restoreMovePreferences(this,KEY_PLAY,preferences);
393
        }
394
      if( curr==ScreenList.SOLV )
395
        {
396
        RubikScreenSolving solv = (RubikScreenSolving)ScreenList.SOLV.getScreenClass();
397
        solv.restoreMovePreferences(this,KEY_SOLV,preferences);
398
        }
399
      }
400

    
401
///////////////////////////////////////////////////////////////////////////////////////////////////
402

    
403
    private void PrivacyPolicy()
404
      {
405
      RubikDialogPrivacy priDiag = new RubikDialogPrivacy();
406
      priDiag.show(getSupportFragmentManager(), null);
407
      }
408

    
409
///////////////////////////////////////////////////////////////////////////////////////////////////
410

    
411
    void OpenGLError()
412
      {
413
      RubikDialogError errDiag = new RubikDialogError();
414
      errDiag.show(getSupportFragmentManager(), null);
415
      }
416

    
417
///////////////////////////////////////////////////////////////////////////////////////////////////
418
// PUBLIC API
419
///////////////////////////////////////////////////////////////////////////////////////////////////
420

    
421
    public FirebaseAnalytics getAnalytics()
422
      {
423
      return mFirebaseAnalytics;
424
      }
425

    
426
///////////////////////////////////////////////////////////////////////////////////////////////////
427

    
428
    public int getHeightUpperBar()
429
      {
430
      return mHeightUpperBar;
431
      }
432

    
433
///////////////////////////////////////////////////////////////////////////////////////////////////
434

    
435
    public int getHeightLowerBar()
436
      {
437
      return mHeightLowerBar;
438
      }
439

    
440
///////////////////////////////////////////////////////////////////////////////////////////////////
441

    
442
    public TwistyObject getObject()
443
      {
444
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
445
      return view.getObjectControl().getObject();
446
      }
447

    
448
///////////////////////////////////////////////////////////////////////////////////////////////////
449

    
450
    public ObjectControl getControl()
451
      {
452
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
453
      return view.getObjectControl();
454
      }
455

    
456
///////////////////////////////////////////////////////////////////////////////////////////////////
457

    
458
    public int getScreenWidthInPixels()
459
      {
460
      return mScreenWidth;
461
      }
462

    
463
///////////////////////////////////////////////////////////////////////////////////////////////////
464

    
465
    public int getScreenHeightInPixels()
466
      {
467
      return mScreenHeight;
468
      }
469

    
470
///////////////////////////////////////////////////////////////////////////////////////////////////
471

    
472
    public void changeObject(int newObject, boolean reportChange)
473
      {
474
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
475
      ObjectControl control = view.getObjectControl();
476
      TwistyObject oldObject = control.getObject();
477
      changeIfDifferent(newObject,control);
478

    
479
      if( reportChange && oldObject!=null )
480
        {
481
        RubikObject robject = RubikObjectList.getObject(newObject);
482
        String newName = robject==null ? "NULL" : robject.getUpperName();
483
        float fps = view.getRenderer().getFPS();
484
        fps = (int)(fps+0.5f);
485
        StringBuilder name = new StringBuilder();
486
        name.append(oldObject.getShortName());
487
        name.append(' ');
488
        name.append(fps);
489
        name.append(" --> ");
490
        name.append(newName);
491

    
492
        if( BuildConfig.DEBUG )
493
          {
494
          android.util.Log.e("rubik", name.toString());
495
          }
496
        else
497
          {
498
          FirebaseAnalytics analytics = getAnalytics();
499

    
500
          if( analytics!=null )
501
            {
502
            Bundle bundle = new Bundle();
503
            bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, name.toString());
504
            analytics.logEvent(FirebaseAnalytics.Event.SELECT_ITEM, bundle);
505
            }
506
          }
507
        }
508
      }
509

    
510
///////////////////////////////////////////////////////////////////////////////////////////////////
511

    
512
    public void changeIfDifferent(int ordinal, ObjectControl control)
513
      {
514
      RubikObject object = RubikObjectList.getObject(ordinal);
515
      int meshState = object!=null ? object.getMeshState() : MESH_NICE;
516
      int iconMode  = TwistyObject.MODE_NORM;
517
      InputStream jsonStream = object==null ? null : object.getObjectStream(this);
518
      InputStream meshStream = object==null ? null : object.getMeshStream(this);
519
      String name = object==null ? "NULL" : object.getUpperName();
520

    
521
      control.changeIfDifferent(ordinal,name,meshState,iconMode,jsonStream,meshStream);
522
      }
523

    
524
///////////////////////////////////////////////////////////////////////////////////////////////////
525

    
526
    public static int getDrawableSize()
527
      {
528
      if( mScreenHeight<1000 )
529
        {
530
        return 0;
531
        }
532
      if( mScreenHeight<1600 )
533
        {
534
        return 1;
535
        }
536
      if( mScreenHeight<1900 )
537
        {
538
        return 2;
539
        }
540

    
541
      return 3;
542
      }
543

    
544
///////////////////////////////////////////////////////////////////////////////////////////////////
545

    
546
    public static int getDrawable(int small, int medium, int big, int huge)
547
      {
548
      int size = getDrawableSize();
549

    
550
      switch(size)
551
        {
552
        case 0 : return small;
553
        case 1 : return medium;
554
        case 2 : return big;
555
        default: return huge;
556
        }
557
      }
558

    
559
///////////////////////////////////////////////////////////////////////////////////////////////////
560

    
561
    public void acceptPrivacy()
562
      {
563
      mPolicyAccepted = true;
564
      }
565

    
566
///////////////////////////////////////////////////////////////////////////////////////////////////
567

    
568
    public void declinePrivacy()
569
      {
570
      finish();
571
      }
572

    
573
///////////////////////////////////////////////////////////////////////////////////////////////////
574

    
575
    public static boolean localeIsChinese()
576
      {
577
      String language;
578

    
579
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
580
        {
581
        language= LocaleList.getDefault().get(0).getLanguage();
582
        }
583
      else
584
        {
585
        language= Locale.getDefault().getLanguage();
586
        }
587

    
588
      return language.equals("zh");
589
      }
590

    
591
///////////////////////////////////////////////////////////////////////////////////////////////////
592

    
593
    public boolean isVertical()
594
      {
595
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
596
      return view.isVertical();
597
      }
598

    
599
///////////////////////////////////////////////////////////////////////////////////////////////////
600

    
601
    public void blockEverything(int place)
602
      {
603
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
604
      ObjectControl control = view.getObjectControl();
605
      control.blockEverything(place);
606

    
607
      RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
608
      play.setLockState(this);
609
      }
610

    
611
///////////////////////////////////////////////////////////////////////////////////////////////////
612

    
613
    public void unblockEverything()
614
      {
615
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
616
      ObjectControl control = view.getObjectControl();
617
      control.unblockEverything();
618

    
619
      RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
620
      play.setLockState(this);
621
      }
622

    
623
///////////////////////////////////////////////////////////////////////////////////////////////////
624

    
625
    public void switchTutorial(String url, int objectOrdinal)
626
      {
627
      Intent intent = new Intent(this, TutorialActivity.class);
628
      intent.putExtra("url", url);
629
      intent.putExtra("obj", objectOrdinal);
630
      startActivity(intent);
631
      }
632

    
633
///////////////////////////////////////////////////////////////////////////////////////////////////
634

    
635
    public void switchConfig(int objectOrdinal)
636
      {
637
      Intent intent = new Intent(this, ConfigActivity.class);
638
      intent.putExtra("obj", objectOrdinal);
639
      startActivity(intent);
640
      }
641

    
642
///////////////////////////////////////////////////////////////////////////////////////////////////
643

    
644
    public void switchToBandagedCreator()
645
      {
646
      Intent intent = new Intent(this, BandagedCreatorActivity.class);
647
      startActivity(intent);
648
      }
649

    
650
///////////////////////////////////////////////////////////////////////////////////////////////////
651

    
652
    public void reloadObject(String shortName)
653
      {
654
      TwistyObject currObject = getObject();
655
      String name = currObject==null ? "" : currObject.getShortName();
656

    
657
      if( name.toLowerCase(Locale.ENGLISH).equals(shortName) )
658
        {
659
        RubikObject object = RubikObjectList.getObject(name);
660

    
661
        if( object!=null )
662
          {
663
          int meshState = object.getMeshState();
664
          int iconMode  = TwistyObject.MODE_NORM;
665
          InputStream jsonStream = object.getObjectStream(this);
666
          InputStream meshStream = object.getMeshStream(this);
667
          ObjectControl control = getControl();
668
          control.changeObject(-1,meshState,iconMode,jsonStream,meshStream);
669
          }
670
        }
671
      }
672
}
(1-1/4)