mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 03:48:38 +02:00
removed unused activities. Fixed null refference pointer to activity.getApplicationContext() error on restart
This commit is contained in:
parent
ef655cd243
commit
68b3ae989f
4 changed files with 9 additions and 150 deletions
|
@ -68,7 +68,6 @@ QAndroidJniObject __interfaceActivity;
|
||||||
initOculusPlatform(env, obj);
|
initOculusPlatform(env, obj);
|
||||||
getClassName(env, obj);
|
getClassName(env, obj);
|
||||||
|
|
||||||
qRegisterMetaType<QAndroidJniObject>("QAndroidJniObject");
|
|
||||||
__interfaceActivity = QAndroidJniObject(obj);
|
__interfaceActivity = QAndroidJniObject(obj);
|
||||||
|
|
||||||
QObject::connect(&AndroidHelper::instance(), &AndroidHelper::qtAppLoadComplete, []() {
|
QObject::connect(&AndroidHelper::instance(), &AndroidHelper::qtAppLoadComplete, []() {
|
||||||
|
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -72,7 +72,7 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca
|
||||||
|
|
||||||
//isLoading=false;
|
//isLoading=false;
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
setContentView(mView);
|
setContentView(mView); setContentView(mView);
|
||||||
questOnAppAfterLoad();
|
questOnAppAfterLoad();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -110,9 +110,15 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onRestart(){
|
||||||
|
super.onRestart();
|
||||||
|
nativeOnCreate();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void surfaceCreated(SurfaceHolder holder) {
|
public void surfaceCreated(SurfaceHolder holder) {
|
||||||
Log.w(TAG, "QQQ surfaceCreated");
|
Log.w(TAG, "QQQ surfaceCreated ************************************");
|
||||||
nativeOnSurfaceChanged(holder.getSurface());
|
nativeOnSurfaceChanged(holder.getSurface());
|
||||||
mSurfaceHolder = holder;
|
mSurfaceHolder = holder;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +132,7 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void surfaceDestroyed(SurfaceHolder holder) {
|
public void surfaceDestroyed(SurfaceHolder holder) {
|
||||||
Log.w(TAG, "QQQ surfaceDestroyed");
|
Log.w(TAG, "QQQ surfaceDestroyed ***************************************************");
|
||||||
nativeOnSurfaceChanged(null);
|
nativeOnSurfaceChanged(null);
|
||||||
mSurfaceHolder = null;
|
mSurfaceHolder = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue