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 questOnAppAfterLoad();
private SurfaceView mView;
private SurfaceHolder mSurfaceHolder;
@ -57,12 +56,15 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca
setContentView(mView);
questOnAppAfterLoad();
});
}
@Override
protected void onDestroy() {
Log.w(TAG, "QQQ onDestroy");
isPausing=false;
super.onStop();
nativeOnSurfaceChanged(null);
Log.w(TAG, "QQQ onDestroy -- SUPER onDestroy");
@ -78,6 +80,7 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca
questNativeOnResume();
nativeOnResume();
isPausing=false;
}
@Override
@ -87,40 +90,41 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca
questNativeOnPause();
nativeOnPause();
isPausing=true;
}
@Override
protected void onStop(){
super.onStop();
Log.w(TAG, "QQQ Onstop called");
Log.w(TAG, "QQQ_ Onstop called");
}
@Override
protected void onRestart(){
protected void onRestart() {
super.onRestart();
Log.w(TAG, "QQQ onRestart called ****");
Log.w(TAG, "QQQ_ onRestart called ****");
questOnAppAfterLoad();
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
Log.w(TAG, "QQQ surfaceCreated ************************************");
Log.w(TAG, "QQQ_ surfaceCreated ************************************");
nativeOnSurfaceChanged(holder.getSurface());
mSurfaceHolder = holder;
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
Log.w(TAG, "QQQ surfaceChanged");
Log.w(TAG, "QQQ_ surfaceChanged");
nativeOnSurfaceChanged(holder.getSurface());
mSurfaceHolder = holder;
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
Log.w(TAG, "QQQ surfaceDestroyed ***************************************************");
nativeOnSurfaceChanged(null);
mSurfaceHolder = null;
Log.w(TAG, "QQQ_ surfaceDestroyed ***************************************************");
// nativeOnSurfaceChanged(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.
private QtActivityLoader m_loader = new QtActivityLoader(this);
public boolean isPausing=false;
public QtActivity() {
}
@ -650,9 +651,13 @@ public class QtActivity extends Activity {
@Override
protected void onStop() {
super.onStop();
QtApplication.invokeDelegate();
if(!isPausing){
QtApplication.invokeDelegate();
}
}
//---------------------------------------------------------------------------
@Override