A first attempt for an iOS swipe back gesture support
parent
522826fee7
commit
f463f3fc14
|
|
@ -279,5 +279,6 @@
|
|||
<file>ui/components/ActivityIndicator.qml</file>
|
||||
<file>ui/system/zigbee/ZigbeeNodePage.qml</file>
|
||||
<file>ui/utils/AirQualityIndex.qml</file>
|
||||
<file>ui/components/SwipeBackPage.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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: {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ import QtQuick.Layouts 1.1
|
|||
import Nymea 1.0
|
||||
import "../components"
|
||||
|
||||
Page {
|
||||
SwipeBackPage {
|
||||
id: root
|
||||
|
||||
property alias shownInterfaces: thingsProxyInternal.shownInterfaces
|
||||
|
|
|
|||
Loading…
Reference in New Issue