Merge pull request #14975 from amerhifi/LifeCyclePause

case 21032: Life cycle pause
This commit is contained in:
Sam Gateau 2019-02-21 12:16:44 -08:00 committed by GitHub
commit 6f5d0b7191
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 11 deletions

View file

@ -34,7 +34,6 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca
private native void questNativeOnResume(); private native void questNativeOnResume();
private native void questOnAppAfterLoad(); private native void questOnAppAfterLoad();
private SurfaceView mView; private SurfaceView mView;
private SurfaceHolder mSurfaceHolder; private SurfaceHolder mSurfaceHolder;
@ -57,12 +56,15 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca
setContentView(mView); setContentView(mView);
questOnAppAfterLoad(); questOnAppAfterLoad();
}); });
} }
@Override @Override
protected void onDestroy() { protected void onDestroy() {
Log.w(TAG, "QQQ onDestroy"); Log.w(TAG, "QQQ onDestroy");
isPausing=false;
super.onStop();
nativeOnSurfaceChanged(null); nativeOnSurfaceChanged(null);
Log.w(TAG, "QQQ onDestroy -- SUPER onDestroy"); Log.w(TAG, "QQQ onDestroy -- SUPER onDestroy");
@ -78,6 +80,7 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca
questNativeOnResume(); questNativeOnResume();
nativeOnResume(); nativeOnResume();
isPausing=false;
} }
@Override @Override
@ -87,40 +90,41 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca
questNativeOnPause(); questNativeOnPause();
nativeOnPause(); nativeOnPause();
isPausing=true;
} }
@Override @Override
protected void onStop(){ protected void onStop(){
super.onStop(); super.onStop();
Log.w(TAG, "QQQ Onstop called"); Log.w(TAG, "QQQ_ Onstop called");
} }
@Override @Override
protected void onRestart(){ protected void onRestart() {
super.onRestart(); super.onRestart();
Log.w(TAG, "QQQ onRestart called ****"); Log.w(TAG, "QQQ_ onRestart called ****");
questOnAppAfterLoad(); questOnAppAfterLoad();
} }
@Override @Override
public void surfaceCreated(SurfaceHolder holder) { public void surfaceCreated(SurfaceHolder holder) {
Log.w(TAG, "QQQ surfaceCreated ************************************"); Log.w(TAG, "QQQ_ surfaceCreated ************************************");
nativeOnSurfaceChanged(holder.getSurface()); nativeOnSurfaceChanged(holder.getSurface());
mSurfaceHolder = holder; mSurfaceHolder = holder;
} }
@Override @Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
Log.w(TAG, "QQQ surfaceChanged"); Log.w(TAG, "QQQ_ surfaceChanged");
nativeOnSurfaceChanged(holder.getSurface()); nativeOnSurfaceChanged(holder.getSurface());
mSurfaceHolder = holder; mSurfaceHolder = holder;
} }
@Override @Override
public void surfaceDestroyed(SurfaceHolder holder) { public void surfaceDestroyed(SurfaceHolder holder) {
Log.w(TAG, "QQQ surfaceDestroyed ***************************************************"); Log.w(TAG, "QQQ_ surfaceDestroyed ***************************************************");
nativeOnSurfaceChanged(null); // nativeOnSurfaceChanged(null);
mSurfaceHolder = null; // mSurfaceHolder = null;
} }
} }

View file

@ -70,6 +70,7 @@ public class QtActivity extends Activity {
public final String QT_ANDROID_DEFAULT_THEME = QT_ANDROID_THEMES[0]; // sets the default theme. public final String QT_ANDROID_DEFAULT_THEME = QT_ANDROID_THEMES[0]; // sets the default theme.
private QtActivityLoader m_loader = new QtActivityLoader(this); private QtActivityLoader m_loader = new QtActivityLoader(this);
public boolean isPausing=false;
public QtActivity() { public QtActivity() {
} }
@ -650,8 +651,12 @@ public class QtActivity extends Activity {
@Override @Override
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
if(!isPausing){
QtApplication.invokeDelegate(); QtApplication.invokeDelegate();
} }
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------