Project

General

Profile

« Previous | Next » 

Revision 2f6da3f4

Added by Leszek Koltunski about 4 years ago

Catch exceptions when rotating.

View differences:

src/main/java/org/distorted/main/RubikSurfaceView.java
590 590
          {
591 591
          int pointer = event.findPointerIndex(mPtrID2);
592 592

  
593
          float x2 = event.getX(pointer);
594
          float y2 = event.getY(pointer);
593
          try
594
            {
595
            float x2 = event.getX(pointer);
596
            float y2 = event.getY(pointer);
597

  
598
            mRotAngle = getAngle(x,-y,x2,-y2);
599
            mInitDistance = -1;
600
            }
601
          catch(IllegalArgumentException ex)
602
            {
603
            mPtrID1=INVALID_POINTER_ID;
604
            mPtrID2=INVALID_POINTER_ID;
605

  
606
            FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
607
            crashlytics.setCustomKey("DragError", "pointer="+pointer );
608
            crashlytics.recordException(ex);
595 609

  
596
          mRotAngle = getAngle(x,-y,x2,-y2);
597
          mInitDistance = -1;
610
            return;
611
            }
598 612
          }
599 613

  
600 614
        mX = (x - mScreenWidth*0.5f)/mScreenMin;
......
611 625
          {
612 626
          int pointer = event.findPointerIndex(mPtrID2);
613 627

  
614
          float x2 = event.getX(pointer);
615
          float y2 = event.getY(pointer);
628
          try
629
            {
630
            float x2 = event.getX(pointer);
631
            float y2 = event.getY(pointer);
632

  
633
            mRotAngle = getAngle(x,-y,x2,-y2);
634
            mInitDistance = -1;
635
            }
636
          catch(IllegalArgumentException ex)
637
            {
638
            mPtrID1=INVALID_POINTER_ID;
639
            mPtrID2=INVALID_POINTER_ID;
640

  
641
            FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
642
            crashlytics.setCustomKey("DragError", "pointer="+pointer );
643
            crashlytics.recordException(ex);
616 644

  
617
          mRotAngle = getAngle(x,-y,x2,-y2);
618
          mInitDistance = -1;
645
            return;
646
            }
619 647
          }
620 648

  
621 649
        if( mBeginningRotation || mContinuingRotation )

Also available in: Unified diff