Project

General

Profile

« Previous | Next » 

Revision 8bbac3c2

Added by Leszek Koltunski almost 4 years ago

Improve rotations of the Pyraminx; synchronize begin/add/finish Rotation in the RubikObject (now it is possible to begin new rotation when an old one didn't finish yet!)

View differences:

src/main/java/org/distorted/objects/RubikObject.java
239 239

  
240 240
///////////////////////////////////////////////////////////////////////////////////////////////////
241 241

  
242
  private void setupPosition(int[][] moves)
242
  private synchronized void setupPosition(int[][] moves)
243 243
    {
244 244
    if( moves!=null )
245 245
      {
......
366 366

  
367 367
///////////////////////////////////////////////////////////////////////////////////////////////////
368 368

  
369
  public void restorePreferences(SharedPreferences preferences)
369
  public synchronized void restorePreferences(SharedPreferences preferences)
370 370
    {
371 371
    for(int i=0; i<NUM_CUBITS; i++)
372 372
      {
......
398 398

  
399 399
///////////////////////////////////////////////////////////////////////////////////////////////////
400 400

  
401
  public void solve()
401
  public synchronized void solve()
402 402
    {
403 403
    for(int i=0; i<NUM_CUBITS; i++)
404 404
      {
......
475 475

  
476 476
///////////////////////////////////////////////////////////////////////////////////////////////////
477 477

  
478
  public void beginNewRotation(int axis, int row )
478
  public synchronized void beginNewRotation(int axis, int row )
479 479
    {
480 480
    if( axis<0 || axis>=ROTATION_AXIS.length )
481 481
      {
......
498 498

  
499 499
///////////////////////////////////////////////////////////////////////////////////////////////////
500 500

  
501
  public long addNewRotation( int axis, int rowBitmap, int angle, long durationMillis, EffectListener listener )
501
  public synchronized long addNewRotation( int axis, int rowBitmap, int angle, long durationMillis, EffectListener listener )
502 502
    {
503 503
    mRotAxis     = axis;
504 504
    mRotRowBitmap= rowBitmap;
......
556 556

  
557 557
///////////////////////////////////////////////////////////////////////////////////////////////////
558 558

  
559
  public void removeRotationNow()
559
  public synchronized void removeRotationNow()
560 560
    {
561 561
    float angle = getAngle();
562 562
    double nearestAngleInRadians = angle*Math.PI/180;

Also available in: Unified diff