mirror of
https://github.com/overte-org/overte.git
synced 2025-07-24 01:23:55 +02: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) {
|
public void openGotoActivity(String activityName) {
|
||||||
switch (activityName) {
|
switch (activityName) {
|
||||||
case "Goto": {
|
case "Home": {
|
||||||
Intent intent = new Intent(this, HomeActivity.class);
|
Intent intent = new Intent(this, HomeActivity.class);
|
||||||
intent.putExtra(HomeActivity.PARAM_NOT_START_INTERFACE_ACTIVITY, true);
|
intent.putExtra(HomeActivity.PARAM_NOT_START_INTERFACE_ACTIVITY, true);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
|
@ -15,7 +15,7 @@ Item {
|
||||||
function relocateAndResize(newWindowWidth, newWindowHeight) {
|
function relocateAndResize(newWindowWidth, newWindowHeight) {
|
||||||
width = 300;
|
width = 300;
|
||||||
height = 300;
|
height = 300;
|
||||||
x=newWindowWidth - 565;
|
x = newWindowWidth - 565;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onWindowGeometryChanged(rect) {
|
function onWindowGeometryChanged(rect) {
|
||||||
|
|
|
@ -7862,71 +7862,29 @@ void Application::saveNextPhysicsStats(QString filename) {
|
||||||
|
|
||||||
void Application::openAndroidActivity(const QString& activityName) {
|
void Application::openAndroidActivity(const QString& activityName) {
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(Q_OS_ANDROID)
|
||||||
qDebug() << "[Background-HIFI] Application::openAndroidActivity";
|
|
||||||
//getActiveDisplayPlugin()->deactivate();
|
|
||||||
AndroidHelper::instance().requestActivity(activityName);
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(Q_OS_ANDROID)
|
||||||
void Application::enterBackground() {
|
void Application::enterBackground() {
|
||||||
qDebug() << "[Background-HIFI] enterBackground begin";
|
|
||||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(),
|
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(),
|
||||||
"stop", Qt::BlockingQueuedConnection);
|
"stop", Qt::BlockingQueuedConnection);
|
||||||
qDebug() << "[Background-HIFI] deactivating display plugin";
|
|
||||||
getActiveDisplayPlugin()->deactivate();
|
getActiveDisplayPlugin()->deactivate();
|
||||||
qDebug() << "[Background-HIFI] enterBackground end";
|
|
||||||
}
|
}
|
||||||
void Application::enterForeground() {
|
void Application::enterForeground() {
|
||||||
qDebug() << "[Background-HIFI] enterForeground qApp?" << (qApp?"yeah":"false");
|
|
||||||
if (qApp && DependencyManager::isSet<AudioClient>()) {
|
if (qApp && DependencyManager::isSet<AudioClient>()) {
|
||||||
qDebug() << "[Background-HIFI] audioclient.start()";
|
|
||||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(),
|
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(),
|
||||||
"start", Qt::BlockingQueuedConnection);
|
"start", Qt::BlockingQueuedConnection);
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "[Background-HIFI] audioclient.start() not done";
|
qDebug() << "Could not start AudioClient";
|
||||||
}
|
}
|
||||||
if (!getActiveDisplayPlugin() || !getActiveDisplayPlugin()->activate()) {
|
if (!getActiveDisplayPlugin() || !getActiveDisplayPlugin()->activate()) {
|
||||||
qWarning() << "[Background-HIFI] Could not re-activate display plugin";
|
qWarning() << "Could not re-activate display plugin";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#include "Application_jni.cpp"
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -459,8 +459,6 @@ private slots:
|
||||||
void handleSandboxStatus(QNetworkReply* reply);
|
void handleSandboxStatus(QNetworkReply* reply);
|
||||||
void switchDisplayMode();
|
void switchDisplayMode();
|
||||||
|
|
||||||
void restoreAfterAndroidActivity();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void initDisplay();
|
static void initDisplay();
|
||||||
void init();
|
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() {
|
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();
|
module.exports.onHidden();
|
||||||
break;
|
break;
|
||||||
case 'openAndroidActivity':
|
case 'openAndroidActivity':
|
||||||
App.openAndroidActivity("Goto");
|
App.openAndroidActivity("Home");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
print('[goto-android.js] Unrecognized message from AddressBarDialog.qml:', JSON.stringify(message));
|
print('[goto-android.js] Unrecognized message from AddressBarDialog.qml:', JSON.stringify(message));
|
||||||
|
|
Loading…
Reference in a new issue