mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-07 03:22:27 +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" : [
|
||||
{
|
||||
"name": "You last location",
|
||||
"name": "Your last location",
|
||||
"url": "",
|
||||
"thumbnail": ""
|
||||
},
|
||||
|
|
|
@ -59,7 +59,7 @@ public class HomeActivity extends AppCompatActivity implements NavigationView.On
|
|||
mNavigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||
mNavigationView.setNavigationItemSelectedListener(this);
|
||||
|
||||
TabHost tabs=(TabHost)findViewById(R.id.tabhost);
|
||||
TabHost tabs = (TabHost)findViewById(R.id.tabhost);
|
||||
tabs.setup();
|
||||
|
||||
TabHost.TabSpec spec=tabs.newTabSpec("featured");
|
||||
|
@ -67,12 +67,12 @@ public class HomeActivity extends AppCompatActivity implements NavigationView.On
|
|||
spec.setIndicator(getString(R.string.featured));
|
||||
tabs.addTab(spec);
|
||||
|
||||
spec=tabs.newTabSpec("popular");
|
||||
spec = tabs.newTabSpec("popular");
|
||||
spec.setContent(R.id.popular);
|
||||
spec.setIndicator(getString(R.string.popular));
|
||||
tabs.addTab(spec);
|
||||
|
||||
spec=tabs.newTabSpec("bookmarks");
|
||||
spec = tabs.newTabSpec("bookmarks");
|
||||
spec.setContent(R.id.bookmarks);
|
||||
spec.setIndicator(getString(R.string.bookmarks));
|
||||
tabs.addTab(spec);
|
||||
|
@ -80,7 +80,7 @@ public class HomeActivity extends AppCompatActivity implements NavigationView.On
|
|||
tabs.setCurrentTab(0);
|
||||
|
||||
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);
|
||||
tv.setTextAppearance(R.style.TabText);
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public class HomeActivity extends AppCompatActivity implements NavigationView.On
|
|||
EditText searchView = findViewById(R.id.searchView);
|
||||
int searchPlateId = searchView.getContext().getResources().getIdentifier("android:id/search_plate", null, null);
|
||||
View searchPlate = searchView.findViewById(searchPlateId);
|
||||
if (searchPlate!=null) {
|
||||
if (searchPlate != null) {
|
||||
searchPlate.setBackgroundColor (Color.TRANSPARENT);
|
||||
int searchTextId = searchPlate.getContext ().getResources ().getIdentifier ("android:id/search_src_text", null, null);
|
||||
TextView searchTextView = searchView.findViewById(searchTextId);
|
||||
|
|
|
@ -66,7 +66,7 @@ public class InterfaceActivity extends QtActivity {
|
|||
super.isLoading = true;
|
||||
Intent intent = getIntent();
|
||||
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);
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
@ -202,7 +202,7 @@ public class InterfaceActivity extends QtActivity {
|
|||
|
||||
public void openGotoActivity(String activityName) {
|
||||
switch (activityName) {
|
||||
case "Goto": {
|
||||
case "Home": {
|
||||
Intent intent = new Intent(this, HomeActivity.class);
|
||||
startActivity(intent);
|
||||
break;
|
||||
|
|
|
@ -15,7 +15,7 @@ Item {
|
|||
function relocateAndResize(newWindowWidth, newWindowHeight) {
|
||||
width = 300;
|
||||
height = 300;
|
||||
x=newWindowWidth - 565;
|
||||
x = newWindowWidth - 565;
|
||||
}
|
||||
|
||||
function onWindowGeometryChanged(rect) {
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <AccountManager.h>
|
||||
#include <QtAndroidExtras/QAndroidJniObject>
|
||||
|
||||
class AndroidHelper : public QObject {
|
||||
Q_OBJECT
|
||||
|
|
|
@ -7866,71 +7866,29 @@ void Application::saveNextPhysicsStats(QString filename) {
|
|||
|
||||
void Application::openAndroidActivity(const QString& activityName) {
|
||||
#if defined(Q_OS_ANDROID)
|
||||
qDebug() << "[Background-HIFI] Application::openAndroidActivity";
|
||||
//getActiveDisplayPlugin()->deactivate();
|
||||
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
|
||||
}
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
void Application::enterBackground() {
|
||||
qDebug() << "[Background-HIFI] enterBackground begin";
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(),
|
||||
"stop", Qt::BlockingQueuedConnection);
|
||||
qDebug() << "[Background-HIFI] deactivating display plugin";
|
||||
getActiveDisplayPlugin()->deactivate();
|
||||
qDebug() << "[Background-HIFI] enterBackground end";
|
||||
}
|
||||
void Application::enterForeground() {
|
||||
qDebug() << "[Background-HIFI] enterForeground qApp?" << (qApp?"yeah":"false");
|
||||
if (qApp && DependencyManager::isSet<AudioClient>()) {
|
||||
qDebug() << "[Background-HIFI] audioclient.start()";
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(),
|
||||
"start", Qt::BlockingQueuedConnection);
|
||||
} else {
|
||||
qDebug() << "[Background-HIFI] audioclient.start() not done";
|
||||
qDebug() << "Could not start AudioClient";
|
||||
}
|
||||
if (!getActiveDisplayPlugin() || !getActiveDisplayPlugin()->activate()) {
|
||||
qWarning() << "[Background-HIFI] Could not re-activate display plugin";
|
||||
qWarning() << "Could not re-activate display plugin";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#include "Application_jni.cpp"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -459,8 +459,6 @@ private slots:
|
|||
void handleSandboxStatus(QNetworkReply* reply);
|
||||
void switchDisplayMode();
|
||||
|
||||
void restoreAfterAndroidActivity();
|
||||
|
||||
private:
|
||||
static void initDisplay();
|
||||
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.os.Bundle;
|
||||
import android.view.WindowManager;
|
||||
import android.util.Log;
|
||||
import org.qtproject.qt5.android.bindings.QtActivity;
|
||||
|
||||
public class InterfaceActivity extends QtActivity {
|
||||
|
|
|
@ -38,11 +38,11 @@ function init() {
|
|||
}
|
||||
|
||||
function onBackPressed() {
|
||||
App.openAndroidActivity("Goto");
|
||||
App.openAndroidActivity("Home");
|
||||
}
|
||||
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
Script.scriptEnding.connect(function() {
|
||||
if(backButton) {
|
||||
backButton.clicked.disconnect(onBackPressed);
|
||||
}
|
||||
|
|
|
@ -248,12 +248,12 @@ function handleLogin() {
|
|||
|
||||
function onUsernameChanged(username) {
|
||||
if (Account.isLoggedIn()) {
|
||||
MyAvatar.displayName=username;
|
||||
MyAvatar.displayName = username;
|
||||
}
|
||||
}
|
||||
|
||||
function handleLogout() {
|
||||
MyAvatar.displayName="";
|
||||
MyAvatar.displayName = "";
|
||||
if (loginBtn) {
|
||||
loginBtn.editProperties({text: "LOG IN"});
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See
|
|||
module.exports.onHidden();
|
||||
break;
|
||||
case 'openAndroidActivity':
|
||||
App.openAndroidActivity("Goto");
|
||||
App.openAndroidActivity("Home");
|
||||
break;
|
||||
default:
|
||||
print('[goto-android.js] Unrecognized message from AddressBarDialog.qml:', JSON.stringify(message));
|
||||
|
|
|
@ -39,7 +39,7 @@ function init() {
|
|||
radar.setUniqueColor(uniqueColor);
|
||||
radar.init();
|
||||
|
||||
barQml = new QmlFragment({
|
||||
barQml = new QmlFragment({
|
||||
qml: "hifi/modesbar.qml"
|
||||
});
|
||||
modeButton = barQml.addButton({
|
||||
|
|
Loading…
Reference in a new issue