feat(desktop/searchMessage) Updating highlight animation

Added animation to highlight selected message
from search popup. Currenly when a message is clicked
from the search results, the user is navigated to
that message but it's not clear where is the
message in the screen

Closes #3562
This commit is contained in:
Alexandra Betouni 2021-09-22 11:25:55 +03:00 committed by Iuri Matias
parent e66f95c436
commit 16d6196aea
4 changed files with 47 additions and 4 deletions

View File

@ -112,7 +112,7 @@ Item {
} }
function positionAtMessage(messageId) { function positionAtMessage(messageId) {
stackLayoutChatMessages.children[stackLayoutChatMessages.currentIndex].item.scrollToMessage(messageId) stackLayoutChatMessages.children[stackLayoutChatMessages.currentIndex].message.scrollToMessage(messageId)
} }
Timer { Timer {
@ -303,7 +303,9 @@ Item {
model: chatsModel.messageView model: chatsModel.messageView
ColumnLayout { ColumnLayout {
property alias chatInput: chatInput property alias chatInput: chatInput
property alias message: messageLoader.item
Loader { Loader {
id: messageLoader
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true

View File

@ -61,7 +61,10 @@ Item {
for (let i = 0; i < messageListDelegate.count; i++) { for (let i = 0; i < messageListDelegate.count; i++) {
item = messageListDelegate.items.get(i) item = messageListDelegate.items.get(i)
if (item.model.messageId === messageId) { if (item.model.messageId === messageId) {
chatLogView.positionViewAtIndex(i, ListView.Center) chatLogView.positionViewAtIndex(i, ListView.Center);
if (appSettings.useCompactMode) {
chatLogView.itemAtIndex(i).startMessageFoundAnimation();
}
return return
} }
} }

View File

@ -140,6 +140,10 @@ Item {
} }
} }
function startMessageFoundAnimation() {
messageLoader.item.startMessageFoundAnimation();
}
Connections { Connections {
enabled: !placeholderMessage enabled: !placeholderMessage
target: profileModel.contacts.list target: profileModel.contacts.list
@ -206,6 +210,7 @@ Item {
} }
Loader { Loader {
id: messageLoader
width: parent.width width: parent.width
sourceComponent: { sourceComponent: {
switch(contentType) { switch(contentType) {

View File

@ -82,6 +82,40 @@ Item {
isActivityCenterMessage: activityCenterMessage isActivityCenterMessage: activityCenterMessage
} }
function startMessageFoundAnimation() {
messageFoundAnimation.start();
}
SequentialAnimation {
id: messageFoundAnimation
PauseAnimation {
duration: 600
}
NumberAnimation {
target: highlightRect
property: "opacity"
to: 1.0
duration: 1500
}
PauseAnimation {
duration: 1000
}
NumberAnimation {
target: highlightRect
property: "opacity"
to: 0.0
duration: 1500
}
}
Rectangle {
id: highlightRect
anchors.fill: messageContainer
opacity: 0
visible: (opacity > 0.001)
color: Style.current.backgroundHoverLight
}
Rectangle { Rectangle {
property alias chatText: chatText property alias chatText: chatText
@ -97,7 +131,6 @@ Item {
+ (pinnedRectangleLoader.active ? Style.current.smallPadding : 0) + (pinnedRectangleLoader.active ? Style.current.smallPadding : 0)
+ (isEdit ? 25 : 0) + (isEdit ? 25 : 0)
width: parent.width width: parent.width
color: { color: {
if (isEdit) { if (isEdit) {
return Style.current.backgroundHoverLight return Style.current.backgroundHoverLight
@ -116,7 +149,7 @@ Item {
} }
return root.isHovered || isMessageActive ? (hasMention ? Style.current.mentionMessageHoverColor : Style.current.backgroundHoverLight) : return root.isHovered || isMessageActive ? (hasMention ? Style.current.mentionMessageHoverColor : Style.current.backgroundHoverLight) :
(hasMention ? Style.current.mentionMessageColor : Style.current.transparent) (hasMention ? Style.current.mentionMessageColor : Style.current.transparent)
} }
Loader { Loader {