Android: minor, remove static attributes, move mIsSurfaceReady to SDLSurface
authorSylvain Becker <sylvain.becker@gmail.com>
Mon, 14 Jan 2019 21:34:12 +0100
changeset 12544ea4097dfa68d
parent 12543 621d0ce55072
child 12545 599ebb123f0a
Android: minor, remove static attributes, move mIsSurfaceReady to SDLSurface
android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
     1.1 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java	Mon Jan 14 14:36:13 2019 +0100
     1.2 +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java	Mon Jan 14 21:34:12 2019 +0100
     1.3 @@ -37,7 +37,7 @@
     1.4  public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener {
     1.5      private static final String TAG = "SDL";
     1.6  
     1.7 -    public static boolean mIsResumedCalled, mIsSurfaceReady, mHasFocus;
     1.8 +    public static boolean mIsResumedCalled, mHasFocus;
     1.9  
    1.10      // Cursor types
    1.11      private static final int SDL_SYSTEM_CURSOR_NONE = -1;
    1.12 @@ -179,7 +179,6 @@
    1.13          mSDLThread = null;
    1.14          mBrokenLibraries = false;
    1.15          mIsResumedCalled = false;
    1.16 -        mIsSurfaceReady = false;
    1.17          mHasFocus = true;
    1.18          mNextNativeState = NativeState.INIT;
    1.19          mCurrentNativeState = NativeState.INIT;
    1.20 @@ -497,7 +496,7 @@
    1.21  
    1.22          // Try a transition to resumed state
    1.23          if (mNextNativeState == NativeState.RESUMED) {
    1.24 -            if (mIsSurfaceReady && mHasFocus && mIsResumedCalled) {
    1.25 +            if (mSurface.mIsSurfaceReady && mHasFocus && mIsResumedCalled) {
    1.26                  if (mSDLThread == null) {
    1.27                      // This is the entry point to the C app.
    1.28                      // Start up the C app thread and enable sensor input for the first time
    1.29 @@ -1531,11 +1530,14 @@
    1.30      View.OnKeyListener, View.OnTouchListener, SensorEventListener  {
    1.31  
    1.32      // Sensors
    1.33 -    protected static SensorManager mSensorManager;
    1.34 -    protected static Display mDisplay;
    1.35 +    protected SensorManager mSensorManager;
    1.36 +    protected Display mDisplay;
    1.37  
    1.38      // Keep track of the surface size to normalize touch events
    1.39 -    protected static float mWidth, mHeight;
    1.40 +    protected float mWidth, mHeight;
    1.41 +
    1.42 +    // Is SurfaceView ready for rendering
    1.43 +    public boolean mIsSurfaceReady;
    1.44  
    1.45      // Startup
    1.46      public SDLSurface(Context context) {
    1.47 @@ -1558,6 +1560,8 @@
    1.48          // Some arbitrary defaults to avoid a potential division by zero
    1.49          mWidth = 1.0f;
    1.50          mHeight = 1.0f;
    1.51 +
    1.52 +        mIsSurfaceReady = false;
    1.53      }
    1.54  
    1.55      public void handlePause() {
    1.56 @@ -1593,7 +1597,7 @@
    1.57          SDLActivity.mNextNativeState = SDLActivity.NativeState.PAUSED;
    1.58          SDLActivity.handleNativeState();
    1.59  
    1.60 -        SDLActivity.mIsSurfaceReady = false;
    1.61 +        mIsSurfaceReady = false;
    1.62          SDLActivity.onNativeSurfaceDestroyed();
    1.63      }
    1.64  
    1.65 @@ -1686,7 +1690,7 @@
    1.66  
    1.67          if (skip) {
    1.68             Log.v("SDL", "Skip .. Surface is not ready.");
    1.69 -           SDLActivity.mIsSurfaceReady = false;
    1.70 +           mIsSurfaceReady = false;
    1.71             return;
    1.72          }
    1.73  
    1.74 @@ -1694,7 +1698,7 @@
    1.75          SDLActivity.onNativeSurfaceChanged();
    1.76  
    1.77          /* Surface is ready */
    1.78 -        SDLActivity.mIsSurfaceReady = true;
    1.79 +        mIsSurfaceReady = true;
    1.80  
    1.81          SDLActivity.mNextNativeState = SDLActivity.NativeState.RESUMED;
    1.82          SDLActivity.handleNativeState();