From 79ff2df860defa5715335a10d9fc1f5c5e334a1c Mon Sep 17 00:00:00 2001 From: Cristian Luis Duarte Date: Fri, 16 Mar 2018 13:03:50 -0300 Subject: [PATCH 1/3] Android - Resize bottombar after window size changes (to always fill the screen horizontally) --- .../resources/qml/hifi/+android/bottombar.qml | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/interface/resources/qml/hifi/+android/bottombar.qml b/interface/resources/qml/hifi/+android/bottombar.qml index e31dc9453f..c6fa431baf 100644 --- a/interface/resources/qml/hifi/+android/bottombar.qml +++ b/interface/resources/qml/hifi/+android/bottombar.qml @@ -45,10 +45,10 @@ Item { anchors.fill: parent } - Rectangle { + Rectangle { id: background anchors.fill : parent - color: "#FF000000" + color: "#FF000000" border.color: "#FFFFFF" anchors.bottomMargin: -1 anchors.leftMargin: -1 @@ -104,13 +104,26 @@ Item { } } } - } + } + + function relocateAndResize(newWindowWidth, newWindowHeight) { + width = newWindowWidth; + y = newWindowHeight - height; + } + + function onWindowGeometryChanged(rect) { + relocateAndResize(rect.width, rect.height); + } Component.onCompleted: { // put on bottom - width = Window.innerWidth; height = 255; - y = Window.innerHeight - height; + relocateAndResize(Window.innerWidth, Window.innerHeight); + Window.geometryChanged.connect(onWindowGeometryChanged); // In devices with bars appearing at startup we should listen for this + } + + Component.onDestruction: { + Window.geometryChanged.disconnect(onWindowGeometryChanged); } function addButton(properties) { From 18682d854c9ff630ed415e4f6b0dcb2c26ad748a Mon Sep 17 00:00:00 2001 From: Cristian Luis Duarte Date: Fri, 16 Mar 2018 15:06:12 -0300 Subject: [PATCH 2/3] Android bottom bar - Put height up at the top of the Item definition it's clearer where relocateAndResize gets its height from --- interface/resources/qml/hifi/+android/bottombar.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/+android/bottombar.qml b/interface/resources/qml/hifi/+android/bottombar.qml index c6fa431baf..e0516425bb 100644 --- a/interface/resources/qml/hifi/+android/bottombar.qml +++ b/interface/resources/qml/hifi/+android/bottombar.qml @@ -25,6 +25,7 @@ import "." Item { id: bar x:0 + height: 255; property bool shown: true @@ -117,7 +118,6 @@ Item { Component.onCompleted: { // put on bottom - height = 255; relocateAndResize(Window.innerWidth, Window.innerHeight); Window.geometryChanged.connect(onWindowGeometryChanged); // In devices with bars appearing at startup we should listen for this } From e6a8b322b113483218bb84fd556b4c4b02d56837 Mon Sep 17 00:00:00 2001 From: Cristian Luis Duarte Date: Fri, 16 Mar 2018 15:15:00 -0300 Subject: [PATCH 3/3] Android bottom bar - remove extra semicolon --- interface/resources/qml/hifi/+android/bottombar.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/+android/bottombar.qml b/interface/resources/qml/hifi/+android/bottombar.qml index e0516425bb..66117d0389 100644 --- a/interface/resources/qml/hifi/+android/bottombar.qml +++ b/interface/resources/qml/hifi/+android/bottombar.qml @@ -25,7 +25,7 @@ import "." Item { id: bar x:0 - height: 255; + height: 255 property bool shown: true