Project

General

Profile

« Previous | Next » 

Revision a1bcb301

Added by Leszek Koltunski over 2 years ago

Bugfixes for crashes from Firebase.

View differences:

src/main/java/org/distorted/objectlib/main/ObjectControl.java
251 251

  
252 252
    private void finishRotation()
253 253
      {
254
      computeCurrentSpeedInInchesPerSecond();
255 254
      TwistyObject object = mPreRender.getObject();
256
      int angle = object.computeNearestAngle(mCurrentAxis,mCurrentAngle, mCurrRotSpeed);
257
      mPreRender.finishRotation(angle);
258
      mPreRender.rememberMove(mCurrentAxis,mCurrentRow,angle);
255
      int[] angles = object.getBasicAngle();
259 256

  
260
      if( angle!=0 )
257
      if( mCurrentAxis<angles.length )
261 258
        {
262
        int basicAngle= object.getBasicAngle()[mCurrentAxis];
263
        int realAngle = (angle*basicAngle)/360;
264
        mInterface.onFinishRotation(mCurrentAxis,mCurrentRow,realAngle);
265
        }
259
        computeCurrentSpeedInInchesPerSecond();
260

  
261
        int angle = object.computeNearestAngle(mCurrentAxis,mCurrentAngle, mCurrRotSpeed);
262
        mPreRender.finishRotation(angle);
263
        mPreRender.rememberMove(mCurrentAxis,mCurrentRow,angle);
264

  
265
        if( angle!=0 )
266
          {
267
          int basicAngle= angles[mCurrentAxis];
268
          int realAngle = (angle*basicAngle)/360;
269
          mInterface.onFinishRotation(mCurrentAxis,mCurrentRow,realAngle);
270
          }
266 271

  
267
      mContinuingRotation = false;
268
      mBeginningRotation  = false;
269
      mDragging           = true;
272
        mContinuingRotation = false;
273
        mBeginningRotation  = false;
274
        mDragging           = true;
275
        }
270 276
      }
271 277

  
272 278
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
478 478

  
479 479
  public void addRotation(MovesFinished listener, int axis, int rowBitmap, int bareAngle, int millPreDegree)
480 480
    {
481
    mAddRotation = true;
481
    int[] angles = mNewObject.getBasicAngle();
482 482

  
483
    int basicAngle= mNewObject.getBasicAngle()[axis];
484
    int angle     = bareAngle*(360/basicAngle);
485
    int duration  = Math.abs(angle)*millPreDegree;
483
    if( angles.length>axis )
484
      {
485
      mAddRotation = true;
486 486

  
487
    mAddActionListener    = listener;
488
    mAddRotationAxis      = axis;
489
    mAddRotationRowBitmap = rowBitmap;
490
    mAddRotationAngle     = angle;
491
    mAddRotationDuration  = duration;
487
      int basicAngle= angles[axis];
488
      int angle     = bareAngle*(360/basicAngle);
489
      int duration  = Math.abs(angle)*millPreDegree;
492 490

  
493
    if( listener instanceof ScrambleEffect )
494
      {
495
      mDebug += (" (a "+axis+" "+rowBitmap+" "+angle+" "+(System.currentTimeMillis()-mDebugStartTime)+")");
491
      mAddActionListener    = listener;
492
      mAddRotationAxis      = axis;
493
      mAddRotationRowBitmap = rowBitmap;
494
      mAddRotationAngle     = angle;
495
      mAddRotationDuration  = duration;
496

  
497
      if( listener instanceof ScrambleEffect )
498
        {
499
        mDebug += (" (a "+axis+" "+rowBitmap+" "+angle+" "+(System.currentTimeMillis()-mDebugStartTime)+")");
500
        }
496 501
      }
497 502
    }
498 503

  

Also available in: Unified diff