1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-04 12:52:06 -04:00

notification: expand/collapse animation adjustment

This commit is contained in:
bbedward
2026-02-12 23:27:34 -05:00
parent 00e6172a68
commit 4fc275bead
4 changed files with 27 additions and 5 deletions

View File

@@ -11,16 +11,38 @@ DankListView {
property bool autoScrollDisabled: false
property bool isAnimatingExpansion: false
property alias listContentHeight: listView.contentHeight
property real stableContentHeight: 0
property bool cardAnimateExpansion: true
property bool listInitialized: false
Component.onCompleted: {
Qt.callLater(() => {
if (listView)
if (listView) {
listView.listInitialized = true;
listView.stableContentHeight = listView.contentHeight;
}
});
}
onContentHeightChanged: {
if (!isAnimatingExpansion)
stableContentHeight = contentHeight;
}
onIsAnimatingExpansionChanged: {
if (isAnimatingExpansion) {
let delta = 0;
for (let i = 0; i < count; i++) {
const item = itemAtIndex(i);
if (item && item.children[0] && item.children[0].isAnimating)
delta += item.children[0].targetHeight - item.height;
}
stableContentHeight = contentHeight + delta;
} else {
stableContentHeight = contentHeight;
}
}
clip: true
model: NotificationService.groupedNotifications
spacing: Theme.spacingL

View File

@@ -735,7 +735,7 @@ Rectangle {
NumberAnimation {
duration: root.expanded ? Theme.notificationExpandDuration : Theme.notificationCollapseDuration
easing.type: Easing.BezierSpline
easing.bezierCurve: root.expanded ? Theme.expressiveCurves.emphasizedDecel : Theme.expressiveCurves.emphasizedAccel
easing.bezierCurve: Theme.expressiveCurves.emphasized
onRunningChanged: {
if (running) {
root.isAnimating = true;

View File

@@ -113,7 +113,7 @@ DankPopout {
baseHeight += Theme.spacingM * 2;
const settingsHeight = notificationSettings.expanded ? notificationSettings.contentHeight : 0;
let listHeight = notificationHeader.currentTab === 0 ? notificationList.listContentHeight : Math.max(200, NotificationService.historyList.length * 80);
let listHeight = notificationHeader.currentTab === 0 ? notificationList.stableContentHeight : Math.max(200, NotificationService.historyList.length * 80);
if (notificationHeader.currentTab === 0 && NotificationService.groupedNotifications.length === 0) {
listHeight = 200;
}