Remove bottom bar. Apply new design for android

This commit is contained in:
Gabriel Calero 2018-04-09 11:41:00 -03:00
parent 0da2c972e3
commit e85f5c97dc
10 changed files with 230 additions and 140 deletions

View file

@ -41,8 +41,8 @@ public class InterfaceActivity extends QtActivity {
private native void nativeOnDestroy();
private native void nativeGotoUrl(String url);
private native void nativeGoBackFromAndroidActivity();
//private native void nativeOnStop();
//private native void nativeOnStart();
private native void nativeEnterBackground();
private native void nativeEnterForeground();
//private native void saveRealScreenSize(int width, int height);
//private native void setAppVersion(String version);
private native long nativeOnExitVr();
@ -124,14 +124,13 @@ public class InterfaceActivity extends QtActivity {
@Override
protected void onStart() {
super.onStart();
// nativeOnStart();
nativeEnterForeground();
}
@Override
protected void onStop() {
Log.d("[Background]","Calling nativeOnStop from InterfaceActivity");
// nativeOnStop();
super.onStop();
nativeEnterBackground();
}
@Override

85
interface/resources/icons/+android/backward.svg Normal file → Executable file
View file

@ -1,70 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 150 450"
xml:space="preserve"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="backward.svg"
width="150"
height="450"><metadata
id="metadata20"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs18" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="971"
id="namedview16"
showgrid="false"
inkscape:zoom="1.1125147"
inkscape:cx="12.362631"
inkscape:cy="233.34206"
inkscape:window-x="0"
inkscape:window-y="1"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" /><style
type="text/css"
id="style4">
.st0{fill:#414042;}
.st1{fill:#CCCCCC;}
.st2{fill:#1398BB;}
.st3{fill:#31D8FF;}
</style><g
id="Layer_1"
transform="translate(0,300)"><path
id="path4148"
d="M 103.51176,131.14554 61.96248,89.596247 58.602209,86.235997 61.96248,82.875716 104.41995,40.41826 c 2.67913,-2.679128 2.67913,-7.083865 0,-9.762962 -1.31687,-1.316854 -3.04241,-2.043396 -4.90418,-2.043396 -1.86178,0 -3.587322,0.726542 -4.904182,2.043396 L 39.030908,86.235997 93.70341,140.9085 c 1.31686,1.31689 3.042403,2.04343 4.904176,2.04343 1.861774,0 3.587314,-0.72654 4.904174,-2.04343 2.67914,-2.67913 2.67914,-7.0838 0,-9.76296 z"
class="st0"
inkscape:connector-curvature="0"
style="fill:#54c9ef;fill-opacity:1" /><path
style="fill:#54c9ef;fill-opacity:1"
inkscape:connector-curvature="0"
class="st0"
d="m 103.51176,-28.954508 -41.54928,-41.549293 -3.360271,-3.36025 3.360271,-3.360281 42.45747,-42.457458 c 2.67913,-2.67913 2.67913,-7.08386 0,-9.76296 -1.31687,-1.31685 -3.04241,-2.0434 -4.90418,-2.0434 -1.86178,0 -3.587322,0.72655 -4.904182,2.0434 l -55.58068,55.580699 54.672502,54.672505 c 1.31686,1.316886 3.042403,2.043428 4.904176,2.043428 1.861774,0 3.587314,-0.726542 4.904174,-2.043428 2.67914,-2.679128 2.67914,-7.083802 0,-9.762962 z"
id="path4158" /><path
id="path4169"
d="m 103.51176,-188.41523 -41.54928,-41.54929 -3.360271,-3.36025 3.360271,-3.36028 42.45747,-42.45746 c 2.67913,-2.67913 2.67913,-7.08386 0,-9.76296 -1.31687,-1.31685 -3.04241,-2.0434 -4.90418,-2.0434 -1.86178,0 -3.587322,0.72655 -4.904182,2.0434 l -55.58068,55.5807 54.672502,54.67251 c 1.31686,1.31688 3.042403,2.04342 4.904176,2.04342 1.861774,0 3.587314,-0.72654 4.904174,-2.04342 2.67914,-2.67913 2.67914,-7.08381 0,-9.76297 z"
class="st0"
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1" /></g><g
id="Layer_2"
transform="translate(0,300)" /></svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.7;}
.st1{fill:none;stroke:#FFFFFF;stroke-width:6.4193;stroke-linecap:round;stroke-miterlimit:10;}
</style>
<g id="Layer_2_1_">
</g>
<g class="st0">
<polyline class="st1" points="24.3,43.4 5.8,25.2 5.8,25.1 24,6.6 "/>
<line class="st1" x1="7.2" y1="25" x2="44.2" y2="25"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 688 B

View file

@ -1,56 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Layer_1"
x="0px"
y="0px"
width="150px"
height="150px"
viewBox="0 0 150 150"
enable-background="new 0 0 150 150"
xml:space="preserve"
inkscape:version="0.91 r13725"
sodipodi:docname="myview-a.svg"><metadata
id="metadata15"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs13" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="640"
inkscape:window-height="480"
id="namedview11"
showgrid="false"
inkscape:zoom="1.5733333"
inkscape:cx="75"
inkscape:cy="75"
inkscape:window-x="0"
inkscape:window-y="23"
inkscape:window-maximized="0"
inkscape:current-layer="Layer_1" /><title
id="title3">Asset 3</title><g
id="Layer_2"
transform="translate(0,18)"><g
id="Layer_1-2"><path
d="M 135.105,20 12.135,20 C 4.381,20 0,25.958 0,34.238 l 0,80.608 c -0.653,7.229 4.677,13.618 11.906,14.271 0.411,0.037 0.824,0.055 1.236,0.053 l 122.664,0 c 7.709,0 14.105,-8.061 14.105,-16.34 l 0,-80.607 C 150,23.943 142.815,20 135.105,20 Z m 2.322,95.678 c 0.005,2.32 -1.802,4.241 -4.118,4.381 l -118.02,0 c -2.316,-0.14 -4.122,-2.061 -4.118,-4.381 l 0,-82.229 c -0.004,-2.32 1.802,-4.242 4.118,-4.381 l 118.02,0 c 2.316,0.139 4.123,2.061 4.118,4.381 l 0,82.229 z"
id="path7"
inkscape:connector-curvature="0"
style="fill:#ffffff" /><polygon
points="107.462,74.322 129.761,74.322 129.761,67.576 99.795,67.576 99.62,67.444 99.533,67.576 49.854,67.576 49.767,67.444 49.547,67.576 18.137,67.576 18.137,74.322 42.188,74.322 18.137,89.349 18.137,97.584 53.578,74.322 61.595,74.322 44.378,113.838 51.519,113.838 68.691,74.322 80.651,74.322 97.868,113.838 105.009,113.838 87.792,74.322 96.072,74.322 129.761,97.41 129.761,89.174 "
id="polygon9"
style="fill:#ffffff" /></g></g></svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.7;}
.st1{fill:#FFFFFF;stroke:#FFFFFF;stroke-width:2;stroke-miterlimit:10;}
</style>
<g id="Layer_2_1_">
</g>
<g class="st0">
<path class="st1" d="M48.1,22.5c-1.6-1.9-3.2-4-5.2-5.6c-5.2-4.4-11.1-6.9-17.8-7.1c-6,0.1-11.1,2-15.8,5.2c-3,2-5.6,4.4-7.6,7.4
c-1.1,1.7-1.1,3.3,0,5c1.8,2.7,4.1,4.8,6.6,6.7c4.9,3.6,10.4,5.9,16.6,5.9c5.8,0,10.9-2,15.6-5.2c3-2,5.6-4.4,7.6-7.4
C49.4,25.8,49.5,24.1,48.1,22.5z M46.4,27.1C41,34,33.9,38,26.2,38.5c-7.3-0.1-12.6-2.4-17.4-6c-2.2-1.6-4.1-3.5-5.6-5.8
c-0.7-1-0.9-2-0.1-3.1c4.8-7.1,16.4-14.6,28.2-11.1c6.2,1.9,11.3,5.3,15.2,10.5C47.8,24.7,47.8,25.3,46.4,27.1z"/>
<path class="st1" d="M25,15.6c-5.3,0-9.4,4.1-9.5,9.4c0,5.3,4.2,9.5,9.5,9.5c5.3,0,9.4-4.2,9.4-9.5C34.4,19.7,30.3,15.6,25,15.6z
M24.9,32.9c-4.2,0-7.8-3.6-7.8-7.9c0-4.2,3.6-7.8,7.8-7.8c4.2,0,7.9,3.6,7.8,7.8C32.8,29.3,29.2,32.9,24.9,32.9z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,71 @@
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.3
import Qt.labs.settings 1.0
import "../../styles-uit"
import "../../controls-uit" as HifiControlsUit
import "../../controls" as HifiControls
import ".."
Item {
id: actionBar
x:0
y:0
width: 300
height: 300
z: -1
signal sendToScript(var message);
signal windowClosed();
property bool shown: true
onShownChanged: {
actionBar.visible = shown;
}
Rectangle {
anchors.fill : parent
color: "transparent"
Flow {
id: flowMain
spacing: 10
flow: Flow.TopToBottom
layoutDirection: Flow.TopToBottom
anchors.fill: parent
anchors.margins: 4
}
}
Component.onCompleted: {
// put on bottom
x = 50;
y = 0;
width = 300;
height = 300;
}
function addButton(properties) {
var component = Qt.createComponent("button.qml");
if (component.status == Component.Ready) {
var button = component.createObject(flowMain);
// copy all properites to button
var keys = Object.keys(properties).forEach(function (key) {
button[key] = properties[key];
});
return button;
} else if( component.status == Component.Error) {
console.log("Load button errors " + component.errorString());
}
}
function urlHelper(src) {
if (src.match(/\bhttp/)) {
return src;
} else {
return "../../../" + src;
}
}
}

View file

@ -40,7 +40,7 @@ Item {
Component.onCompleted: {
// put on bottom
x = 0;
x = parent.width-300;
y = 0;
width = 300;
height = 300;

View file

@ -10,7 +10,7 @@ import ".."
Item {
id: modesbar
y:60
y:20
Rectangle {
anchors.fill : parent
color: "transparent"
@ -25,9 +25,9 @@ Item {
}
Component.onCompleted: {
width = 300 + 30; // That 30 is extra regardless the qty of items shown
height = 300 + 30;
x=Window.innerWidth - width;
width = 300; // That 30 is extra regardless the qty of items shown
height = 300;
x=parent.width - 540;
}
function addButton(properties) {

View file

@ -242,6 +242,7 @@ extern "C" {
#if defined(Q_OS_ANDROID)
#include <android/log.h>
#include <QtAndroidExtras/QAndroidJniObject>
#endif
enum ApplicationEvent {
@ -7870,7 +7871,8 @@ void Application::saveNextPhysicsStats(QString filename) {
void Application::openAndroidActivity(const QString& activityName) {
#if defined(Q_OS_ANDROID)
getActiveDisplayPlugin()->deactivate();
qDebug() << "[Background-HIFI] Application::openAndroidActivity";
//getActiveDisplayPlugin()->deactivate();
AndroidHelper::instance().requestActivity(activityName);
connect(&AndroidHelper::instance(), &AndroidHelper::backFromAndroidActivity, this, &Application::restoreAfterAndroidActivity);
#endif
@ -7878,11 +7880,63 @@ void Application::openAndroidActivity(const QString& activityName) {
void Application::restoreAfterAndroidActivity() {
#if defined(Q_OS_ANDROID)
if (!getActiveDisplayPlugin() || !getActiveDisplayPlugin()->activate()) {
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";
}
if (!getActiveDisplayPlugin() || !getActiveDisplayPlugin()->activate()) {
qWarning() << "[Background-HIFI] 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();
}
}
}
#endif
#include "Application.moc"

View file

@ -292,6 +292,11 @@ public:
void replaceDomainContent(const QString& url);
#if defined(Q_OS_ANDROID)
void enterBackground();
void enterForeground();
#endif
signals:
void svoImportRequested(const QString& url);

View file

@ -14,7 +14,7 @@
var DEFAULT_SCRIPTS_COMBINED = [
"system/progress.js",
"system/+android/touchscreenvirtualpad.js",
"system/+android/bottombar.js",
"system/+android/actionbar.js",
"system/+android/audio.js" ,
"system/+android/modes.js",
"system/+android/stats.js"/*,

View file

@ -0,0 +1,53 @@
"use strict";
//
// backbutton.js
// scripts/system/+android
//
// Created by Gabriel Calero & Cristian Duarte on Apr 06, 2018
// Copyright 2018 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
//
(function() { // BEGIN LOCAL_SCOPE
var actionbar;
var backButton;
var logEnabled = true;
function printd(str) {
if (logEnabled)
print("[actionbar.js] " + str);
}
function init() {
actionbar = new QmlFragment({
qml: "hifi/ActionBar.qml"
});
backButton = actionbar.addButton({
icon: "icons/+android/backward.svg",
activeIcon: "icons/+android/backward.svg",
text: "",
bgOpacity: 0.0,
activeBgOpacity: 0.0,
bgColor: "#FFFFFF"
});
backButton.clicked.connect(onBackPressed);
}
function onBackPressed() {
App.openAndroidActivity("Goto");
}
Script.scriptEnding.connect(function () {
if(backButton) {
backButton.clicked.disconnect(onBackPressed);
}
});
init();
}()); // END LOCAL_SCOPE