mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Remove debug statements and unused code. Put JNI code in a separated file.
This commit is contained in:
parent
472cc1b29a
commit
c8fe45eb8f
7 changed files with 25 additions and 51 deletions
|
@ -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);
|
||||
|
|
|
@ -15,7 +15,7 @@ Item {
|
|||
function relocateAndResize(newWindowWidth, newWindowHeight) {
|
||||
width = 300;
|
||||
height = 300;
|
||||
x=newWindowWidth - 565;
|
||||
x = newWindowWidth - 565;
|
||||
}
|
||||
|
||||
function onWindowGeometryChanged(rect) {
|
||||
|
|
|
@ -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<AudioClient>().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<AudioClient>()) {
|
||||
qDebug() << "[Background-HIFI] audioclient.start()";
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().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
|
||||
|
||||
|
|
|
@ -459,8 +459,6 @@ private slots:
|
|||
void handleSandboxStatus(QNetworkReply* reply);
|
||||
void switchDisplayMode();
|
||||
|
||||
void restoreAfterAndroidActivity();
|
||||
|
||||
private:
|
||||
static void initDisplay();
|
||||
void init();
|
||||
|
|
18
interface/src/Application_jni.cpp
Normal file
18
interface/src/Application_jni.cpp
Normal file
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -38,7 +38,7 @@ function init() {
|
|||
}
|
||||
|
||||
function onBackPressed() {
|
||||
App.openAndroidActivity("Goto");
|
||||
App.openAndroidActivity("Home");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue