← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-keyboard-swipe-fix2 into lp:ubuntu-calculator-app

 

Bartosz Kosiorek has proposed merging lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-keyboard-swipe-fix2 into lp:ubuntu-calculator-app.

Commit message:
Keyboard swipe fix

Requested reviews:
  Ubuntu Calculator Developers (ubuntu-calculator-dev)
Related bugs:
  Bug #1442973 in Ubuntu Calculator App: "[reboot] Keyboard does not move back"
  https://bugs.launchpad.net/ubuntu-calculator-app/+bug/1442973

For more details, see:
https://code.launchpad.net/~gang65/ubuntu-calculator-app/ubuntu-calculator-app-keyboard-swipe-fix2/+merge/262393

Keyboard swipe fix
-- 
Your team Ubuntu Calculator Developers is requested to review the proposed merge of lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-keyboard-swipe-fix2 into lp:ubuntu-calculator-app.
=== modified file 'app/ubuntu-calculator-app.qml'
--- app/ubuntu-calculator-app.qml	2015-06-17 20:11:29 +0000
+++ app/ubuntu-calculator-app.qml	2015-06-18 21:38:28 +0000
@@ -167,7 +167,7 @@
             try {
                 shortFormula = formatBigNumber(mathJs.eval(shortFormula));
             } catch(exception) {
-                console.log("Error: math.js " + exception.toString() + " engine formula:" + shortFormula);
+                console.log("Info: Unable to create temporarly result " + exception.toString() + " formula:" + shortFormula);
             }
 
             isFormulaIsValidToCalculate = false;

=== modified file 'app/ui/CalcKeyboard.qml'
--- app/ui/CalcKeyboard.qml	2015-03-05 22:57:16 +0000
+++ app/ui/CalcKeyboard.qml	2015-06-18 21:38:28 +0000
@@ -22,8 +22,8 @@
     id: virtualKeyboard
     height: flickableKeyboard.height + units.gu(1)
 
-    property int pressedKey: -1
-    property string pressedKeyText: ""
+    property int pressedKey: -1;
+    property string pressedKeyText: "";
 
     default property alias children: keyboardsRow.children
 
@@ -38,21 +38,23 @@
 
         property int currentIndex: 0
 
-        onDragEnded: {
+        onMovementEnded: {
             var index = 0;
             if (horizontalVelocity > units.gu(50)) {
-                index = Math.min(keyboardsRow.children.length - 1, currentIndex + 1)
+                // Don't allow to change index above the number of keyboards
+                index = Math.min(keyboardsRow.children.length - 1, currentIndex + 1);
             } else if (horizontalVelocity < -units.gu(50)) {
-                index = Math.max(0, currentIndex - 1)
+                // Don't allow to change index below 0
+                index = Math.max(0, currentIndex - 1);
             } else {
-                index = Math.round(contentX / (width + keyboardsRow.spacing))
-                index = Math.max(0, index)
-                index = Math.min(keyboardsRow.children.length - 1, index)
+                index = Math.round(contentX / (width + keyboardsRow.spacing));
+                index = Math.max(0, index);
+                index = Math.min(keyboardsRow.children.length - 1, index);
             }
 
             currentIndex = index;
-            snapAnimation.to = index * (flickableKeyboard.width)
-            snapAnimation.start()
+            snapAnimation.to = index * (flickableKeyboard.width);
+            snapAnimation.start();
         }
 
         UbuntuNumberAnimation {


Follow ups