mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
Merge remote-tracking branch 'gcgithub/android_goto_splash' into android_places_goto
This commit is contained in:
commit
5be9959424
13 changed files with 36 additions and 64 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"hifi_domains" : [
|
"hifi_domains" : [
|
||||||
{
|
{
|
||||||
"name": "You last location",
|
"name": "Your last location",
|
||||||
"url": "",
|
"url": "",
|
||||||
"thumbnail": ""
|
"thumbnail": ""
|
||||||
},
|
},
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class HomeActivity extends AppCompatActivity implements NavigationView.On
|
||||||
mNavigationView = (NavigationView) findViewById(R.id.nav_view);
|
mNavigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||||
mNavigationView.setNavigationItemSelectedListener(this);
|
mNavigationView.setNavigationItemSelectedListener(this);
|
||||||
|
|
||||||
TabHost tabs=(TabHost)findViewById(R.id.tabhost);
|
TabHost tabs = (TabHost)findViewById(R.id.tabhost);
|
||||||
tabs.setup();
|
tabs.setup();
|
||||||
|
|
||||||
TabHost.TabSpec spec=tabs.newTabSpec("featured");
|
TabHost.TabSpec spec=tabs.newTabSpec("featured");
|
||||||
|
@ -67,12 +67,12 @@ public class HomeActivity extends AppCompatActivity implements NavigationView.On
|
||||||
spec.setIndicator(getString(R.string.featured));
|
spec.setIndicator(getString(R.string.featured));
|
||||||
tabs.addTab(spec);
|
tabs.addTab(spec);
|
||||||
|
|
||||||
spec=tabs.newTabSpec("popular");
|
spec = tabs.newTabSpec("popular");
|
||||||
spec.setContent(R.id.popular);
|
spec.setContent(R.id.popular);
|
||||||
spec.setIndicator(getString(R.string.popular));
|
spec.setIndicator(getString(R.string.popular));
|
||||||
tabs.addTab(spec);
|
tabs.addTab(spec);
|
||||||
|
|
||||||
spec=tabs.newTabSpec("bookmarks");
|
spec = tabs.newTabSpec("bookmarks");
|
||||||
spec.setContent(R.id.bookmarks);
|
spec.setContent(R.id.bookmarks);
|
||||||
spec.setIndicator(getString(R.string.bookmarks));
|
spec.setIndicator(getString(R.string.bookmarks));
|
||||||
tabs.addTab(spec);
|
tabs.addTab(spec);
|
||||||
|
@ -80,7 +80,7 @@ public class HomeActivity extends AppCompatActivity implements NavigationView.On
|
||||||
tabs.setCurrentTab(0);
|
tabs.setCurrentTab(0);
|
||||||
|
|
||||||
TabWidget tabwidget=tabs.getTabWidget();
|
TabWidget tabwidget=tabs.getTabWidget();
|
||||||
for(int i=0;i<tabwidget.getChildCount();i++){
|
for(int i=0; i<tabwidget.getChildCount(); i++){
|
||||||
TextView tv=(TextView) tabwidget.getChildAt(i).findViewById(android.R.id.title);
|
TextView tv=(TextView) tabwidget.getChildAt(i).findViewById(android.R.id.title);
|
||||||
tv.setTextAppearance(R.style.TabText);
|
tv.setTextAppearance(R.style.TabText);
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public class HomeActivity extends AppCompatActivity implements NavigationView.On
|
||||||
EditText searchView = findViewById(R.id.searchView);
|
EditText searchView = findViewById(R.id.searchView);
|
||||||
int searchPlateId = searchView.getContext().getResources().getIdentifier("android:id/search_plate", null, null);
|
int searchPlateId = searchView.getContext().getResources().getIdentifier("android:id/search_plate", null, null);
|
||||||
View searchPlate = searchView.findViewById(searchPlateId);
|
View searchPlate = searchView.findViewById(searchPlateId);
|
||||||
if (searchPlate!=null) {
|
if (searchPlate != null) {
|
||||||
searchPlate.setBackgroundColor (Color.TRANSPARENT);
|
searchPlate.setBackgroundColor (Color.TRANSPARENT);
|
||||||
int searchTextId = searchPlate.getContext ().getResources ().getIdentifier ("android:id/search_src_text", null, null);
|
int searchTextId = searchPlate.getContext ().getResources ().getIdentifier ("android:id/search_src_text", null, null);
|
||||||
TextView searchTextView = searchView.findViewById(searchTextId);
|
TextView searchTextView = searchView.findViewById(searchTextId);
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class InterfaceActivity extends QtActivity {
|
||||||
super.isLoading = true;
|
super.isLoading = true;
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
if (intent.hasExtra(DOMAIN_URL) && !intent.getStringExtra(DOMAIN_URL).isEmpty()) {
|
if (intent.hasExtra(DOMAIN_URL) && !intent.getStringExtra(DOMAIN_URL).isEmpty()) {
|
||||||
intent.putExtra("applicationArguments", "--url "+intent.getStringExtra(DOMAIN_URL));
|
intent.putExtra("applicationArguments", "--url " + intent.getStringExtra(DOMAIN_URL));
|
||||||
}
|
}
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
|
@ -202,7 +202,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);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <AccountManager.h>
|
#include <AccountManager.h>
|
||||||
#include <QtAndroidExtras/QAndroidJniObject>
|
|
||||||
|
|
||||||
class AndroidHelper : public QObject {
|
class AndroidHelper : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -7866,71 +7866,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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -15,7 +15,6 @@ import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.util.Log;
|
|
||||||
import org.qtproject.qt5.android.bindings.QtActivity;
|
import org.qtproject.qt5.android.bindings.QtActivity;
|
||||||
|
|
||||||
public class InterfaceActivity extends QtActivity {
|
public class InterfaceActivity extends QtActivity {
|
||||||
|
|
|
@ -38,11 +38,11 @@ function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBackPressed() {
|
function onBackPressed() {
|
||||||
App.openAndroidActivity("Goto");
|
App.openAndroidActivity("Home");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Script.scriptEnding.connect(function () {
|
Script.scriptEnding.connect(function() {
|
||||||
if(backButton) {
|
if(backButton) {
|
||||||
backButton.clicked.disconnect(onBackPressed);
|
backButton.clicked.disconnect(onBackPressed);
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,12 +248,12 @@ function handleLogin() {
|
||||||
|
|
||||||
function onUsernameChanged(username) {
|
function onUsernameChanged(username) {
|
||||||
if (Account.isLoggedIn()) {
|
if (Account.isLoggedIn()) {
|
||||||
MyAvatar.displayName=username;
|
MyAvatar.displayName = username;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleLogout() {
|
function handleLogout() {
|
||||||
MyAvatar.displayName="";
|
MyAvatar.displayName = "";
|
||||||
if (loginBtn) {
|
if (loginBtn) {
|
||||||
loginBtn.editProperties({text: "LOG IN"});
|
loginBtn.editProperties({text: "LOG IN"});
|
||||||
}
|
}
|
||||||
|
|
|
@ -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));
|
||||||
|
|
|
@ -39,7 +39,7 @@ function init() {
|
||||||
radar.setUniqueColor(uniqueColor);
|
radar.setUniqueColor(uniqueColor);
|
||||||
radar.init();
|
radar.init();
|
||||||
|
|
||||||
barQml = new QmlFragment({
|
barQml = new QmlFragment({
|
||||||
qml: "hifi/modesbar.qml"
|
qml: "hifi/modesbar.qml"
|
||||||
});
|
});
|
||||||
modeButton = barQml.addButton({
|
modeButton = barQml.addButton({
|
||||||
|
|
Loading…
Reference in a new issue