diff --git a/gvr-interface/CMakeLists.txt b/gvr-interface/CMakeLists.txt index bd0eb07e87..b52047a38a 100644 --- a/gvr-interface/CMakeLists.txt +++ b/gvr-interface/CMakeLists.txt @@ -17,6 +17,8 @@ if (ANDROID) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${ANDROID_APK_OUTPUT_DIR}/libs/${ANDROID_ABI}") setup_hifi_library(Gui Widgets AndroidExtras) + + add_definitions(-DANDROID) else () setup_hifi_project(Gui Widgets) endif () @@ -28,19 +30,21 @@ include_glm() link_hifi_libraries(shared networking audio-client avatars) include_dependency_includes() -find_package(LibOVR) -if (LIBOVR_FOUND) - add_definitions(-DHAVE_LIBOVR) - target_link_libraries(${TARGET_NAME} ${LIBOVR_LIBRARIES} ${LIBOVR_ANDROID_LIBRARIES}) - include_directories(SYSTEM ${LIBOVR_INCLUDE_DIRS}) +if (ANDROID) + find_package(LibOVR) + + if (LIBOVR_FOUND) + add_definitions(-DHAVE_LIBOVR) + target_link_libraries(${TARGET_NAME} ${LIBOVR_LIBRARIES} ${LIBOVR_ANDROID_LIBRARIES}) + include_directories(SYSTEM ${LIBOVR_INCLUDE_DIRS}) - if (ANDROID) # we need VRLib, so add a project.properties to our apk build folder that says that file(RELATIVE_PATH RELATIVE_VRLIB_PATH ${ANDROID_APK_OUTPUT_DIR} "${LIBOVR_VRLIB_DIR}") file(WRITE "${ANDROID_APK_BUILD_DIR}/project.properties" "android.library.reference.1=${RELATIVE_VRLIB_PATH}") - + list(APPEND IGNORE_COPY_LIBS ${LIBOVR_ANDROID_LIBRARIES}) - endif (ANDROID) + endif () + endif () # the presence of a HOCKEY_APP_ID means we are making a beta build diff --git a/gvr-interface/res/drawable/icon.png b/gvr-interface/res/drawable/icon.png index 4fe5404c7d..70aaf9b4ed 100644 Binary files a/gvr-interface/res/drawable/icon.png and b/gvr-interface/res/drawable/icon.png differ diff --git a/gvr-interface/src/GVRInterface.cpp b/gvr-interface/src/GVRInterface.cpp index 35b1d1011d..d40845d675 100644 --- a/gvr-interface/src/GVRInterface.cpp +++ b/gvr-interface/src/GVRInterface.cpp @@ -13,13 +13,13 @@ #include +#include #include #include #endif #include -#include #include #ifdef HAVE_LIBOVR @@ -53,13 +53,12 @@ GVRInterface::GVRInterface(int argc, char* argv[]) : connect(this, &QGuiApplication::applicationStateChanged, this, &GVRInterface::handleApplicationStateChange); -#if defined(Q_WS_ANDROID) && defined(HAVE_LIBOVR) +#if defined(ANDROID) && defined(HAVE_LIBOVR) QAndroidJniEnvironment jniEnv; QPlatformNativeInterface* interface = QApplication::platformNativeInterface(); jobject activity = (jobject) interface->nativeResourceForIntegration("QtActivity"); - ovr_RegisterHmtReceivers(&*jniEnv, activity); #endif diff --git a/gvr-interface/src/GVRInterface.h b/gvr-interface/src/GVRInterface.h index 58fe80f7c0..d189c0b2af 100644 --- a/gvr-interface/src/GVRInterface.h +++ b/gvr-interface/src/GVRInterface.h @@ -30,7 +30,7 @@ class GVRInterface : public QApplication { Q_OBJECT public: GVRInterface(int argc, char* argv[]); - + RenderingClient* getClient() { return _client; } private slots: diff --git a/gvr-interface/src/GVRMainWindow.cpp b/gvr-interface/src/GVRMainWindow.cpp index 3176457677..456c6851d5 100644 --- a/gvr-interface/src/GVRMainWindow.cpp +++ b/gvr-interface/src/GVRMainWindow.cpp @@ -14,7 +14,7 @@ #include #include -#ifndef Q_OS_ANDROID +#ifndef ANDROID #include #endif @@ -42,13 +42,18 @@ GVRMainWindow::GVRMainWindow(QWidget* parent) : menuBar()->addMenu(helpMenu); QAction* goToAddress = new QAction("Go to Address", fileMenu); - QAction* aboutQt = new QAction("About Qt", helpMenu); - - fileMenu->addAction(goToAddress); - helpMenu->addAction(aboutQt); - connect(goToAddress, &QAction::triggered, this, &GVRMainWindow::showAddressBar); + fileMenu->addAction(goToAddress); + +#ifdef ANDROID + QAction* goFullScreen = new QAction("Enter Full Screen", fileMenu); + connect(goFullScreen, &QAction::triggered, this, &GVRMainWindow::goFullScreen); + fileMenu->addAction(goFullScreen); +#endif + + QAction* aboutQt = new QAction("About Qt", helpMenu); connect(aboutQt, &QAction::triggered, qApp, &QApplication::aboutQt); + helpMenu->addAction(aboutQt); QWidget* baseWidget = new QWidget(this); @@ -62,7 +67,15 @@ GVRMainWindow::GVRMainWindow(QWidget* parent) : setCentralWidget(baseWidget); // add the interface view - InterfaceView* interfaceView = new InterfaceView(baseWidget); + new InterfaceView(baseWidget); +} + +void GVRMainWindow::goFullScreen() { +#ifdef ANDROID + menuBar()->hide(); +#else + showFullScreen(); +#endif } void GVRMainWindow::showAddressBar() { diff --git a/gvr-interface/src/GVRMainWindow.h b/gvr-interface/src/GVRMainWindow.h index 3d7e80e6b8..47eee2ae98 100644 --- a/gvr-interface/src/GVRMainWindow.h +++ b/gvr-interface/src/GVRMainWindow.h @@ -22,6 +22,7 @@ public: GVRMainWindow(QWidget* parent = 0); public slots: void showAddressBar(); + void goFullScreen(); private: QVBoxLayout* _mainLayout; }; diff --git a/gvr-interface/src/main.cpp b/gvr-interface/src/main.cpp index 5fa5390df0..fd08c4c3ad 100644 --- a/gvr-interface/src/main.cpp +++ b/gvr-interface/src/main.cpp @@ -16,7 +16,11 @@ int main(int argc, char* argv[]) { GVRInterface app(argc, argv); GVRMainWindow mainWindow; +#ifdef ANDROID + mainWindow.showFullScreen(); +#else mainWindow.showMaximized(); +#endif return app.exec(); } \ No newline at end of file diff --git a/libraries/gpu/CMakeLists.txt b/libraries/gpu/CMakeLists.txt index 7f2b475dd2..b6bbba1c0f 100644 --- a/libraries/gpu/CMakeLists.txt +++ b/libraries/gpu/CMakeLists.txt @@ -31,6 +31,8 @@ elseif (WIN32) add_definitions(-DNSIGHT_FOUND) target_link_libraries(${TARGET_NAME} "${NSIGHT_LIBRARIES}") endif () +elseif (ANDROID) + target_link_libraries(${TARGET_NAME} "-lGLESv3" "-lEGL") else () find_package(OpenGL REQUIRED) diff --git a/libraries/gpu/src/gpu/GPUConfig.h b/libraries/gpu/src/gpu/GPUConfig.h index c399f51b66..5894d2a91d 100644 --- a/libraries/gpu/src/gpu/GPUConfig.h +++ b/libraries/gpu/src/gpu/GPUConfig.h @@ -23,6 +23,8 @@ #include #include +#elif defined(ANDROID) + #else #include #include diff --git a/libraries/networking/src/AddressManager.cpp b/libraries/networking/src/AddressManager.cpp index 4f5bd05537..1a18093b02 100644 --- a/libraries/networking/src/AddressManager.cpp +++ b/libraries/networking/src/AddressManager.cpp @@ -57,7 +57,11 @@ const QUrl AddressManager::currentAddress() const { void AddressManager::loadSettings(const QString& lookupString) { if (lookupString.isEmpty()) { - handleLookupString(SettingHandles::currentAddress.get().toString()); + const QString& lastAddress = SettingHandles::currentAddress.get().toString(); + + if (lastAddress.isEmpty()) { + handleLookupString(lastAddress); + } } else { handleLookupString(lookupString); }