mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Android - Make sure we call Interface enterBackground when opening the app
This commit is contained in:
parent
082c1fce52
commit
2b0ac6a9bd
2 changed files with 15 additions and 1 deletions
|
@ -56,6 +56,8 @@ public class InterfaceActivity extends QtActivity {
|
||||||
private AssetManager assetManager;
|
private AssetManager assetManager;
|
||||||
|
|
||||||
private static boolean inVrMode;
|
private static boolean inVrMode;
|
||||||
|
|
||||||
|
private boolean nativeEnterBackgroundCallEnqueued = false;
|
||||||
// private GvrApi gvrApi;
|
// private GvrApi gvrApi;
|
||||||
// Opaque native pointer to the Application C++ object.
|
// Opaque native pointer to the Application C++ object.
|
||||||
// This object is owned by the InterfaceActivity instance and passed to the native methods.
|
// This object is owned by the InterfaceActivity instance and passed to the native methods.
|
||||||
|
@ -121,13 +123,19 @@ public class InterfaceActivity extends QtActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
nativeEnterBackground();
|
if (super.isLoading) {
|
||||||
|
nativeEnterBackgroundCallEnqueued = true;
|
||||||
|
} else {
|
||||||
|
Log.d("[ENTERBACKGROUND]","onPause calling nativeEnterBackground");
|
||||||
|
nativeEnterBackground();
|
||||||
|
}
|
||||||
//gvrApi.pauseTracking();
|
//gvrApi.pauseTracking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
nativeEnterBackgroundCallEnqueued = false;
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,6 +264,10 @@ public class InterfaceActivity extends QtActivity {
|
||||||
|
|
||||||
public void onAppLoadedComplete() {
|
public void onAppLoadedComplete() {
|
||||||
super.isLoading = false;
|
super.isLoading = false;
|
||||||
|
if (nativeEnterBackgroundCallEnqueued) {
|
||||||
|
Log.d("[ENTERBACKGROUND]","onAppLoadedComplete calling nativeEnterBackground");
|
||||||
|
nativeEnterBackground();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void performHapticFeedback(int duration) {
|
public void performHapticFeedback(int duration) {
|
||||||
|
|
|
@ -8248,10 +8248,12 @@ void Application::saveNextPhysicsStats(QString filename) {
|
||||||
|
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(Q_OS_ANDROID)
|
||||||
void Application::enterBackground() {
|
void Application::enterBackground() {
|
||||||
|
qDebug() << "[ENTERBACKGROUND] Application::enterBackground()";
|
||||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(),
|
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(),
|
||||||
"stop", Qt::BlockingQueuedConnection);
|
"stop", Qt::BlockingQueuedConnection);
|
||||||
if (getActiveDisplayPlugin()->isActive()) {
|
if (getActiveDisplayPlugin()->isActive()) {
|
||||||
getActiveDisplayPlugin()->deactivate();
|
getActiveDisplayPlugin()->deactivate();
|
||||||
|
qDebug() << "[ENTERBACKGROUND] Application::enterBackground() getActiveDisplayPlugin()->deactivated";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue