mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-04 12:52:06 -04:00
notifications: Refactor Animations
This commit is contained in:
@@ -13,6 +13,11 @@ DankListView {
|
||||
property alias count: listView.count
|
||||
property alias listContentHeight: listView.contentHeight
|
||||
property bool cardAnimateExpansion: true
|
||||
property bool listInitialized: false
|
||||
|
||||
Component.onCompleted: {
|
||||
Qt.callLater(() => { listInitialized = true; });
|
||||
}
|
||||
|
||||
clip: true
|
||||
model: NotificationService.groupedNotifications
|
||||
@@ -78,6 +83,11 @@ DankListView {
|
||||
property real swipeOffset: 0
|
||||
property bool isDismissing: false
|
||||
readonly property real dismissThreshold: width * 0.35
|
||||
property bool __delegateInitialized: false
|
||||
|
||||
Component.onCompleted: {
|
||||
Qt.callLater(() => { __delegateInitialized = true; });
|
||||
}
|
||||
|
||||
width: ListView.view.width
|
||||
height: isDismissing ? 0 : notificationCard.height
|
||||
@@ -89,7 +99,7 @@ DankListView {
|
||||
x: delegateRoot.swipeOffset
|
||||
notificationGroup: modelData
|
||||
keyboardNavigationActive: listView.keyboardActive
|
||||
animateExpansion: listView.cardAnimateExpansion
|
||||
animateExpansion: listView.cardAnimateExpansion && listView.listInitialized
|
||||
opacity: 1 - Math.abs(delegateRoot.swipeOffset) / (delegateRoot.width * 0.5)
|
||||
onIsAnimatingChanged: {
|
||||
if (isAnimating) {
|
||||
@@ -126,7 +136,7 @@ DankListView {
|
||||
}
|
||||
|
||||
Behavior on x {
|
||||
enabled: !swipeDragHandler.active
|
||||
enabled: !swipeDragHandler.active && listView.listInitialized
|
||||
NumberAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
@@ -134,8 +144,9 @@ DankListView {
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
enabled: listView.listInitialized
|
||||
NumberAnimation {
|
||||
duration: Theme.shortDuration
|
||||
duration: listView.listInitialized ? Theme.shortDuration : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user