RE: Standardized gestures

2013-04-18 Thread jbo...@openmv.com
On the short them, it would help solve 'Android fragmentation' problems:
https://github.com/android/platform_frameworks_base/blob/android-cts-4.0.3_r2/core/java/android/webkit/WebView.java#L6044

https://github.com/android/platform_frameworks_base/blob/master/core/java/android/webkit/WebViewClassic.java#L5824

Android doesn't exactly pass the touchstart etc.. events to webkit the same way 
and more importantly with the same delays. Not to mention, some versions have 
bugs (missing touchend, touchmove events).
If coding a pure HTML/javascript app, you can avoid the 'native' onTouch() 
processing and pass events faster to your app.  

It's an educated guess at the moment, but I'm quite sure performance / response 
time for the user on all platforms will be better if the gesture detection is 
done on the native side.  

On the long term, I don't see how JavaScript libraries would allow (within 
reasonable ms) for more complex 'gesture' detection. I would rather do 
something like:
webView.addGesture('swipe');
webView.addGesture('handgrab');
onTouch/Gesture: 
// do gesture detection in native code
   webView.sendJavascript(cordova.fireEvent('handgrab', {node, ...});


-Original Message-
From: Filip Maj [mailto:f...@adobe.com] 
Sent: Wednesday, April 17, 2013 12:47 PM
To: dev@cordova.apache.org
Subject: Re: Standardized gestures

I'm not convinced you need any additional code here.

Touch events are already fired by the web view containers. You could build up 
gesture detection in JavaScript by listening to these events.

There are libraries out there that do this for you already:

 - http://eightmedia.github.io/hammer.js/
 - http://quojs.tapquo.com/
 - https://github.com/plainview/Jester
 - jquery ui plugin: http://touchpunch.furf.com/
 - jquery plugin: http://labs.rampinteractive.co.uk/touchSwipe/demos/
 - moar jquery: https://github.com/HotStudio/touchy

On 4/17/13 9:42 AM, jbo...@openmv.com jbo...@openmv.com wrote:

I'm experimenting with Cordova on Android, iOS and Windows 8.

Has there been a discussion around trying to implement to set of 
'standard' gesture recognizers:
http://msdn.microsoft.com/library/windows/apps/BR241937
http://developer.apple.com/library/ios/#documentation/EventHandling/Con
cep 
tual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_b
asi
cs.html
http://developer.android.com/reference/android/view/GestureDetector.htm
l

The idea would be that the native side executes JavaScript like:
javascript:cordova.fireEvent('tap', {node: 
document.elementFromPoint(400, 300), x: 400, y:300 }); 
javascript:cordova.fireEvent('slide', {node:
document.elementFromPoint(400, 300), x: 400, y:300});

This function could use document.createEvent to initiate events on the 
DOM node:
https://developer.mozilla.org/en-US/docs/DOM/document.createEvent

The purpose of this would be to have a consistent set of gesture 
recognition across different devices instead of having javascript code 
in the 'WebView' trying to do gesture detection.

Thoughts? 






Re: Standardized gestures

2013-04-18 Thread Joe Bowser
I would rather try and fix the touchstart than have to add a bunch of
gestures in Java on this.  This feels like we're taking something away
from the Javascript developer, which is a bad thing IMO.  This might
be cool as a plugin, but I don't know if we should add it as a core
feature of Cordova.

On Thu, Apr 18, 2013 at 10:08 AM, jbo...@openmv.com jbo...@openmv.com wrote:
 On the short them, it would help solve 'Android fragmentation' problems:
 https://github.com/android/platform_frameworks_base/blob/android-cts-4.0.3_r2/core/java/android/webkit/WebView.java#L6044

 https://github.com/android/platform_frameworks_base/blob/master/core/java/android/webkit/WebViewClassic.java#L5824

 Android doesn't exactly pass the touchstart etc.. events to webkit the same 
 way and more importantly with the same delays. Not to mention, some versions 
 have bugs (missing touchend, touchmove events).
 If coding a pure HTML/javascript app, you can avoid the 'native' onTouch() 
 processing and pass events faster to your app.

 It's an educated guess at the moment, but I'm quite sure performance / 
 response time for the user on all platforms will be better if the gesture 
 detection is done on the native side.

 On the long term, I don't see how JavaScript libraries would allow (within 
 reasonable ms) for more complex 'gesture' detection. I would rather do 
 something like:
 webView.addGesture('swipe');
 webView.addGesture('handgrab');
 onTouch/Gesture:
 // do gesture detection in native code
webView.sendJavascript(cordova.fireEvent('handgrab', {node, ...});


 -Original Message-
 From: Filip Maj [mailto:f...@adobe.com]
 Sent: Wednesday, April 17, 2013 12:47 PM
 To: dev@cordova.apache.org
 Subject: Re: Standardized gestures

 I'm not convinced you need any additional code here.

 Touch events are already fired by the web view containers. You could build up 
 gesture detection in JavaScript by listening to these events.

 There are libraries out there that do this for you already:

  - http://eightmedia.github.io/hammer.js/
  - http://quojs.tapquo.com/
  - https://github.com/plainview/Jester
  - jquery ui plugin: http://touchpunch.furf.com/
  - jquery plugin: http://labs.rampinteractive.co.uk/touchSwipe/demos/
  - moar jquery: https://github.com/HotStudio/touchy

 On 4/17/13 9:42 AM, jbo...@openmv.com jbo...@openmv.com wrote:

I'm experimenting with Cordova on Android, iOS and Windows 8.

Has there been a discussion around trying to implement to set of
'standard' gesture recognizers:
http://msdn.microsoft.com/library/windows/apps/BR241937
http://developer.apple.com/library/ios/#documentation/EventHandling/Con
cep
tual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_b
asi
cs.html
http://developer.android.com/reference/android/view/GestureDetector.htm
l

The idea would be that the native side executes JavaScript like:
javascript:cordova.fireEvent('tap', {node:
document.elementFromPoint(400, 300), x: 400, y:300 });
javascript:cordova.fireEvent('slide', {node:
document.elementFromPoint(400, 300), x: 400, y:300});

This function could use document.createEvent to initiate events on the
DOM node:
https://developer.mozilla.org/en-US/docs/DOM/document.createEvent

The purpose of this would be to have a consistent set of gesture
recognition across different devices instead of having javascript code
in the 'WebView' trying to do gesture detection.

Thoughts?






Re: Standardized gestures

2013-04-18 Thread Jesse
Yes, it may have value. Consider writing a plugin.
The pointer events spec[1] may be of interest, as things like
tap/slide/pinch are all non-standard.
I did this exact same thing [2] for Windows Phone 7, as there aren't even
mouse events.
There are numerous things you need to be aware of when creating the event,
like the current zoom/scale of the page, + any panning, scrolling, css3
translations.
You also need to consider the way all DOM events bubble from the element to
the document and back up.
IMHO, Implementing this correctly is not for the faint of heart, and your
work may be negated at any time by a new browser.

Cheers,
  Jesse

[1]
http://www.w3.org/TR/pointerevents/
[2]
https://github.com/purplecabbage/cordova-wp7/blob/master/templates/standalone/cordovalib/BrowserMouseHelper.cs


@purplecabbage
risingj.com


On Thu, Apr 18, 2013 at 10:08 AM, jbo...@openmv.com jbo...@openmv.comwrote:

 On the short them, it would help solve 'Android fragmentation' problems:

 https://github.com/android/platform_frameworks_base/blob/android-cts-4.0.3_r2/core/java/android/webkit/WebView.java#L6044


 https://github.com/android/platform_frameworks_base/blob/master/core/java/android/webkit/WebViewClassic.java#L5824

 Android doesn't exactly pass the touchstart etc.. events to webkit the
 same way and more importantly with the same delays. Not to mention, some
 versions have bugs (missing touchend, touchmove events).
 If coding a pure HTML/javascript app, you can avoid the 'native' onTouch()
 processing and pass events faster to your app.

 It's an educated guess at the moment, but I'm quite sure performance /
 response time for the user on all platforms will be better if the gesture
 detection is done on the native side.

 On the long term, I don't see how JavaScript libraries would allow (within
 reasonable ms) for more complex 'gesture' detection. I would rather do
 something like:
 webView.addGesture('swipe');
 webView.addGesture('handgrab');
 onTouch/Gesture:
 // do gesture detection in native code
webView.sendJavascript(cordova.fireEvent('handgrab', {node, ...});


 -Original Message-
 From: Filip Maj [mailto:f...@adobe.com]
 Sent: Wednesday, April 17, 2013 12:47 PM
 To: dev@cordova.apache.org
 Subject: Re: Standardized gestures

 I'm not convinced you need any additional code here.

 Touch events are already fired by the web view containers. You could build
 up gesture detection in JavaScript by listening to these events.

 There are libraries out there that do this for you already:

  - http://eightmedia.github.io/hammer.js/
  - http://quojs.tapquo.com/
  - https://github.com/plainview/Jester
  - jquery ui plugin: http://touchpunch.furf.com/
  - jquery plugin: http://labs.rampinteractive.co.uk/touchSwipe/demos/
  - moar jquery: https://github.com/HotStudio/touchy

 On 4/17/13 9:42 AM, jbo...@openmv.com jbo...@openmv.com wrote:

 I'm experimenting with Cordova on Android, iOS and Windows 8.
 
 Has there been a discussion around trying to implement to set of
 'standard' gesture recognizers:
 http://msdn.microsoft.com/library/windows/apps/BR241937
 http://developer.apple.com/library/ios/#documentation/EventHandling/Con
 cep
 tual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_b
 asi
 cs.html
 http://developer.android.com/reference/android/view/GestureDetector.htm
 l
 
 The idea would be that the native side executes JavaScript like:
 javascript:cordova.fireEvent('tap', {node:
 document.elementFromPoint(400, 300), x: 400, y:300 });
 javascript:cordova.fireEvent('slide', {node:
 document.elementFromPoint(400, 300), x: 400, y:300});
 
 This function could use document.createEvent to initiate events on the
 DOM node:
 https://developer.mozilla.org/en-US/docs/DOM/document.createEvent
 
 The purpose of this would be to have a consistent set of gesture
 recognition across different devices instead of having javascript code
 in the 'WebView' trying to do gesture detection.
 
 Thoughts?
 






Re: Standardized gestures

2013-04-18 Thread Andrew Grieve
Agree as well! This would make for a great plugin. If there are things in
Java-land that aren't exposed to plugins that you need in order to make
this work, then we should change core to make them exposed.


On Thu, Apr 18, 2013 at 1:44 PM, Jesse purplecabb...@gmail.com wrote:

 Yes, it may have value. Consider writing a plugin.
 The pointer events spec[1] may be of interest, as things like
 tap/slide/pinch are all non-standard.
 I did this exact same thing [2] for Windows Phone 7, as there aren't even
 mouse events.
 There are numerous things you need to be aware of when creating the event,
 like the current zoom/scale of the page, + any panning, scrolling, css3
 translations.
 You also need to consider the way all DOM events bubble from the element to
 the document and back up.
 IMHO, Implementing this correctly is not for the faint of heart, and your
 work may be negated at any time by a new browser.

 Cheers,
   Jesse

 [1]
 http://www.w3.org/TR/pointerevents/
 [2]

 https://github.com/purplecabbage/cordova-wp7/blob/master/templates/standalone/cordovalib/BrowserMouseHelper.cs


 @purplecabbage
 risingj.com


 On Thu, Apr 18, 2013 at 10:08 AM, jbo...@openmv.com jbo...@openmv.com
 wrote:

  On the short them, it would help solve 'Android fragmentation' problems:
 
 
 https://github.com/android/platform_frameworks_base/blob/android-cts-4.0.3_r2/core/java/android/webkit/WebView.java#L6044
 
 
 
 https://github.com/android/platform_frameworks_base/blob/master/core/java/android/webkit/WebViewClassic.java#L5824
 
  Android doesn't exactly pass the touchstart etc.. events to webkit the
  same way and more importantly with the same delays. Not to mention, some
  versions have bugs (missing touchend, touchmove events).
  If coding a pure HTML/javascript app, you can avoid the 'native'
 onTouch()
  processing and pass events faster to your app.
 
  It's an educated guess at the moment, but I'm quite sure performance /
  response time for the user on all platforms will be better if the gesture
  detection is done on the native side.
 
  On the long term, I don't see how JavaScript libraries would allow
 (within
  reasonable ms) for more complex 'gesture' detection. I would rather do
  something like:
  webView.addGesture('swipe');
  webView.addGesture('handgrab');
  onTouch/Gesture:
  // do gesture detection in native code
 webView.sendJavascript(cordova.fireEvent('handgrab', {node, ...});
 
 
  -Original Message-
  From: Filip Maj [mailto:f...@adobe.com]
  Sent: Wednesday, April 17, 2013 12:47 PM
  To: dev@cordova.apache.org
  Subject: Re: Standardized gestures
 
  I'm not convinced you need any additional code here.
 
  Touch events are already fired by the web view containers. You could
 build
  up gesture detection in JavaScript by listening to these events.
 
  There are libraries out there that do this for you already:
 
   - http://eightmedia.github.io/hammer.js/
   - http://quojs.tapquo.com/
   - https://github.com/plainview/Jester
   - jquery ui plugin: http://touchpunch.furf.com/
   - jquery plugin: http://labs.rampinteractive.co.uk/touchSwipe/demos/
   - moar jquery: https://github.com/HotStudio/touchy
 
  On 4/17/13 9:42 AM, jbo...@openmv.com jbo...@openmv.com wrote:
 
  I'm experimenting with Cordova on Android, iOS and Windows 8.
  
  Has there been a discussion around trying to implement to set of
  'standard' gesture recognizers:
  http://msdn.microsoft.com/library/windows/apps/BR241937
  http://developer.apple.com/library/ios/#documentation/EventHandling/Con
  cep
  tual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_b
  asi
  cs.html
  http://developer.android.com/reference/android/view/GestureDetector.htm
  l
  
  The idea would be that the native side executes JavaScript like:
  javascript:cordova.fireEvent('tap', {node:
  document.elementFromPoint(400, 300), x: 400, y:300 });
  javascript:cordova.fireEvent('slide', {node:
  document.elementFromPoint(400, 300), x: 400, y:300});
  
  This function could use document.createEvent to initiate events on the
  DOM node:
  https://developer.mozilla.org/en-US/docs/DOM/document.createEvent
  
  The purpose of this would be to have a consistent set of gesture
  recognition across different devices instead of having javascript code
  in the 'WebView' trying to do gesture detection.
  
  Thoughts?
  
 
 
 
 



RE: Standardized gestures

2013-04-18 Thread jbo...@openmv.com
 Yes, it may have value. Consider writing a plugin.
 The pointer events spec[1] may be of interest, as things like tap/slide/pinch 
 are all non-standard.
 I did this exact same thing [2] for Windows Phone 7, as there aren't even 
 mouse events.

Super thanks for the helpful info, 

I'll try to wrap this into a plugin.





Standardized gestures

2013-04-17 Thread jbo...@openmv.com
I'm experimenting with Cordova on Android, iOS and Windows 8. 

Has there been a discussion around trying to implement to set of 'standard' 
gesture recognizers:
http://msdn.microsoft.com/library/windows/apps/BR241937
http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_basics.html
http://developer.android.com/reference/android/view/GestureDetector.html

The idea would be that the native side executes JavaScript like:  
javascript:cordova.fireEvent('tap', {node: document.elementFromPoint(400, 300), 
x: 400, y:300 });
javascript:cordova.fireEvent('slide', {node: document.elementFromPoint(400, 
300), x: 400, y:300});

This function could use document.createEvent to initiate events on the DOM node:
https://developer.mozilla.org/en-US/docs/DOM/document.createEvent

The purpose of this would be to have a consistent set of gesture recognition 
across different devices instead of having javascript code in the 'WebView' 
trying to do gesture detection.

Thoughts? 



RE: Standardized gestures

2013-04-17 Thread Erik Johnson
This is an interesting idea. I know we get many requests for gesture 
recognition on BlackBerry 10. Adding the link below as references as well for 
the BB platform :)

https://developer.blackberry.com/native/reference/bb10/com.qnx.doc.gestures.lib_ref/topic/overview.html

-Erik

From: jbo...@openmv.com [jbo...@openmv.com]
Sent: Wednesday, April 17, 2013 12:42 PM
To: dev@cordova.apache.org
Subject: Standardized gestures

I'm experimenting with Cordova on Android, iOS and Windows 8.

Has there been a discussion around trying to implement to set of 'standard' 
gesture recognizers:
http://msdn.microsoft.com/library/windows/apps/BR241937
http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_basics.html
http://developer.android.com/reference/android/view/GestureDetector.html

The idea would be that the native side executes JavaScript like:
javascript:cordova.fireEvent('tap', {node: document.elementFromPoint(400, 300), 
x: 400, y:300 });
javascript:cordova.fireEvent('slide', {node: document.elementFromPoint(400, 
300), x: 400, y:300});

This function could use document.createEvent to initiate events on the DOM node:
https://developer.mozilla.org/en-US/docs/DOM/document.createEvent

The purpose of this would be to have a consistent set of gesture recognition 
across different devices instead of having javascript code in the 'WebView' 
trying to do gesture detection.

Thoughts?


-
This transmission (including any attachments) may contain confidential 
information, privileged material (including material protected by the 
solicitor-client or other applicable privileges), or constitute non-public 
information. Any use of this information by anyone other than the intended 
recipient is prohibited. If you have received this transmission in error, 
please immediately reply to the sender and delete this information from your 
system. Use, dissemination, distribution, or reproduction of this transmission 
by unintended recipients is not authorized and may be unlawful.


Re: Standardized gestures

2013-04-17 Thread Filip Maj
I'm not convinced you need any additional code here.

Touch events are already fired by the web view containers. You could build
up gesture detection in JavaScript by listening to these events.

There are libraries out there that do this for you already:

 - http://eightmedia.github.io/hammer.js/
 - http://quojs.tapquo.com/
 - https://github.com/plainview/Jester
 - jquery ui plugin: http://touchpunch.furf.com/
 - jquery plugin: http://labs.rampinteractive.co.uk/touchSwipe/demos/
 - moar jquery: https://github.com/HotStudio/touchy

On 4/17/13 9:42 AM, jbo...@openmv.com jbo...@openmv.com wrote:

I'm experimenting with Cordova on Android, iOS and Windows 8.

Has there been a discussion around trying to implement to set of
'standard' gesture recognizers:
http://msdn.microsoft.com/library/windows/apps/BR241937
http://developer.apple.com/library/ios/#documentation/EventHandling/Concep
tual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_basi
cs.html
http://developer.android.com/reference/android/view/GestureDetector.html

The idea would be that the native side executes JavaScript like:
javascript:cordova.fireEvent('tap', {node: document.elementFromPoint(400,
300), x: 400, y:300 });
javascript:cordova.fireEvent('slide', {node:
document.elementFromPoint(400, 300), x: 400, y:300});

This function could use document.createEvent to initiate events on the
DOM node:
https://developer.mozilla.org/en-US/docs/DOM/document.createEvent

The purpose of this would be to have a consistent set of gesture
recognition across different devices instead of having javascript code in
the 'WebView' trying to do gesture detection.

Thoughts?