View Single Post
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, Espaņa
#5
Yes, it looks like I can place it just about any where, but that is of no help when I don't know what to add to that code. I also don't believe that this particular code is necessary, I also think I need to move away from OpacityAnimator as my fade method.

If I don't set the text to fade, it remains on lockscreen each time I visit it, if I allow the fade to happen, the text won't spawn when visiting the lockscreen.

No matter, I'm rapidly going off the idea anyway, thanks for your input and congrats on your new job!, nice one!

As I opened the thread, I may as well park my code here anyway, so here is the working part of my GreetingText added into "../lockscreen/Clock.qml";

Code:
    Rectangle {
        id: rect
        width: 540; height: 54
        color: "transparent"
        anchors {
            horizontalCenter: parent.horizontalCenter
            bottom: parent.bottom
        }

        Text {
            id: greetingText
            color: Theme.primaryColor
            font { pixelSize: Theme.fontSizeMedium; capitalization: Font.Capitalize; }
            anchors {
                horizontalCenter: parent.horizontalCenter
                bottom: parent.bottom
                bottomMargin: Theme.paddingMedium
            }
            text: { updatesEnabled: timeText.time
                var greetingText;
                var time = new Date().getHours();
                if (time >= 0 && time < 12){
                    greetingText = "good <b>morning</b>";
                } else if (time >= 12 && time < 16){
                    greetingText = "good <b>afternoon</b>";
                } else if (time >= 16 && time < 21){
                    greetingText = "good <b>evening</b>";
                } else if (time >= 21 && time < 24){
                    greetingText = "good <b>night</b>";
                }
            }
            OpacityAnimator on opacity { 
                from: 1.0; to: 0.0; 
                duration: 20000; 
                loops: Animation.Running }
            }
        }
    }
}
The greeting only displays once after refreshing lipstick or rebooting. If I set 'loops' to 'Animation.Infinite' then the text reappears, but this is not the desired effect.

I'm now thinking, it would make more sense to have the greeting ONLY display on the turn of the given hours, so in reality it only shows the 4 different greetings once each in 24hrs rather than each time the lockscreen is visited.

Any additional code/ideas appreciated.
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..
 

The Following User Says Thank You to Markkyboy For This Useful Post: