Project

General

Profile

« Previous | Next » 

Revision 69a271f3

Added by Leszek Koltunski about 3 years ago

Fix for a rare crash.

View differences:

src/main/java/org/distorted/screens/RubikScreenPlay.java
480 480
      isFullScreen = true;
481 481
      }
482 482

  
483
    // if on Android 11 or we are fullscreen
484
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R || isFullScreen )
483
    try
485 484
      {
486
      window.showAsDropDown(view, xoff, yoff, Gravity.CENTER);
487
      window.update(view, w, h);
485
      // if on Android 11 or we are fullscreen
486
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R || isFullScreen )
487
        {
488
        window.showAsDropDown(view, xoff, yoff, Gravity.CENTER);
489
        window.update(view, w, h);
490
        }
491
      else  // Android 10 or below in pop-up mode or split-screen mode
492
        {
493
        view.getLocationOnScreen(mLocation);
494
        int width  = view.getWidth();
495
        int height = view.getHeight();
496
        int x = mLocation[0]+(width-w)/2;
497
        int y = mLocation[1]+height+yoff;
498

  
499
        window.showAsDropDown(view);
500
        window.update(x,y,w,h);
501
        }
488 502
      }
489
    else  // Android 10 or below in pop-up mode or split-screen mode
503
    catch( IllegalArgumentException iae )
490 504
      {
491
      view.getLocationOnScreen(mLocation);
492
      int width  = view.getWidth();
493
      int height = view.getHeight();
494
      int x = mLocation[0]+(width-w)/2;
495
      int y = mLocation[1]+height+yoff;
496

  
497
      window.showAsDropDown(view);
498
      window.update(x,y,w,h);
505
      // ignore, this means window is 'not attached to window manager' -
506
      // which most probably is because we are already exiting the app.
499 507
      }
500 508
    }
501 509

  

Also available in: Unified diff