Commit 213faea6 authored by Devin Lin's avatar Devin Lin 🎨
Browse files

homescreens/halcyon: Add search widget open gesture

parent 61375dc4
Pipeline #194615 passed with stage
in 1 minute and 17 seconds
......@@ -21,15 +21,13 @@ GridView {
id: gridView
clip: true
signal launched
readonly property int reservedSpaceForLabel: metrics.height
cellWidth: width / Math.min(Math.floor(width / (PlasmaCore.Units.iconSizes.huge + Kirigami.Units.largeSpacing * 2)), 8)
cellHeight: cellWidth + reservedSpaceForLabel
property int columns: Math.floor(width / cellWidth)
property int rows: Math.ceil(model.count / columns)
property int rows: Math.ceil(Halcyon.ApplicationListModel.count / columns)
cacheBuffer: Math.max(0, rows * cellHeight)
......@@ -37,13 +35,13 @@ GridView {
header: Controls.Control {
implicitWidth: gridView.width
topPadding: PlasmaCore.Units.largeSpacing
topPadding: PlasmaCore.Units.largeSpacing + Math.round(gridView.height * 0.2)
bottomPadding: PlasmaCore.Units.largeSpacing
leftPadding: PlasmaCore.Units.smallSpacing
contentItem: PlasmaExtras.Heading {
contentItem: PC3.Label {
color: "white"
level: 1
font.pointSize: 16
font.weight: Font.Bold
text: i18n("Applications")
}
......@@ -78,7 +76,6 @@ GridView {
application.setMinimizedDelegate(delegate);
application.runApplication();
gridView.launched();
}
}
}
......@@ -58,12 +58,37 @@ Item {
id: favouritesList
clip: true
interactive: root.interactive
boundsMovement: Flickable.StopAtBounds
boundsBehavior: Flickable.DragOverBounds
property real delegateHeight: PlasmaCore.Units.gridUnit * 3
anchors.fill: parent
anchors.leftMargin: Math.round(parent.width * 0.1)
anchors.rightMargin: Math.round(parent.width * 0.1)
// search widget open gesture
property bool openingSearchWidget: false
property real oldVerticalOvershoot: verticalOvershoot
onVerticalOvershootChanged: {
if (dragging && verticalOvershoot < 0) {
if (!openingSearchWidget) {
openingSearchWidget = true;
root.searchWidget.startGesture();
}
let offset = -(verticalOvershoot - oldVerticalOvershoot);
root.searchWidget.updateGestureOffset(-offset);
}
oldVerticalOvershoot = verticalOvershoot;
}
onDraggingChanged: {
if (!dragging && openingSearchWidget) {
openingSearchWidget = false;
root.searchWidget.endGesture();
}
}
model: Halcyon.PinnedModel
header: MobileShell.BaseItem {
topPadding: Math.round(swipeView.height * 0.2)
......@@ -79,7 +104,6 @@ Item {
delegate: DrawerListDelegate {
id: delegate
width: favouritesList.width
height: visible ? favouritesList.delegateHeight : 0
}
......@@ -134,13 +158,6 @@ Item {
Layout.rightMargin: column.horizontalMargin
Layout.fillWidth: true
Layout.fillHeight: true
// open search widget when pulled down
onDraggingChanged: {
if (!dragging && (contentY < originY - PlasmaCore.Units.gridUnit * 3)) {
searchWidget.open();
}
}
}
}
}
......
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