1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-03 02:52:07 -04:00

(Notifications): Update body card expansions

This commit is contained in:
purian23
2026-04-16 16:00:33 -04:00
parent ec972f1789
commit 3caf17b37c
5 changed files with 191 additions and 31 deletions

View File

@@ -15,6 +15,7 @@ Rectangle {
property bool userInitiatedExpansion: false
property bool isAnimating: false
property bool animateExpansion: true
property bool isDescriptionToggleAnimation: false
property bool _retainedExpandedContent: false
property bool _clipAnimatedContent: false
property real expandedContentOpacity: expanded ? 1 : 0
@@ -63,6 +64,8 @@ Rectangle {
}
function expansionMotionDuration() {
if (isDescriptionToggleAnimation)
return descriptionExpanded ? Theme.notificationInlineExpandDuration : Theme.notificationInlineCollapseDuration;
return root.connectedFrameMode ? Theme.variantDuration(Theme.popoutAnimationDuration, root.expanded) : (root.expanded ? Theme.notificationExpandDuration : Theme.notificationCollapseDuration);
}
@@ -411,6 +414,7 @@ Rectangle {
onClicked: mouse => {
if (!parent.hoveredLink && (parent.hasMoreText || descriptionExpanded)) {
root.userInitiatedExpansion = true;
root.isDescriptionToggleAnimation = true;
const messageId = (notificationGroup && notificationGroup.latestNotification && notificationGroup.latestNotification.notification && notificationGroup.latestNotification.notification.id) ? (notificationGroup.latestNotification.notification.id + "_desc") : "";
NotificationService.toggleMessageExpansion(messageId);
Qt.callLater(() => {
@@ -420,7 +424,7 @@ Rectangle {
}
}
propagateComposedEvents: true
propagateComposedEvents: false
onPressed: mouse => {
if (parent.hoveredLink)
mouse.accepted = false;
@@ -577,7 +581,12 @@ Rectangle {
}
Behavior on height {
enabled: false
enabled: expandedDelegateWrapper.__delegateInitialized && root.animateExpansion && root.userInitiatedExpansion
NumberAnimation {
duration: root.expansionMotionDuration()
easing.type: Easing.BezierSpline
easing.bezierCurve: root.expansionMotionCurve()
}
}
Item {
@@ -714,6 +723,7 @@ Rectangle {
onClicked: mouse => {
if (!parent.hoveredLink && (bodyText.hasMoreText || messageExpanded)) {
root.userInitiatedExpansion = true;
root.isDescriptionToggleAnimation = true;
NotificationService.toggleMessageExpansion(modelData?.notification?.id || "");
Qt.callLater(() => {
if (root && !root.isAnimating)
@@ -722,7 +732,7 @@ Rectangle {
}
}
propagateComposedEvents: true
propagateComposedEvents: false
onPressed: mouse => {
if (parent.hoveredLink) {
mouse.accepted = false;
@@ -983,6 +993,7 @@ Rectangle {
cursorShape: Qt.PointingHandCursor
onClicked: {
root.userInitiatedExpansion = true;
root.isDescriptionToggleAnimation = false;
NotificationService.toggleGroupExpansion(notificationGroup?.key || "");
}
z: -1
@@ -1006,6 +1017,7 @@ Rectangle {
buttonSize: compactMode ? 24 : 28
onClicked: {
root.userInitiatedExpansion = true;
root.isDescriptionToggleAnimation = false;
NotificationService.toggleGroupExpansion(notificationGroup?.key || "");
}
}
@@ -1032,6 +1044,7 @@ Rectangle {
} else {
root.isAnimating = false;
root.userInitiatedExpansion = false;
root.isDescriptionToggleAnimation = false;
root._retainedExpandedContent = false;
root._clipAnimatedContent = false;
}