23 |
23 |
import android.graphics.Canvas;
|
24 |
24 |
import android.graphics.Paint;
|
25 |
25 |
|
|
26 |
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
|
27 |
|
26 |
28 |
import org.distorted.library.effect.VertexEffectDeform;
|
27 |
29 |
import org.distorted.library.effect.VertexEffectMove;
|
28 |
30 |
import org.distorted.library.effect.VertexEffectRotate;
|
... | ... | |
508 |
510 |
StringBuilder objectString = new StringBuilder();
|
509 |
511 |
int size = getSize();
|
510 |
512 |
int len = size*size;
|
511 |
|
int cubitIndex, row, col;
|
512 |
|
int color;
|
|
513 |
int cubitIndex=-1, row=-1, col=-1;
|
|
514 |
int color=-1, face=-1;
|
513 |
515 |
|
514 |
516 |
final int RIGHT= 0;
|
515 |
517 |
final int LEFT = 1;
|
... | ... | |
520 |
522 |
|
521 |
523 |
final char[] FACE_NAMES = { 'R', 'L', 'U', 'D', 'F', 'B'};
|
522 |
524 |
|
|
525 |
/////////////////////
|
|
526 |
// LIVE DEBUGGING
|
|
527 |
/////////////////////
|
|
528 |
try
|
|
529 |
{
|
|
530 |
/////////////////////
|
|
531 |
|
|
532 |
face = UP;
|
|
533 |
|
523 |
534 |
for(int i=0; i<len; i++)
|
524 |
535 |
{
|
525 |
536 |
row = i/size;
|
526 |
537 |
col = i%size;
|
527 |
538 |
|
528 |
539 |
cubitIndex = col<size-1 ? (size-1)*(size+4*col) + row : 6*size*size - 13*size + 8 + row;
|
529 |
|
color = getCubitFaceColorIndex(cubitIndex,UP);
|
|
540 |
color = getCubitFaceColorIndex(cubitIndex,face);
|
530 |
541 |
objectString.append(FACE_NAMES[color]);
|
531 |
542 |
}
|
532 |
543 |
|
|
544 |
face = RIGHT;
|
|
545 |
|
533 |
546 |
for(int i=0; i<len; i++)
|
534 |
547 |
{
|
535 |
548 |
cubitIndex = 6*size*size - 12*size +7 - i;
|
536 |
|
color = getCubitFaceColorIndex(cubitIndex,RIGHT);
|
|
549 |
color = getCubitFaceColorIndex(cubitIndex,face);
|
537 |
550 |
objectString.append(FACE_NAMES[color]);
|
538 |
551 |
}
|
539 |
552 |
|
|
553 |
face = FRONT;
|
|
554 |
|
540 |
555 |
for(int i=0; i<len; i++)
|
541 |
556 |
{
|
542 |
557 |
row = i/size;
|
... | ... | |
550 |
565 |
else cubitIndex = size*size + size-1 + 4*(col-1)*(size-1) + 2*(size-1-row);
|
551 |
566 |
}
|
552 |
567 |
|
553 |
|
color = getCubitFaceColorIndex(cubitIndex,FRONT);
|
|
568 |
color = getCubitFaceColorIndex(cubitIndex,face);
|
554 |
569 |
objectString.append(FACE_NAMES[color]);
|
555 |
570 |
}
|
556 |
571 |
|
|
572 |
face = DOWN;
|
|
573 |
|
557 |
574 |
for(int i=0; i<len; i++)
|
558 |
575 |
{
|
559 |
576 |
row = i/size;
|
560 |
577 |
col = i%size;
|
561 |
578 |
|
562 |
579 |
cubitIndex = col==0 ? size-1-row : size*size + size-1 + 4*(col-1)*(size-1) - row;
|
563 |
|
color = getCubitFaceColorIndex(cubitIndex,DOWN);
|
|
580 |
color = getCubitFaceColorIndex(cubitIndex,face);
|
564 |
581 |
objectString.append(FACE_NAMES[color]);
|
565 |
582 |
}
|
566 |
583 |
|
|
584 |
face = LEFT;
|
|
585 |
|
567 |
586 |
for(int i=0; i<len; i++)
|
568 |
587 |
{
|
569 |
588 |
row = i/size;
|
570 |
589 |
col = i%size;
|
571 |
590 |
|
572 |
591 |
cubitIndex = (size-1-row)*size + col;
|
573 |
|
color = getCubitFaceColorIndex(cubitIndex,LEFT);
|
|
592 |
color = getCubitFaceColorIndex(cubitIndex,face);
|
574 |
593 |
objectString.append(FACE_NAMES[color]);
|
575 |
594 |
}
|
576 |
595 |
|
|
596 |
face = BACK;
|
|
597 |
|
577 |
598 |
for(int i=0; i<len; i++)
|
578 |
599 |
{
|
579 |
600 |
row = i/size;
|
... | ... | |
587 |
608 |
else cubitIndex = size*size + 4*(size-2-col)*(size-1) + size + 2*(size-2-row);
|
588 |
609 |
}
|
589 |
610 |
|
590 |
|
color = getCubitFaceColorIndex(cubitIndex,BACK);
|
|
611 |
color = getCubitFaceColorIndex(cubitIndex,face);
|
591 |
612 |
objectString.append(FACE_NAMES[color]);
|
592 |
613 |
}
|
593 |
614 |
|
|
615 |
/////////////////////
|
|
616 |
}
|
|
617 |
catch(java.lang.ArrayIndexOutOfBoundsException ex)
|
|
618 |
{
|
|
619 |
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
|
|
620 |
|
|
621 |
String str="";
|
|
622 |
for(int i=0; i<NUM_CUBITS; i++)
|
|
623 |
{
|
|
624 |
str += (CUBITS[i].mQuatIndex+" ");
|
|
625 |
}
|
|
626 |
|
|
627 |
crashlytics.setCustomKey("ObjectString", "color="+color+" cubitIndex="+cubitIndex+" face="+face+" row="+row+" col="+col );
|
|
628 |
crashlytics.setCustomKey("Quaternion", "NUM_CUBITS: "+NUM_CUBITS+" quats: "+str );
|
|
629 |
crashlytics.recordException(ex);
|
|
630 |
}
|
|
631 |
/////////////////////
|
|
632 |
// END LIVE DEBUGGING
|
|
633 |
/////////////////////
|
|
634 |
|
594 |
635 |
return objectString.toString();
|
595 |
636 |
}
|
596 |
637 |
}
|
Fix for one bug seen in Firebase and additional debugging for another.