You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ld...@apache.org on 2014/08/07 18:58:41 UTC
[01/12] git commit: changes made to align with w3c spec
Repository: cordova-plugin-vibration
Updated Branches:
refs/heads/master 90c6e5f2e -> 108e71220
changes made 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/bf582d3e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/tree/bf582d3e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/diff/bf582d3e
Branch: refs/heads/master
Commit: bf582d3ea959d23cab84d273d35d9b7b9cbe3f62
Parents: 112254e
Author: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Authored: Fri Jul 18 09:19:53 2014 -0400
Committer: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Committed: Fri Jul 18 09:19:53 2014 -0400
----------------------------------------------------------------------
plugin.xml | 1 +
www/vibration.js | 41 +++++++++++++++++++++++++++++++++++++----
2 files changed, 38 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/bf582d3e/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 32c805e..bab6566 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -32,6 +32,7 @@
<js-module src="www/vibration.js" name="notification">
<merges target="navigator.notification" />
+ <merges target="navigator" />
</js-module>
<!-- firefoxos -->
http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/bf582d3e/www/vibration.js
----------------------------------------------------------------------
diff --git a/www/vibration.js b/www/vibration.js
index 34b16fb..d1206ed 100644
--- a/www/vibration.js
+++ b/www/vibration.js
@@ -28,12 +28,45 @@ var exec = require('cordova/exec');
module.exports = {
/**
- * Vibrates the device for a given amount of time.
+ * Vibrates the device for a given amount of time or for a given pattern or immediately cancels any ongoing vibrations (depending on the parameter).
*
- * @param {Integer} mills The number of milliseconds to vibrate.
+ * @param {Integer} param The number of milliseconds to vibrate (if 0, cancels vibration)
+ *
+ *
+ * @param {Array of Integer} param Pattern with which to vibrate the device.
+ * Pass in an array of integers that
+ * are the durations for which to
+ * turn on or off the vibrator in
+ * milliseconds. The first value
+ * indicates the number of milliseconds
+ * to wait before turning the vibrator
+ * on. The next value indicates the
+ * number of milliseconds for which
+ * to keep the vibrator on before
+ * turning it off. Subsequent values
+ * alternate between durations in
+ * milliseconds to turn the vibrator
+ * off or to turn the vibrator on.
+ * (if empty, cancels vibration)
*/
- vibrate: function(mills) {
- exec(null, null, "Vibration", "vibrate", [mills]);
+ vibrate: function(param) {
+
+ /* Aligning with w3c spec */
+
+ //vibrate
+ if ((typeof param == 'number') && param != 0)
+ exec(null, null, "Vibration", "vibrate", [param]);
+
+ //vibrate with a pattern
+ else if ((typeof param == 'object') && param.length != 0)
+ {
+ var repeat = -1; //no repeat
+ exec(null, null, "Vibration", "vibrateWithPattern", [param, repeat]);
+ }
+
+ //cancel vibration (param = 0 or [])
+ else
+ exec(null, null, "Vibration", "cancelVibration", []);
},
/**
[05/12] git commit: added new example to documentation
Posted by ld...@apache.org.
added new example to documentation
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/f46e00a7
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/tree/f46e00a7
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/diff/f46e00a7
Branch: refs/heads/master
Commit: f46e00a729aecd89902078994f5ba0e01bd1e352
Parents: 2098047
Author: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Authored: Wed Jul 23 11:33:07 2014 -0400
Committer: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Committed: Wed Jul 23 11:33:07 2014 -0400
----------------------------------------------------------------------
doc/index.md | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/f46e00a7/doc/index.md
----------------------------------------------------------------------
diff --git a/doc/index.md b/doc/index.md
index 20cede8..a96f831 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -85,6 +85,9 @@ Vibrates the device with a given pattern.
// Vibrate for 5 seconds
navigator.vibrate([1000, 1000, 3000, 1000, 5000]);
+ // Vibrate for 5 seconds
+ navigator.vibrate([5000]);
+
###Cancel vibration (not supported in iOS)
Immediately cancels any currently running vibration.
[07/12] git commit: vibrate([num]) is treated as a vibrate not
vibrate with pattern
Posted by ld...@apache.org.
vibrate([num]) is treated as a vibrate not vibrate with pattern
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/17441b74
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/tree/17441b74
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/diff/17441b74
Branch: refs/heads/master
Commit: 17441b748194efccec9227d21af2de763d5d362b
Parents: 7eedea3
Author: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Authored: Wed Jul 23 14:32:46 2014 -0400
Committer: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Committed: Wed Jul 23 14:32:46 2014 -0400
----------------------------------------------------------------------
www/vibration.js | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/17441b74/www/vibration.js
----------------------------------------------------------------------
diff --git a/www/vibration.js b/www/vibration.js
index 270a536..75e097b 100644
--- a/www/vibration.js
+++ b/www/vibration.js
@@ -58,8 +58,20 @@ module.exports = {
if ((typeof param == 'number') && param != 0)
exec(null, null, "Vibration", "vibrate", [param]);
+ //vibrate with array ( i.e. vibrate([3000]) )
+ else if ((typeof param == 'object') && param.length == 1)
+ {
+ //cancel if vibrate([0])
+ if (param[0] == 0)
+ exec(null, null, "Vibration", "cancelVibration", []);
+
+ //else vibrate
+ else
+ exec(null, null, "Vibration", "vibrate", [param[0]]);
+ }
+
//vibrate with a pattern
- else if ((typeof param == 'object') && param.length != 0)
+ else if ((typeof param == 'object') && param.length > 1)
{
var repeat = -1; //no repeat
exec(null, null, "Vibration", "vibrateWithPattern", [param, repeat]);
[06/12] git commit: added new example to documentation
Posted by ld...@apache.org.
added new example to documentation
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/7eedea3a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/tree/7eedea3a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/diff/7eedea3a
Branch: refs/heads/master
Commit: 7eedea3a9be0584f5020134870bfefcaa439214f
Parents: f46e00a
Author: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Authored: Wed Jul 23 11:43:29 2014 -0400
Committer: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Committed: Wed Jul 23 11:43:29 2014 -0400
----------------------------------------------------------------------
doc/index.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/7eedea3a/doc/index.md
----------------------------------------------------------------------
diff --git a/doc/index.md b/doc/index.md
index a96f831..8a09c49 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -60,13 +60,13 @@ Vibrates the device for a given amount of time.
- __time__: Ignores the specified time and vibrates for a pre-set amount of time.
- navigator.vibrate(3000); // 3000 is ignored
+ navigator.vibrate(3000); // 3000 is ignored
####Windows and Blackberry Quirks
- __time__: Max time is 5000ms (5s)
- navigator.vibrate(8000); // will be truncated to 5000
+ navigator.vibrate(8000); // will be truncated to 5000
###Vibrate with a pattern (Android only)
[04/12] git commit: updated doc for w3c alignment
Posted by ld...@apache.org.
updated doc for w3c alignment
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/2098047f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/tree/2098047f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/diff/2098047f
Branch: refs/heads/master
Commit: 2098047fb4a7cf5b1b30fdd6b267850e20692d71
Parents: 07f5c90
Author: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Authored: Tue Jul 22 14:03:23 2014 -0400
Committer: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Committed: Tue Jul 22 14:03:23 2014 -0400
----------------------------------------------------------------------
doc/index.md | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 64 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/2098047f/doc/index.md
----------------------------------------------------------------------
diff --git a/doc/index.md b/doc/index.md
index c517ce5..20cede8 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -27,6 +27,7 @@ This plugin provides a way to vibrate the device.
## Supported Platforms
+navigator.vibrate<br />
navigator.notification.vibrate
- Amazon Fire OS
- Android
@@ -38,7 +39,65 @@ navigator.notification.vibrate
navigator.notification.vibrateWithPattern,<br />navigator.notification.cancelVibration
- Android
-## notification.vibrate
+## vibrate (recommended)
+
+This function has three different functionalities based on parameters passed to it.
+
+###Standard vibrate
+
+Vibrates the device for a given amount of time.
+
+ navigator.vibrate(time)
+
+-__time__: Milliseconds to vibrate the device. _(Number)_
+
+####Example
+
+ // Vibrate for 3 seconds
+ navigator.vibrate(3000);
+
+####iOS Quirks
+
+- __time__: Ignores the specified time and vibrates for a pre-set amount of time.
+
+ navigator.vibrate(3000); // 3000 is ignored
+
+####Windows and Blackberry Quirks
+
+- __time__: Max time is 5000ms (5s)
+
+ navigator.vibrate(8000); // will be truncated to 5000
+
+###Vibrate with a pattern (Android only)
+
+Vibrates the device with a given pattern.
+
+ navigator.vibrate(pattern)
+
+- __pattern__: Sequence of durations (in milliseconds) for which to turn on or off the vibrator. _(Array of Numbers)_
+
+####Example
+
+ // Vibrate for 1 second
+ // Wait for 1 second
+ // Vibrate for 3 seconds
+ // Wait for 1 second
+ // Vibrate for 5 seconds
+ navigator.vibrate([1000, 1000, 3000, 1000, 5000]);
+
+###Cancel vibration (not supported in iOS)
+
+Immediately cancels any currently running vibration.
+
+ navigator.vibrate(0)
+
+or
+
+ navigator.vibrate([])
+
+Passing in a parameter of 0 or an empty array will cancel any vibrations.
+
+## *notification.vibrate (deprecated)
Vibrates the device for a given amount of time.
@@ -58,7 +117,7 @@ Vibrates the device for a given amount of time.
navigator.notification.vibrate();
navigator.notification.vibrate(2500); // 2500 is ignored
-## notification.vibrateWithPattern
+## *notification.vibrateWithPattern (deprecated)
Vibrates the device with a given pattern.
@@ -80,8 +139,10 @@ Vibrates the device with a given pattern.
// (do not repeat)
navigator.notification.vibrateWithPattern([0, 100, 100, 200, 100, 400, 100, 800]);
-## notification.cancelVibration
+## *notification.cancelVibration (deprecated)
Immediately cancels any currently running vibration.
navigator.notification.cancelVibration()
+
+*Note - due to alignment with w3c spec, the starred methods will be phased out
[09/12] git commit: update doc with another way to cancel vibration
Posted by ld...@apache.org.
update doc with another way to cancel vibration
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/816f97bd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/tree/816f97bd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/diff/816f97bd
Branch: refs/heads/master
Commit: 816f97bd64e40b756e84e26cdef2d7400fc75d31
Parents: 47cfb72
Author: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Authored: Tue Aug 5 11:19:36 2014 -0400
Committer: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Committed: Tue Aug 5 11:19:36 2014 -0400
----------------------------------------------------------------------
doc/index.md | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/816f97bd/doc/index.md
----------------------------------------------------------------------
diff --git a/doc/index.md b/doc/index.md
index 4535063..15e3c9c 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -102,7 +102,11 @@ or
navigator.vibrate([])
-Passing in a parameter of 0 or an empty array will cancel any vibrations.
+or
+
+ navigator.vibrate([0])
+
+Passing in a parameter of 0, an empty array, or an array with one element of value 0 will cancel any vibrations.
## *notification.vibrate (deprecated)
[08/12] git commit: update doc to show vibrate([num]) is a standard
vibrate
Posted by ld...@apache.org.
update doc to show vibrate([num]) is a standard vibrate
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/47cfb726
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/tree/47cfb726
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/diff/47cfb726
Branch: refs/heads/master
Commit: 47cfb7260505ee43243c81e8543d585eb04704db
Parents: 17441b7
Author: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Authored: Wed Jul 23 14:45:09 2014 -0400
Committer: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Committed: Wed Jul 23 14:45:09 2014 -0400
----------------------------------------------------------------------
doc/index.md | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/47cfb726/doc/index.md
----------------------------------------------------------------------
diff --git a/doc/index.md b/doc/index.md
index 8a09c49..4535063 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -49,6 +49,10 @@ Vibrates the device for a given amount of time.
navigator.vibrate(time)
+or
+
+ navigator.vibrate([time])
+
-__time__: Milliseconds to vibrate the device. _(Number)_
####Example
@@ -56,6 +60,9 @@ Vibrates the device for a given amount of time.
// Vibrate for 3 seconds
navigator.vibrate(3000);
+ // Vibrate for 3 seconds
+ navigator.vibrate([3000]);
+
####iOS Quirks
- __time__: Ignores the specified time and vibrates for a pre-set amount of time.
@@ -85,9 +92,6 @@ Vibrates the device with a given pattern.
// Vibrate for 5 seconds
navigator.vibrate([1000, 1000, 3000, 1000, 5000]);
- // Vibrate for 5 seconds
- navigator.vibrate([5000]);
-
###Cancel vibration (not supported in iOS)
Immediately cancels any currently running vibration.
[10/12] git commit: Added note to doc about w3c alignment and min
time for Windows
Posted by ld...@apache.org.
Added note to doc about w3c alignment and min time for Windows
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/8567f5b4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/tree/8567f5b4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/diff/8567f5b4
Branch: refs/heads/master
Commit: 8567f5b4e63ac9e74a83b53770687f51ef19e988
Parents: 816f97b
Author: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Authored: Thu Aug 7 11:07:43 2014 -0400
Committer: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Committed: Thu Aug 7 11:07:43 2014 -0400
----------------------------------------------------------------------
doc/index.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/8567f5b4/doc/index.md
----------------------------------------------------------------------
diff --git a/doc/index.md b/doc/index.md
index 15e3c9c..eef70c2 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -19,6 +19,8 @@
# org.apache.cordova.vibration
+This plugin aligns with the W3C vibration specification http://www.w3.org/TR/vibration/
+
This plugin provides a way to vibrate the device.
## Installation
@@ -71,7 +73,7 @@ or
####Windows and Blackberry Quirks
-- __time__: Max time is 5000ms (5s)
+- __time__: Max time is 5000ms (5s) and min time is 1ms
navigator.vibrate(8000); // will be truncated to 5000
[02/12] git commit: changes to vibration.java to align with w3c,
changes to vibration.js for backwards compatibility
Posted by ld...@apache.org.
changes to vibration.java to align with w3c, changes to vibration.js for backwards compatibility
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/1d0afd7d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/tree/1d0afd7d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/diff/1d0afd7d
Branch: refs/heads/master
Commit: 1d0afd7d0f5a5e0f3238117093d618bacbe5bb04
Parents: bf582d3
Author: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Authored: Mon Jul 21 16:24:40 2014 -0400
Committer: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Committed: Mon Jul 21 16:24:40 2014 -0400
----------------------------------------------------------------------
src/android/Vibration.java | 8 +++++++-
www/vibration.js | 14 ++++++++------
2 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/1d0afd7d/src/android/Vibration.java
----------------------------------------------------------------------
diff --git a/src/android/Vibration.java b/src/android/Vibration.java
index 9e82315..b412f9a 100755
--- a/src/android/Vibration.java
+++ b/src/android/Vibration.java
@@ -111,7 +111,13 @@ public class Vibration extends CordovaPlugin {
*/
public void vibrateWithPattern(long[] pattern, int repeat) {
Vibrator vibrator = (Vibrator) this.cordova.getActivity().getSystemService(Context.VIBRATOR_SERVICE);
- vibrator.vibrate(pattern, repeat);
+
+ //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);
}
/**
http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/1d0afd7d/www/vibration.js
----------------------------------------------------------------------
diff --git a/www/vibration.js b/www/vibration.js
index d1206ed..270a536 100644
--- a/www/vibration.js
+++ b/www/vibration.js
@@ -37,13 +37,14 @@ module.exports = {
* Pass in an array of integers that
* are the durations for which to
* turn on or off the vibrator in
- * milliseconds. The first value
- * indicates the number of milliseconds
- * to wait before turning the vibrator
- * on. The next value indicates the
+ * milliseconds. The FIRST value
+ * indicates the
* number of milliseconds for which
- * to keep the vibrator on before
- * turning it off. Subsequent values
+ * to keep the vibrator ON before
+ * turning it off. The NEXT value indicates the
+ * number of milliseconds for which
+ * to keep the vibrator OFF before
+ * turning it on. Subsequent values
* alternate between durations in
* milliseconds to turn the vibrator
* off or to turn the vibrator on.
@@ -93,6 +94,7 @@ module.exports = {
*/
vibrateWithPattern: function(pattern, repeat) {
repeat = (typeof repeat !== "undefined") ? repeat : -1;
+ pattern.unshift(0); //add a 0 at beginning for backwards compatibility from w3c spec
exec(null, null, "Vibration", "vibrateWithPattern", [pattern, repeat]);
},
[12/12] git commit: Merge branch 'CB-5459' of
https://github.com/eymorale/cordova-plugin-vibration
Posted by ld...@apache.org.
Merge branch 'CB-5459' of https://github.com/eymorale/cordova-plugin-vibration
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/108e7122
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/tree/108e7122
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/diff/108e7122
Branch: refs/heads/master
Commit: 108e712202fb58429853e57646c6d2946e75591c
Parents: 90c6e5f 413520b
Author: Lisa Seacat DeLuca <ld...@us.ibm.com>
Authored: Thu Aug 7 12:49:48 2014 -0400
Committer: Lisa Seacat DeLuca <ld...@us.ibm.com>
Committed: Thu Aug 7 12:49:48 2014 -0400
----------------------------------------------------------------------
doc/index.md | 80 +++++++++++++++++++++++++++++++++++++++--
plugin.xml | 1 +
src/android/Vibration.java | 6 ++--
www/vibration.js | 55 +++++++++++++++++++++++++---
4 files changed, 133 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/108e7122/plugin.xml
----------------------------------------------------------------------
[11/12] git commit: Updated doc with Windows support for vibrate with
pattern
Posted by ld...@apache.org.
Updated doc with Windows support for vibrate with pattern
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/413520ba
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/tree/413520ba
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/diff/413520ba
Branch: refs/heads/master
Commit: 413520ba7011ccd97e5f3905bee661f214bc2d9e
Parents: 8567f5b
Author: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Authored: Thu Aug 7 11:10:55 2014 -0400
Committer: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Committed: Thu Aug 7 11:10:55 2014 -0400
----------------------------------------------------------------------
doc/index.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/413520ba/doc/index.md
----------------------------------------------------------------------
diff --git a/doc/index.md b/doc/index.md
index eef70c2..9498643 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -77,7 +77,7 @@ or
navigator.vibrate(8000); // will be truncated to 5000
-###Vibrate with a pattern (Android only)
+###Vibrate with a pattern (Android and Windows only)
Vibrates the device with a given pattern.
[03/12] git commit: changes to how 0 is getting added to array in
order to align with w3c spec
Posted by ld...@apache.org.
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/07f5c903
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/tree/07f5c903
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/diff/07f5c903
Branch: refs/heads/master
Commit: 07f5c9037104b13a4f2aab14588fb123e27f9e9a
Parents: 1d0afd7
Author: Edna Morales <ed...@Ednas-MacBook-Pro-2.local>
Authored: Tue Jul 22 12:37:34 2014 -0400
Committer: Edna Morales <ed...@Ednas-MacBook-Pro-2.local>
Committed: Tue Jul 22 12:37:34 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/07f5c903/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);
}
/**