diff --git a/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java b/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java index 52da11f1a9..32b6e0e039 100644 --- a/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java +++ b/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java @@ -199,7 +199,7 @@ public class InterfaceActivity extends QtActivity { public void openGotoActivity(String activityName) { switch (activityName) { - case "Goto": { + case "Home": { Intent intent = new Intent(this, HomeActivity.class); intent.putExtra(HomeActivity.PARAM_NOT_START_INTERFACE_ACTIVITY, true); startActivity(intent); diff --git a/interface/resources/qml/hifi/+android/modesbar.qml b/interface/resources/qml/hifi/+android/modesbar.qml index 98973f1edb..994bf1efe4 100644 --- a/interface/resources/qml/hifi/+android/modesbar.qml +++ b/interface/resources/qml/hifi/+android/modesbar.qml @@ -15,7 +15,7 @@ Item { function relocateAndResize(newWindowWidth, newWindowHeight) { width = 300; height = 300; - x=newWindowWidth - 565; + x = newWindowWidth - 565; } function onWindowGeometryChanged(rect) { diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 9fee772513..19267a59ee 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -7862,71 +7862,29 @@ void Application::saveNextPhysicsStats(QString filename) { void Application::openAndroidActivity(const QString& activityName) { #if defined(Q_OS_ANDROID) - qDebug() << "[Background-HIFI] Application::openAndroidActivity"; - //getActiveDisplayPlugin()->deactivate(); AndroidHelper::instance().requestActivity(activityName); - connect(&AndroidHelper::instance(), &AndroidHelper::backFromAndroidActivity, this, &Application::restoreAfterAndroidActivity); -#endif -} - -void Application::restoreAfterAndroidActivity() { -#if defined(Q_OS_ANDROID) - qDebug() << "[Background-HIFI] restoreAfterAndroidActivity: this wouldn't be needed"; - - /*if (!getActiveDisplayPlugin() || !getActiveDisplayPlugin()->activate()) { - qWarning() << "Could not re-activate display plugin"; - }*/ - disconnect(&AndroidHelper::instance(), &AndroidHelper::backFromAndroidActivity, this, &Application::restoreAfterAndroidActivity); #endif } #if defined(Q_OS_ANDROID) void Application::enterBackground() { - qDebug() << "[Background-HIFI] enterBackground begin"; QMetaObject::invokeMethod(DependencyManager::get().data(), "stop", Qt::BlockingQueuedConnection); - qDebug() << "[Background-HIFI] deactivating display plugin"; getActiveDisplayPlugin()->deactivate(); - qDebug() << "[Background-HIFI] enterBackground end"; } void Application::enterForeground() { - qDebug() << "[Background-HIFI] enterForeground qApp?" << (qApp?"yeah":"false"); if (qApp && DependencyManager::isSet()) { - qDebug() << "[Background-HIFI] audioclient.start()"; QMetaObject::invokeMethod(DependencyManager::get().data(), "start", Qt::BlockingQueuedConnection); } else { - qDebug() << "[Background-HIFI] audioclient.start() not done"; + qDebug() << "Could not start AudioClient"; } if (!getActiveDisplayPlugin() || !getActiveDisplayPlugin()->activate()) { - qWarning() << "[Background-HIFI] Could not re-activate display plugin"; + qWarning() << "Could not re-activate display plugin"; } } - -extern "C" { - - -JNIEXPORT void -Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeEnterBackground(JNIEnv *env, jobject obj) { - qDebug() << "[Background-HIFI] nativeEnterBackground"; - if (qApp) { - qDebug() << "[Background-HIFI] nativeEnterBackground begin (qApp)"; - qApp->enterBackground(); - } -} - -JNIEXPORT void -Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeEnterForeground(JNIEnv *env, jobject obj) { - qDebug() << "[Background-HIFI] nativeEnterForeground"; - if (qApp) { - qDebug() << "[Background-HIFI] nativeEnterForeground begin (qApp)"; - qApp->enterForeground(); - } -} - - -} +#include "Application_jni.cpp" #endif diff --git a/interface/src/Application.h b/interface/src/Application.h index ec49aa055f..568cce2ab6 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -459,8 +459,6 @@ private slots: void handleSandboxStatus(QNetworkReply* reply); void switchDisplayMode(); - void restoreAfterAndroidActivity(); - private: static void initDisplay(); void init(); diff --git a/interface/src/Application_jni.cpp b/interface/src/Application_jni.cpp new file mode 100644 index 0000000000..83641ad8c6 --- /dev/null +++ b/interface/src/Application_jni.cpp @@ -0,0 +1,18 @@ +extern "C" { + +JNIEXPORT void +Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeEnterBackground(JNIEnv *env, jobject obj) { + if (qApp) { + qApp->enterBackground(); + } +} + +JNIEXPORT void +Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeEnterForeground(JNIEnv *env, jobject obj) { + if (qApp) { + qApp->enterForeground(); + } +} + + +} diff --git a/scripts/system/+android/actionbar.js b/scripts/system/+android/actionbar.js index a1ddc6f2de..1f0872d5ee 100644 --- a/scripts/system/+android/actionbar.js +++ b/scripts/system/+android/actionbar.js @@ -38,7 +38,7 @@ function init() { } function onBackPressed() { - App.openAndroidActivity("Goto"); + App.openAndroidActivity("Home"); } diff --git a/scripts/system/+android/goto.js b/scripts/system/+android/goto.js index 540705c673..750844a2a4 100644 --- a/scripts/system/+android/goto.js +++ b/scripts/system/+android/goto.js @@ -34,7 +34,7 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See module.exports.onHidden(); break; case 'openAndroidActivity': - App.openAndroidActivity("Goto"); + App.openAndroidActivity("Home"); break; default: print('[goto-android.js] Unrecognized message from AddressBarDialog.qml:', JSON.stringify(message));