@@ -18,6 +18,7 @@ import QtQuick 2.0
18import "../Components"
18import "../Components"
19import "../Components/Math.js" as MathLocal
19import "../Components/Math.js" as MathLocal
20import Unity 0.1
20import Unity 0.1
21+import Ubuntu.Application 0.1
21import Ubuntu.Gestures 0.1
22import Ubuntu.Gestures 0.1
@@ -28,15 +29,46 @@ Item {
29 property variant theHud
30 property variant theHud
30 property bool enabled: false
31 property bool enabled: false
32+ property bool preventHiding: dragArea.dragging
31 readonly property real bottomEdgeButtonCenterDistance: units.gu(34)
33 readonly property real bottomEdgeButtonCenterDistance: units.gu(34)
33− state: dragArea.status === DirectionalDragArea.Recognized ? "shown" : "hidden"
35+ state: "hidden"
38+ if (state == "hidden") {
41+ dismissTimer.restart()
45+ onPreventHidingChanged: {
46+ if (dismissTimer.running) {
47+ dismissTimer.restart();
55+ if (!bottombar.preventHiding) {
56+ bottombar.state = "hidden"
58+ dismissTimer.restart()
35 HudButton {
63 HudButton {
36 id: hudButton
64 id: hudButton
66+ readonly property bool centeredHud: parent.width < units.gu(68) // Nexus 7 has 67 gu width
38− x: MathLocal.clamp(dragArea.touchStartX - (width / 2), 0, bottombar.width - width)
68+ x: centeredHud ? parent.width / 2 - width / 2 : MathLocal.clamp(dragArea.touchStartX - (width / 2), 0, bottombar.width - width)
39 y: bottombar.height - bottomEdgeButtonCenterDistance - (height / 2) - bottomMargin
69 y: bottombar.height - bottomEdgeButtonCenterDistance - (height / 2) - bottomMargin
71+ visible: opacity != 0
41 mouseOver: {
73 mouseOver: {
42 if (dragArea.status === DirectionalDragArea.Recognized) {
74 if (dragArea.status === DirectionalDragArea.Recognized) {
@@ -55,13 +87,18 @@ Item {
57 Behavior on opacity {
89 Behavior on opacity {
58− NumberAnimation{ duration: 200; easing.type: Easing.OutCubic}
90+ NumberAnimation{duration: 200; easing.type: Easing.OutCubic}
62 Connections {
94 Connections {
63 target: theHud
95 target: theHud
64− onShownChanged: bottomBarVisibilityCommunicatorShell.forceHidden = theHud.shown
97+ bottomBarVisibilityCommunicatorShell.forceHidden = theHud.shown
99+ bottombar.state = "hidden"
67 EdgeDragArea {
104 EdgeDragArea {
@@ -70,6 +107,7 @@ Item {
70 height: distanceThreshold
107 height: distanceThreshold
71 anchors.bottom: parent.bottom
108 anchors.bottom: parent.bottom
110+ distanceThreshold: units.gu(8)
73 enabled: !theHud.shown && bottombar.enabled && applicationIsOnForeground
111 enabled: !theHud.shown && bottombar.enabled && applicationIsOnForeground
74 direction: Direction.Upwards
112 direction: Direction.Upwards
@@ -84,12 +122,29 @@ Item {
86 } else if (status === DirectionalDragArea.Undecided) {
124 } else if (status === DirectionalDragArea.Undecided) {
125+ if (!hudButton.centeredHud) {
87− touchStartX = touchX
126+ touchStartX = touchX
128+ } else if (status === DirectionalDragArea.Recognized) {
129+ bottombar.state = "shown"
89 previousStatus = status
131 previousStatus = status
136+ anchors.fill: parent
137+ enabled: bottombar.state == "shown"
139+ bottombar.state = "hidden"
144+ anchors.fill: parent
145+ blockInput: hudButton.visible
93 states: [
148 states: [
95 name: "hidden"
150 name: "hidden"
@@ -102,5 +157,4 @@ Item {
102 PropertyChanges { target: hudButton; bottomMargin: units.gu(0)}
157 PropertyChanges { target: hudButton; bottomMargin: units.gu(0)}