homescreens/halcyon: Properly implement home button trigger animations

This commit is contained in:
Devin Lin 2022-07-11 22:39:33 -04:00
parent e80408a921
commit cb71a7779f
3 changed files with 44 additions and 6 deletions

View file

@ -38,6 +38,16 @@ Item {
signal openConfigureRequested() signal openConfigureRequested()
function goToBeginning() {
goToBeginningAnim.restart();
}
function closeFolder() {
if (folderShown) {
folderShown = false;
}
}
FavoritesGrid { FavoritesGrid {
id: favoritesGrid id: favoritesGrid
anchors.fill: parent anchors.fill: parent
@ -77,7 +87,7 @@ Item {
twoColumn: root.twoColumn twoColumn: root.twoColumn
onOpenConfigureRequested: root.openConfigureRequested() onOpenConfigureRequested: root.openConfigureRequested()
onCloseRequested: root.folderShown = false onCloseRequested: root.closeFolder()
property real translateX: 0 property real translateX: 0
transform: Translate { x: folderGrid.translateX } transform: Translate { x: folderGrid.translateX }
@ -85,6 +95,15 @@ Item {
visible: opacity !== 0 visible: opacity !== 0
} }
NumberAnimation {
id: goToBeginningAnim
target: favoritesGrid
properties: 'contentY'
to: favoritesGrid.originY
duration: 200
easing.type: Easing.InOutQuad
}
SequentialAnimation { SequentialAnimation {
id: openFolderAnim id: openFolderAnim

View file

@ -32,6 +32,17 @@ MobileShell.GridView {
cacheBuffer: Math.max(0, rows * cellHeight) cacheBuffer: Math.max(0, rows * cellHeight)
function goToBeginning() {
goToBeginningAnim.restart();
}
NumberAnimation on contentY {
id: goToBeginningAnim
to: gridView.originY
duration: 200
easing.type: Easing.InOutQuad
}
model: Halcyon.ApplicationListModel model: Halcyon.ApplicationListModel
header: MobileShell.BaseItem { header: MobileShell.BaseItem {

View file

@ -25,6 +25,9 @@ Item {
function triggerHomescreen() { function triggerHomescreen() {
swipeView.setCurrentIndex(0); swipeView.setCurrentIndex(0);
favoritesView.closeFolder();
favoritesView.goToBeginning();
gridAppList.goToBeginning();
} }
function openConfigure() { function openConfigure() {
@ -53,6 +56,7 @@ Item {
} }
FavoritesView { FavoritesView {
id: favoritesView
anchors.fill: parent anchors.fill: parent
searchWidget: root.searchWidget searchWidget: root.searchWidget
interactive: root.interactive interactive: root.interactive
@ -67,13 +71,17 @@ Item {
property real horizontalMargin: Math.max(Kirigami.Units.largeSpacing, root.width * 0.1 / 2) property real horizontalMargin: Math.max(Kirigami.Units.largeSpacing, root.width * 0.1 / 2)
GridAppList { QQC2.ScrollView {
interactive: root.interactive
leftMargin: column.horizontalMargin
rightMargin: column.horizontalMargin
effectiveContentWidth: swipeView.width - leftMargin - rightMargin
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
GridAppList {
id: gridAppList
interactive: root.interactive
leftMargin: column.horizontalMargin
rightMargin: column.horizontalMargin
effectiveContentWidth: swipeView.width - leftMargin - rightMargin
}
} }
} }
} }