cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ldel...@apache.org
Subject [1/5] git commit: changes to how 0 is getting added to array in order to align with w3c spec
Date Thu, 07 Aug 2014 17:28:25 GMT
Repository: cordova-plugin-vibration
Updated Branches:
  refs/heads/master 108e71220 -> d497660e2


changes to how 0 is getting added to array in order to align with w3c spec


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/commit/cf2a5afd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/tree/cf2a5afd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/diff/cf2a5afd

Branch: refs/heads/master
Commit: cf2a5afd7c9cc7685bccf14a057c1a22cf60e511
Parents: 48a9fd1
Author: Edna Morales <ednamorales@Ednas-MacBook-Pro-2.local>
Authored: Tue Jul 22 12:37:34 2014 -0400
Committer: Lisa Seacat DeLuca <ldeluca@us.ibm.com>
Committed: Thu Aug 7 12:51:23 2014 -0400

----------------------------------------------------------------------
 src/android/Vibration.java | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/cf2a5afd/src/android/Vibration.java
----------------------------------------------------------------------
diff --git a/src/android/Vibration.java b/src/android/Vibration.java
index b412f9a..d557976 100755
--- a/src/android/Vibration.java
+++ b/src/android/Vibration.java
@@ -51,9 +51,11 @@ public class Vibration extends CordovaPlugin {
         else if (action.equals("vibrateWithPattern")) {
             JSONArray pattern = args.getJSONArray(0);
             int repeat = args.getInt(1);
-            long[] patternArray = new long[pattern.length()];
+            //add a 0 at the beginning of pattern to align with w3c
+            long[] patternArray = new long[pattern.length()+1];
+            patternArray[0] = 0;
             for (int i = 0; i < pattern.length(); i++) {
-                patternArray[i] = pattern.getLong(i);
+                patternArray[i+1] = pattern.getLong(i);
             }
             this.vibrateWithPattern(patternArray, repeat);
         }
@@ -111,13 +113,7 @@ public class Vibration extends CordovaPlugin {
      */
     public void vibrateWithPattern(long[] pattern, int repeat) {
         Vibrator vibrator = (Vibrator) this.cordova.getActivity().getSystemService(Context.VIBRATOR_SERVICE);
-        
-        //add 0 at beginning of pattern to align with w3c spec
-        long[] newPattern = new long[pattern.length+1];
-        newPattern[0] = 0;
-        System.arraycopy(pattern, 0, newPattern, 1, pattern.length);
-        
-        vibrator.vibrate(newPattern, repeat);
+        vibrator.vibrate(pattern, repeat);
     }
 
     /**


Mime
View raw message