Fade in images when fully recieved

This commit is contained in:
Loren Burkholder 2023-02-22 20:16:55 -05:00
parent 2b8cadaac8
commit 5abd2df9b4
2 changed files with 8 additions and 27 deletions

View file

@ -12,7 +12,7 @@ import im.nheko 1.0
Item { Item {
id: privacyScreen id: privacyScreen
readonly property bool active: screenSaver.state === "Visible" readonly property bool active: Settings.privacyScreen && screenSaver.state === "Visible"
property var timelineRoot property var timelineRoot
property int screenTimeout property int screenTimeout

View file

@ -28,15 +28,15 @@ AbstractButton {
height: width*proportionalHeight height: width*proportionalHeight
hoverEnabled: true hoverEnabled: true
state: img.status != Image.Ready ? "ImageLoading" : (timeline.privacyScreen.active ? "PrivacyScreenVisible" : "PrivacyScreenInvisible") state: (img.status != Image.Ready || timeline.privacyScreen.active) ? "BlurhashVisible" : "ImageVisible"
states: [ states: [
State { State {
name: "ImageLoading" name: "BlurhashVisible"
PropertyChanges { PropertyChanges {
target: blurhash_ target: blurhash_
opacity: 1 opacity: (img.status != Image.Ready) || (timeline.privacyScreen.active && blurhash) ? 1 : 0
visible: true visible: (img.status != Image.Ready) || (timeline.privacyScreen.active && blurhash)
} }
PropertyChanges { PropertyChanges {
@ -50,26 +50,7 @@ AbstractButton {
} }
}, },
State { State {
name: "PrivacyScreenVisible" name: "ImageVisible"
PropertyChanges {
target: blurhash_
opacity: blurhash ? 1 : 0
visible: blurhash ? true : false
}
PropertyChanges {
target: img
opacity: 0
}
PropertyChanges {
target: mxcimage
opacity: 0
}
},
State {
name: "PrivacyScreenInvisible"
PropertyChanges { PropertyChanges {
target: blurhash_ target: blurhash_
@ -90,8 +71,8 @@ AbstractButton {
] ]
transitions: [ transitions: [
Transition { Transition {
from: "PrivacyScreenInvisible" from: "ImageVisible"
to: "PrivacyScreenVisible" to: "BlurhashVisible"
reversible: true reversible: true
SequentialAnimation { SequentialAnimation {