Commit 7b20b950 authored by m2ko's avatar m2ko

Fix lockscreen scaling maybe and animations

parent bf4f7bf4
...@@ -166,8 +166,10 @@ Page { ...@@ -166,8 +166,10 @@ Page {
visible: DeviceLock.state == DeviceLock.Locked && codepadVisible visible: DeviceLock.state == DeviceLock.Locked && codepadVisible
width: lockScreen.width width: lockScreen.width
height:lockScreen.height / 2 height:lockScreen.height / 2
anchors {
verticalCenter: lockScreen.verticalCenter
}
anchors.centerIn: lockScreen
z: 200 z: 200
} }
......
...@@ -135,7 +135,7 @@ Compositor { ...@@ -135,7 +135,7 @@ Compositor {
property real lockThreshold: 0.25 property real lockThreshold: 0.25
property int lockscreenX property int lockscreenX
property int lockscreenY property int lockscreenY
enabled: !Desktop.instance.codepadVisible//DeviceLock.state != DeviceLock.Locked enabled: true//!Desktop.instance.codepadVisible//DeviceLock.state != DeviceLock.Locked
onGestureStarted: { onGestureStarted: {
swipeAnimation.stop() swipeAnimation.stop()
...@@ -144,6 +144,15 @@ Compositor { ...@@ -144,6 +144,15 @@ Compositor {
if (root.appActive) { if (root.appActive) {
state = "swipe" state = "swipe"
} }
else if (!root.appActive && DeviceLock.state !== DeviceLock.Locked) {
state = "lock"
}
else if (Desktop.instance.lockscreenVisible() && DeviceLock.state === DeviceLock.Locked && !Desktop.instance.codepadVisible) {
state = "pullCodepad"
}
else if (Desktop.instance.lockscreenVisible() && DeviceLock.state === DeviceLock.Locked && Desktop.instance.codepadVisible) {
state = "pushCodepad"
}
} }
onGestureFinished: { onGestureFinished: {
...@@ -164,15 +173,19 @@ Compositor { ...@@ -164,15 +173,19 @@ Compositor {
-Desktop.instance.lockscreen.width) -Desktop.instance.lockscreen.width)
lockAnimation.start() lockAnimation.start()
// Locks, unlocks or brings up codepad to enter security code // Locks, unlocks or brings up codepad to enter security code
//Locks // Locks
if (!Desktop.instance.lockscreenVisible()) { if (!Desktop.instance.lockscreenVisible()) {
Desktop.instance.setLockScreen(true) Desktop.instance.setLockScreen(true)
} }
//Brings up codepad // Brings up codepad, only left and right swipes allowed for it for now
else if (Desktop.instance.lockscreenVisible() && !Desktop.instance.codepad.visible && DeviceLock.state == DeviceLock.Locked) { else if (Desktop.instance.lockscreenVisible() && !Desktop.instance.codepad.visible && DeviceLock.state == DeviceLock.Locked && (gesture !== "down" && gesture !== "up")) {
Desktop.instance.codepadVisible = true Desktop.instance.codepadVisible = true
} }
//Unlocks if no security code required // Hides codepad but does not unlock the code, only left and right swipes allowed for now
else if (Desktop.instance.lockscreenVisible() && Desktop.instance.codepad.visible && DeviceLock.state == DeviceLock.Locked && gesture !== "down" && gesture !== "up") {
Desktop.instance.codepadVisible = false
}
// Unlocks if no security code required
else if (DeviceLock.state !== DeviceLock.Locked && Desktop.instance.lockscreenVisible()) { else if (DeviceLock.state !== DeviceLock.Locked && Desktop.instance.lockscreenVisible()) {
Desktop.instance.setLockScreen(false) Desktop.instance.setLockScreen(false)
} }
...@@ -181,8 +194,9 @@ Compositor { ...@@ -181,8 +194,9 @@ Compositor {
} }
} }
} }
// States are for the animations that follow your finger during swipes
states: [ states: [
// Swipe state is when app is on and you are swiping it to background or closing it
State { State {
name: "swipe" name: "swipe"
when: !Desktop.instance.codepadVisible when: !Desktop.instance.codepadVisible
...@@ -197,6 +211,7 @@ Compositor { ...@@ -197,6 +211,7 @@ Compositor {
y: gestureArea.horizontal ? 0 : gestureArea.value y: gestureArea.horizontal ? 0 : gestureArea.value
} }
}, },
// Lock state is for when screen is locked but no security code required, can be swiped from any edge
State { State {
name: "lock" name: "lock"
when: Desktop.instance.lockscreenVisible() when: Desktop.instance.lockscreenVisible()
...@@ -227,7 +242,65 @@ Compositor { ...@@ -227,7 +242,65 @@ Compositor {
Desktop.instance.lockscreen.height : Desktop.instance.lockscreen.height :
Desktop.instance.lockscreen.width)+gestureArea.value) ) ) Desktop.instance.lockscreen.width)+gestureArea.value) ) )
} }
},
// pullCodepad is when you are pulling codepad into view to enter security code
State {
name: "pullCodepad"
when: Desktop.instance.codepadVisible
PropertyChanges {
target: Desktop.instance
codepadVisible: true
}
PropertyChanges {
target: gestureArea
delayReset: true
}
PropertyChanges {
target: Desktop.instance.codepad
// Extremely confusing logic and math to get the codepad follow your finger
x: gestureArea.lockscreenX + (gestureArea.value < 0 ? Desktop.instance.lockscreen.width : -Desktop.instance.lockscreen.width) +
((gestureArea.horizontal) ? (Desktop.instance.lockscreenVisible()?(gestureArea.value) :
(gestureArea.gesture == "right" ?
((Desktop.instance.lockscreen.width === topmostWindow.width) ?
-Desktop.instance.lockscreen.width :
-Desktop.instance.lockscreen.height)+Math.abs(gestureArea.value) :
((Desktop.instance.lockscreen.width === topmostWindow.width) ?
Desktop.instance.lockscreen.width :
Desktop.instance.lockscreen.height)+gestureArea.value) ) : 0 )
// Bringing up the codepad opacity from 0 to 1
opacity: gestureArea.horizontal ? (gestureArea.value < 0 ? (gestureArea.value / -Desktop.instance.lockscreen.width) :
gestureArea.value / Desktop.instance.lockscreen.width) : 0
}
},
// pushCodepad is when you are pushing the codepad away without entering a security code
State {
name: "pushCodepad"
when: Desktop.instance.lockscreenVisible() && DeviceLock.state === DeviceLock.Locked && Desktop.instance.codepadVisible
PropertyChanges {
target: gestureArea
delayReset: true
}
PropertyChanges {
target: Desktop.instance.codepad
// Confusing logic for the codepad to follow your swipe
x: gestureArea.lockscreenX +
((gestureArea.horizontal) ? (Desktop.instance.lockscreenVisible()?(gestureArea.value) :
(gestureArea.gesture == "right" ?
((Desktop.instance.lockscreen.width === topmostWindow.width) ?
-Desktop.instance.lockscreen.width :
-Desktop.instance.lockscreen.height)+Math.abs(gestureArea.value) :
((Desktop.instance.lockscreen.width === topmostWindow.width) ?
Desktop.instance.lockscreen.width :
Desktop.instance.lockscreen.height)+gestureArea.value) ) : 0 )
// Hiding the codepad with opacity fading from 1 to 0
opacity: 1 - (gestureArea.horizontal ? (gestureArea.value < 0 ? (gestureArea.value / -Desktop.instance.lockscreen.width) :
gestureArea.value / Desktop.instance.lockscreen.width) : 0)
}
} }
] ]
SequentialAnimation { SequentialAnimation {
...@@ -248,23 +321,6 @@ Compositor { ...@@ -248,23 +321,6 @@ Compositor {
} }
} }
SequentialAnimation {
id: codePadAnimation
property alias valueTo: valueAnimationCode.to
SmoothedAnimation {
id: valueAnimationCode
target: Desktop.instance.codepad
property: "opacity"
easing.type: Easing.OutQuint
}
PropertyAction {
target: gestureArea
property: "state"
value: ""
}
}
SequentialAnimation { SequentialAnimation {
id: lockAnimation id: lockAnimation
property alias valueTo: valueAnimationLock.to property alias valueTo: valueAnimationLock.to
...@@ -273,6 +329,7 @@ Compositor { ...@@ -273,6 +329,7 @@ Compositor {
id: valueAnimationLock id: valueAnimationLock
target: Desktop.instance.lockscreen target: Desktop.instance.lockscreen
property: "x" property: "x"
velocity: 1
easing.type: Easing.OutQuint easing.type: Easing.OutQuint
} }
...@@ -328,8 +385,10 @@ Compositor { ...@@ -328,8 +385,10 @@ Compositor {
} }
onDisplayOff: onDisplayOff:
if (root.topmostAlarmWindow == null) if (root.topmostAlarmWindow == null) {
Desktop.instance.codepadVisible = false
setCurrentWindow(root.homeWindow) setCurrentWindow(root.homeWindow)
}
onWindowAdded: { onWindowAdded: {
console.log("Compositor: Window added \"" + window.title + "\"" + " category: " + window.category) console.log("Compositor: Window added \"" + window.title + "\"" + " category: " + window.category)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment