From 7c710d46f3124c305d6fa590f94687cde00ba424 Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Fri, 31 Dec 2021 00:18:35 -0500 Subject: [PATCH] taskswitcher: Bring back task preview if it doesn't close within 3 secs --- .../mobileshell/qml/taskswitcher/Task.qml | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/components/mobileshell/qml/taskswitcher/Task.qml b/components/mobileshell/qml/taskswitcher/Task.qml index d4a80d40..eb23b420 100644 --- a/components/mobileshell/qml/taskswitcher/Task.qml +++ b/components/mobileshell/qml/taskswitcher/Task.qml @@ -64,6 +64,13 @@ Item { width: parent.width height: parent.height + property bool movingUp: false + property real oldY: y + onYChanged: { + movingUp = y < oldY; + oldY = y; + } + // drag up gesture DragHandler { id: dragHandler @@ -78,7 +85,7 @@ Item { onActiveChanged: { yAnimator.stop(); - if (parent.y < -PlasmaCore.Units.gridUnit * 2) { + if (control.movingUp && parent.y < -PlasmaCore.Units.gridUnit * 2) { yAnimator.to = -root.height; } else { yAnimator.to = 0; @@ -87,6 +94,16 @@ Item { } } + // if the app doesn't close within a certain time, drag it back + Timer { + id: uncloseTimer + interval: 3000 + onTriggered: { + yAnimator.to = 0; + yAnimator.restart(); + } + } + NumberAnimation on y { id: yAnimator running: !dragHandler.active @@ -96,6 +113,7 @@ Item { onFinished: { if (to != 0) { // close app delegate.closeApp(); + uncloseTimer.start(); } } }