diff --git a/android/apps/questInterface/src/main/cpp/native.cpp b/android/apps/questInterface/src/main/cpp/native.cpp index 9864273158..b9ff56bbf7 100644 --- a/android/apps/questInterface/src/main/cpp/native.cpp +++ b/android/apps/questInterface/src/main/cpp/native.cpp @@ -68,7 +68,6 @@ QAndroidJniObject __interfaceActivity; initOculusPlatform(env, obj); getClassName(env, obj); - qRegisterMetaType("QAndroidJniObject"); __interfaceActivity = QAndroidJniObject(obj); QObject::connect(&AndroidHelper::instance(), &AndroidHelper::qtAppLoadComplete, []() { diff --git a/android/apps/questInterface/src/main/java/io/highfidelity/questInterface/MainActivity.java b/android/apps/questInterface/src/main/java/io/highfidelity/questInterface/MainActivity.java deleted file mode 100644 index 93aafa042b..0000000000 --- a/android/apps/questInterface/src/main/java/io/highfidelity/questInterface/MainActivity.java +++ /dev/null @@ -1,72 +0,0 @@ -// -// MainActivity.java -// android/app/src/main/java -// -// Created by Stephen Birarda on 1/26/15. -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -package io.highfidelity.questInterface; - -import android.app.Activity; -import android.app.Application; -import android.content.Intent; -import android.os.Bundle; -import android.util.Log; -import android.view.WindowManager; - -import org.qtproject.qt5.android.bindings.QtActivity; - -import java.util.Timer; -import java.util.TimerTask; - -import io.highfidelity.utils.HifiUtils; - -public class MainActivity extends QtActivity { - private native void nativeOnCreate(); - private native void nativeOnDestroy(); - private native void nativeOnPause(); - private native void nativeOnResume(); - - private boolean isLoading; - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - HifiUtils.upackAssets(getAssets(), getCacheDir().getAbsolutePath()); - nativeOnCreate(); - } - - - public void onAppLoadedComplete() { - - Log.w("QQQ", "Returning to quest activity"); - runOnUiThread(()->{ - startActivity(new Intent(MainActivity.this, QuestActivity.class)); - //moveTaskToBack(true); - }); - } - - @Override - protected void onPause() { - super.onPause(); - - nativeOnPause(); - - } - - @Override - protected void onResume() { - super.onResume(); - nativeOnResume(); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - nativeOnDestroy(); - } -} diff --git a/android/apps/questInterface/src/main/java/io/highfidelity/questInterface/QuestActivity.java b/android/apps/questInterface/src/main/java/io/highfidelity/questInterface/QuestActivity.java deleted file mode 100644 index 9e2ace3bd3..0000000000 --- a/android/apps/questInterface/src/main/java/io/highfidelity/questInterface/QuestActivity.java +++ /dev/null @@ -1,74 +0,0 @@ -// -// MainActivity.java -// android/app/src/main/java -// -// Created by Stephen Birarda on 1/26/15. -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -package io.highfidelity.questInterface; - -import android.content.Intent; -import android.os.Bundle; -import android.util.Log; -import android.view.SurfaceView; -import android.view.WindowManager; - -import io.highfidelity.oculus.OculusMobileActivity; -import io.highfidelity.utils.HifiUtils; - -public class QuestActivity extends OculusMobileActivity { - private native void questNativeOnCreate(); - private native void questNativeOnDestroy(); - private native void questNativeOnPause(); - private native void questNativeOnResume(); - private native void questOnAppAfterLoad(); - - private boolean isLoading=false; - String TAG = OculusMobileActivity.class.getSimpleName(); - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - HifiUtils.upackAssets(getAssets(), getCacheDir().getAbsolutePath()); - isLoading=true; - questNativeOnCreate(); - - } - - public void onAppLoadedComplete() { - Log.w(TAG, "QQQ Load Completed"); - isLoading=false; - runOnUiThread(() -> { - questOnAppAfterLoad(); - }); - } - - @Override - protected void onPause() { - super.onPause(); - - Log.w(TAG, "OnPause"); - if(!isLoading){ - questNativeOnPause(); - } - - } - - @Override - protected void onResume() { - super.onResume(); - Log.w(TAG, "OnResume"); - questNativeOnResume(); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - Log.w(TAG, "OnDestroy"); - questNativeOnDestroy(); - } -} diff --git a/android/libraries/oculus/src/main/java/io/highfidelity/oculus/OculusMobileActivity.java b/android/libraries/oculus/src/main/java/io/highfidelity/oculus/OculusMobileActivity.java index 197c8a8da2..637600b34b 100644 --- a/android/libraries/oculus/src/main/java/io/highfidelity/oculus/OculusMobileActivity.java +++ b/android/libraries/oculus/src/main/java/io/highfidelity/oculus/OculusMobileActivity.java @@ -72,7 +72,7 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca //isLoading=false; runOnUiThread(() -> { - setContentView(mView); + setContentView(mView); setContentView(mView); questOnAppAfterLoad(); }); } @@ -110,9 +110,15 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca } } + @Override + protected void onRestart(){ + super.onRestart(); + nativeOnCreate(); + } + @Override public void surfaceCreated(SurfaceHolder holder) { - Log.w(TAG, "QQQ surfaceCreated"); + Log.w(TAG, "QQQ surfaceCreated ************************************"); nativeOnSurfaceChanged(holder.getSurface()); mSurfaceHolder = holder; } @@ -126,7 +132,7 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca @Override public void surfaceDestroyed(SurfaceHolder holder) { - Log.w(TAG, "QQQ surfaceDestroyed"); + Log.w(TAG, "QQQ surfaceDestroyed ***************************************************"); nativeOnSurfaceChanged(null); mSurfaceHolder = null; }