on xenial help sign in
improve the pin lockscreen

On smallish screens, like the BQ E4.5, it frequently happens that one misses a digit when quickly entering the pin. After a while of debugging usage on my phone I noticed that the cause of this is actually that the user keeps moving the finger while touching the buttons and so it often happens that the touch events are not recognized as clicks. I've been using this patch for a while now and it increased the reliability of the pin entry a lot. I've also asked other people who reported the issue to test this and feedback has been rather good. Approved by: Michael Terry

commita6f55213e01dcb68fc78b75db491981b1a073361 authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 27 Apr 2016, 15:00 (10 years ago) parent4b648c1134ef22
2 files changed+19−3
qml/Components/PinLockscreen.qml+2−1 qml/Components/PinPadButton.qml+17−2
qml/Components/PinLockscreen.qml+2−1
@@ -144,12 +144,13 @@ FocusScope {
144144
145145 AbstractButton {
146146 objectName: "backspaceIcon"
147− anchors { right: parent.right; top: parent.top; bottom: parent.bottom }
147+ anchors { right: parent.right; top: parent.top; bottom: parent.bottom; margins: -units.gu(1) }
148148 width: height
149149 enabled: root.entryEnabled
150150
151151 Icon {
152152 anchors.fill: parent
153+ anchors.margins: units.gu(1)
153154 name: "erase"
154155 color: root.foregroundColor
155156 }
qml/Components/PinPadButton.qml+17−2
@@ -17,7 +17,7 @@
1717import QtQuick 2.4
1818import Ubuntu.Components 1.3
1919
20−AbstractButton {
20+Item {
2121 id: root
2222 opacity: enabled ? 1 : 0.6
2323
@@ -25,9 +25,11 @@ AbstractButton {
2525 property string iconName
2626 property color foregroundColor: "#000000"
2727
28+ signal clicked();
29+
2830 UbuntuShape {
2931 anchors.fill: parent
30− opacity: root.pressed ? 1 : 0
32+ opacity: mouseArea.pressed ? 1 : 0
3133 Behavior on opacity {
3234 UbuntuNumberAnimation {}
3335 }
@@ -60,4 +62,17 @@ AbstractButton {
6062 UbuntuNumberAnimation { duration: UbuntuAnimation.SlowDuration }
6163 }
6264 }
65+
66+ MouseArea {
67+ id: mouseArea
68+ anchors.fill: parent
69+
70+ // Intentionally using onReleased here to increase the robustness against
71+ // sloppy presses. This often happens when entering a pin very quickly and
72+ // the numbers for the pin are far apart.
73+ onReleased: {
74+ Haptics.play();
75+ root.clicked();
76+ }
77+ }
6378}