diff --git a/nymea-app/resources.qrc b/nymea-app/resources.qrc
index dc9eeaa6..6db88e7b 100644
--- a/nymea-app/resources.qrc
+++ b/nymea-app/resources.qrc
@@ -279,5 +279,6 @@
ui/components/ActivityIndicator.qml
ui/system/zigbee/ZigbeeNodePage.qml
ui/utils/AirQualityIndex.qml
+ ui/components/SwipeBackPage.qml
diff --git a/nymea-app/ui/MainPage.qml b/nymea-app/ui/MainPage.qml
index 1fff8b7b..b1ab4f0e 100644
--- a/nymea-app/ui/MainPage.qml
+++ b/nymea-app/ui/MainPage.qml
@@ -41,8 +41,9 @@ import "components"
import "delegates"
import "mainviews"
-Page {
+SwipeBackPage {
id: root
+ swipeEnabled: false
// Removing the background from this page only because the MainViewBase adds it again in
// a deepter layer as we need to include it in the blurring of the header and footer.
diff --git a/nymea-app/ui/Nymea.qml b/nymea-app/ui/Nymea.qml
index 16a176fa..bfc664e4 100644
--- a/nymea-app/ui/Nymea.qml
+++ b/nymea-app/ui/Nymea.qml
@@ -115,6 +115,7 @@ ApplicationWindow {
id: m
height: app.height
width: Math.min(300, app.width)
+ dragMargin: 0
// z: 1000
configuredHosts: configuredHostsModel
onOpenThingSettings: rootItem.openThingSettings();
@@ -127,6 +128,7 @@ ApplicationWindow {
onStartWirelessSetup: rootItem.startWirelessSetup();
}
+
RootItem {
id: rootItem
anchors.fill: parent
diff --git a/nymea-app/ui/RootItem.qml b/nymea-app/ui/RootItem.qml
index 2d856ccf..71392723 100644
--- a/nymea-app/ui/RootItem.qml
+++ b/nymea-app/ui/RootItem.qml
@@ -134,6 +134,25 @@ Item {
objectName: "pageStack"
anchors.fill: parent
initialItem: Page {}
+
+ pushEnter: Transition {
+ id: pushEnter
+ ParallelAnimation {
+ NumberAnimation { property: "x"; from: root.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
+ NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 400; easing.type: Easing.OutCubic }
+ }
+ }
+ pushExit: Transition {
+ id: pushExit
+ PropertyAction { property: "x"; value: pushExit.ViewTransition.item.pos.x }
+ PropertyAction { property: "y"; value: pushExit.ViewTransition.item.pos.y }
+ }
+ popEnter: Transition {
+ id: popEnter
+ PropertyAction { property: "x"; value: popEnter.ViewTransition.item.pos.x }
+ PropertyAction { property: "y"; value: popEnter.ViewTransition.item.pos.y }
+ }
+
}
Component.onCompleted: {
diff --git a/nymea-app/ui/components/SwipeBackPage.qml b/nymea-app/ui/components/SwipeBackPage.qml
new file mode 100644
index 00000000..a6dd6f00
--- /dev/null
+++ b/nymea-app/ui/components/SwipeBackPage.qml
@@ -0,0 +1,60 @@
+import QtQuick 2.0
+import QtQuick.Controls 2.2
+import Nymea 1.0
+
+ListView {
+ id: root
+ currentIndex: 1
+ orientation: ListView.Horizontal
+ property alias swipeEnabled: edgeDragArea.enabled
+
+ property alias header: contentItem.header
+ property alias children: contentItem.contentChildren
+ default property alias data: contentItem.contentData
+ property alias background: contentItem.background
+ snapMode: ListView.SnapToItem
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ interactive: false
+ StackView.visible: isSecondInStack || isTopMost
+
+ readonly property bool isTopMost: StackView.index == StackView.view.depth - 1
+ readonly property bool isSecondInStack: StackView.index == StackView.view.depth - 2
+ readonly property Item topMostItem: StackView.view.currentItem
+
+ onCurrentIndexChanged: {
+ if(currentIndex === 0) {
+ pageStack.pop()
+ console.log("popped")
+ }
+ }
+
+ model: VisualItemModel {
+ Item {
+ height: root.height
+ width: root.width
+ }
+
+ Page {
+ id: contentItem
+ height: root.height
+ width: root.width
+ }
+ }
+
+ MouseArea {
+ id: edgeDragArea
+ anchors {
+ top: parent.top
+ left: parent.left
+ bottom: parent.bottom
+ }
+ width: 10
+ onMouseXChanged: {
+ root.contentX = root.width - mouseX
+ }
+ onReleased: {
+ root.positionViewAtIndex(1, ListView.SnapPosition)
+ }
+ }
+}
+
diff --git a/nymea-app/ui/devicelistpages/ThingsListPageBase.qml b/nymea-app/ui/devicelistpages/ThingsListPageBase.qml
index badddc15..a82d0eae 100644
--- a/nymea-app/ui/devicelistpages/ThingsListPageBase.qml
+++ b/nymea-app/ui/devicelistpages/ThingsListPageBase.qml
@@ -35,7 +35,7 @@ import QtQuick.Layouts 1.1
import Nymea 1.0
import "../components"
-Page {
+SwipeBackPage {
id: root
property alias shownInterfaces: thingsProxyInternal.shownInterfaces