Skip to content
Snippets Groups Projects
Commit 1e7c712a authored by Andreas Traczyk's avatar Andreas Traczyk
Browse files

chatview: scale button animation along with opacity

Also uses behavior instead of states and suppresses the animation
during conversation load.

Change-Id: I7082fc7b04660236641b9aa0745356f5b09cdc52
parent 459b57c6
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,8 @@ ColumnLayout { ...@@ -32,6 +32,8 @@ ColumnLayout {
property alias text: textArea.text property alias text: textArea.text
property var textAreaObj: textArea property var textAreaObj: textArea
property real marginSize: 10 property real marginSize: 10
property bool sendButtonVisibility: false
property bool animate: false
signal sendMessageButtonClicked signal sendMessageButtonClicked
signal sendFileButtonClicked signal sendFileButtonClicked
...@@ -39,15 +41,6 @@ ColumnLayout { ...@@ -39,15 +41,6 @@ ColumnLayout {
signal videoRecordMessageButtonClicked signal videoRecordMessageButtonClicked
signal emojiButtonClicked signal emojiButtonClicked
function showSendMessageButton() {
sendMessageButton.visible = true
sendMessageButton.state = "buttonFadeOut"
}
function hideSendMessageButton() {
sendMessageButton.state = "buttonFadeIn"
}
implicitHeight: messageBarRowLayout.height implicitHeight: messageBarRowLayout.height
spacing: 0 spacing: 0
...@@ -181,7 +174,7 @@ ColumnLayout { ...@@ -181,7 +174,7 @@ ColumnLayout {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Layout.rightMargin: visible ? marginSize : 0 Layout.rightMargin: visible ? marginSize : 0
Layout.preferredWidth: JamiTheme.messageWebViewFooterButtonSize Layout.preferredWidth: scale * JamiTheme.messageWebViewFooterButtonSize
Layout.preferredHeight: JamiTheme.messageWebViewFooterButtonSize Layout.preferredHeight: JamiTheme.messageWebViewFooterButtonSize
radius: JamiTheme.messageWebViewFooterButtonRadius radius: JamiTheme.messageWebViewFooterButtonRadius
...@@ -194,37 +187,18 @@ ColumnLayout { ...@@ -194,37 +187,18 @@ ColumnLayout {
normalColor: JamiTheme.primaryBackgroundColor normalColor: JamiTheme.primaryBackgroundColor
imageColor: JamiTheme.messageWebViewFooterButtonImageColor imageColor: JamiTheme.messageWebViewFooterButtonImageColor
opacity: 0 opacity: sendButtonVisibility ? 1 : 0
visible: false visible: opacity
states: [ scale: opacity
State {
name: "buttonFadeIn" Behavior on opacity {
PropertyChanges { enabled: animate
target: sendMessageButton
opacity: 0
}
},
State {
name: "buttonFadeOut"
PropertyChanges {
target: sendMessageButton
opacity: 1
}
}
]
transitions: Transition {
NumberAnimation { NumberAnimation {
properties: "opacity" duration: JamiTheme.shortFadeDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
duration: 300
} }
} }
onOpacityChanged: {
if (opacity === 0)
visible = false
}
onClicked: root.sendMessageButtonClicked() onClicked: root.sendMessageButtonClicked()
} }
......
...@@ -53,6 +53,9 @@ Rectangle { ...@@ -53,6 +53,9 @@ Rectangle {
messageBar.text); messageBar.text);
} }
// turn off the button animations when switching convs
messageBar.animate = false
messageBar.textAreaObj.clearText() messageBar.textAreaObj.clearText()
previousConvId = LRCInstance.selectedConvUid previousConvId = LRCInstance.selectedConvUid
...@@ -60,6 +63,8 @@ Rectangle { ...@@ -60,6 +63,8 @@ Rectangle {
LRCInstance.currentAccountId); LRCInstance.currentAccountId);
if (restoredContent) if (restoredContent)
messageBar.textAreaObj.insertText(restoredContent) messageBar.textAreaObj.insertText(restoredContent)
messageBar.animate = true
} }
} }
...@@ -122,12 +127,8 @@ Rectangle { ...@@ -122,12 +127,8 @@ Rectangle {
Layout.preferredWidth: footerColumnLayout.width Layout.preferredWidth: footerColumnLayout.width
Layout.preferredHeight: implicitHeight Layout.preferredHeight: implicitHeight
onTextChanged: { sendButtonVisibility: text ||
if (text) dataTransferSendContainer.filesToSendCount
showSendMessageButton()
else if (!dataTransferSendContainer.filesToSendCount)
hideSendMessageButton()
}
onEmojiButtonClicked: { onEmojiButtonClicked: {
JamiQmlUtils.updateMessageBarButtonsPoints() JamiQmlUtils.updateMessageBarButtonsPoints()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment