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

View file

@ -32,6 +32,17 @@ MobileShell.GridView {
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
header: MobileShell.BaseItem {

View file

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