Project

General

Profile

« Previous | Next » 

Revision 03822c33

Added by Leszek Koltunski over 3 years ago

Fix a rare crash.

View differences:

src/main/java/org/distorted/main/RubikActivity.java
444 444
      if( reportChange )
445 445
        {
446 446
        TwistyObject oldObject = pre.getObject();
447
        ObjectList oldList = oldObject.getObjectList();
448
        int oldNum = oldObject.getNumLayers();
449
        float fps = view.getRenderer().getFPS();
450
        fps = (int)(fps+0.5f);
451
        StringBuilder name = new StringBuilder();
452
        name.append(oldList.name());
453
        name.append('_');
454
        name.append(oldNum);
455
        name.append(' ');
456
        name.append(fps);
457
        name.append(" --> ");
458
        name.append(newObject.name());
459
        name.append('_');
460
        name.append(newSize);
461

  
462
        if( BuildConfig.DEBUG )
463
          {
464
          android.util.Log.e("rubik", name.toString());
465
          }
466
        else
467
          {
468
          FirebaseAnalytics analytics = getAnalytics();
469 447

  
470
          if( analytics!=null )
448
        if( oldObject!=null )
449
          {
450
          ObjectList oldList = oldObject.getObjectList();
451
          int oldNum = oldObject.getNumLayers();
452
          float fps = view.getRenderer().getFPS();
453
          fps = (int)(fps+0.5f);
454
          StringBuilder name = new StringBuilder();
455
          name.append(oldList.name());
456
          name.append('_');
457
          name.append(oldNum);
458
          name.append(' ');
459
          name.append(fps);
460
          name.append(" --> ");
461
          name.append(newObject.name());
462
          name.append('_');
463
          name.append(newSize);
464

  
465
          if( BuildConfig.DEBUG )
471 466
            {
472
            Bundle bundle = new Bundle();
473
            bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, name.toString());
474
            analytics.logEvent(FirebaseAnalytics.Event.SELECT_ITEM, bundle);
467
            android.util.Log.e("rubik", name.toString());
468
            }
469
          else
470
            {
471
            FirebaseAnalytics analytics = getAnalytics();
472

  
473
            if( analytics!=null )
474
              {
475
              Bundle bundle = new Bundle();
476
              bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, name.toString());
477
              analytics.logEvent(FirebaseAnalytics.Event.SELECT_ITEM, bundle);
478
              }
475 479
            }
476 480
          }
477 481
        }

Also available in: Unified diff