Commit ba597e1d authored by Devin Lin's avatar Devin Lin 🎨
Browse files

homescreens/halcyon: Turn off layer, and use handlers for grid delegates

parent d3a0aa48
Pipeline #196688 canceled with stage
......@@ -64,8 +64,8 @@ Item {
Connections {
target: actionDrawer
onOpenedChanged: {
if(!actionDrawer.opened) {
function onOpenedChanged() {
if (!actionDrawer.opened) {
resetSwipeView();
}
}
......
......@@ -17,7 +17,6 @@ import org.kde.phone.homescreen.halcyon 1.0 as Halcyon
GridView {
id: root
layer.enabled: true // cache
required property var searchWidget
signal openConfigureRequested()
......
......@@ -20,7 +20,7 @@ import org.kde.phone.homescreen.halcyon 1.0 as Halcyon
import org.kde.kirigami 2.19 as Kirigami
MobileShell.ExtendedAbstractButton {
Item {
id: delegate
width: GridView.view.cellWidth
height: GridView.view.cellHeight
......@@ -39,11 +39,6 @@ MobileShell.ExtendedAbstractButton {
dialogLoader.item.open();
}
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onPressAndHold: openContextMenu()
onRightClickPressed: openContextMenu()
function launchApp() {
// launch app
if (application.running) {
......@@ -53,6 +48,32 @@ MobileShell.ExtendedAbstractButton {
}
}
TapHandler {
id: tapHandler
acceptedButtons: Qt.LeftButton | Qt.RightButton
// launch app handled by press animation
onTapped: (eventPoint.event.button === Qt.RightButton) ? delegate.openContextMenu() : delegate.launchAppRequested = true;
onLongPressed: delegate.openContextMenu()
onPressedChanged: {
if (pressed) {
growAnim.stop();
shrinkAnim.restart();
} else if (!pressed && !shrinkAnim.running) {
growAnim.restart();
}
}
gesturePolicy: TapHandler.ReleaseWithinBounds
}
HoverHandler {
id: hoverHandler
cursorShape: Qt.PointingHandCursor
acceptedPointerTypes: PointerDevice.GenericPointer | PointerDevice.Cursor | PointerDevice.Pen
}
Loader {
id: dialogLoader
active: false
......@@ -89,7 +110,7 @@ MobileShell.ExtendedAbstractButton {
duration: MobileShell.MobileShellSettings.animationsEnabled ? 80 : 1
to: MobileShell.MobileShellSettings.animationsEnabled ? 0.8 : 1
onFinished: {
if (!delegate.pressed) {
if (!tapHandler.pressed) {
growAnim.restart();
}
}
......@@ -108,17 +129,6 @@ MobileShell.ExtendedAbstractButton {
}
}
onPressedChanged: {
if (pressed) {
growAnim.stop();
shrinkAnim.restart();
} else if (!pressed && !shrinkAnim.running) {
growAnim.restart();
}
}
// launch app handled by press animation
onClicked: launchAppRequested = true;
ColumnLayout {
anchors {
fill: parent
......@@ -154,7 +164,7 @@ MobileShell.ExtendedAbstractButton {
// darken effect when hovered/pressed
layer {
enabled: delegate.pressed || delegate.hovered
enabled: tapHandler.pressed || hoverHandler.hovered
effect: ColorOverlay {
color: Qt.rgba(0, 0, 0, 0.3)
}
......
......@@ -19,7 +19,6 @@ import org.kde.phone.homescreen.halcyon 1.0 as Halcyon
GridView {
id: gridView
layer.enabled: true // caching
readonly property int reservedSpaceForLabel: metrics.height
required property real effectiveContentWidth
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment