[TIMOB-4388] Implement getPressure in Android view
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | Low |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2016-04-25T20:27:43.000+0000 |
| Affected Version/s | Release 1.7.0 |
| Fix Version/s | Release 5.4.0 |
| Components | Android |
| Labels | tbs-1.8.0 |
| Reporter | Michael Gangolf |
| Assignee | Hans Knöchel |
| Created | 2011-06-06T11:04:31.000+0000 |
| Updated | 2016-07-08T00:05:46.000+0000 |
Description
Can you expose the getPressure value on android devices:
http://developer.android.com/reference/android/view/MotionEvent.html#getPressure%28int%29
PR: https://github.com/appcelerator/titanium_mobile/pull/7906 Mapping
pressuretoforceso it can be used the same way on iOS too. getSize(): http://developer.android.com/reference/android/view/MotionEvent.html#getSize%28%29 size/pressure might not always return the proper value. On a HTC A9 the pressure returns the actual touch area *Example* Controller:XML:function ts(e) { $.txt.text = "Force: " + e.force; $.txt_s.text = "Size: " + e.size; } function tm(e) { $.txt.text = "Force: " + e.force; $.txt_s.text = "Size: " + e.size; } function te(e) { $.txt.text = "Force: " + e.force; $.txt_s.text = "Size: " + e.size; } $.v.addEventListener("touchstart", ts); $.v.addEventListener("touchend", te); $.v.addEventListener("touchmove", tm); $.index.open();TSS:".container" : { backgroundColor: "white", layout: "vertical" } "Label" : { width: Ti.UI.SIZE, height: Ti.UI.SIZE, color: "#000" } "#v" : { width: 200, height: 200, backgroundColor: "red" }[~michael] Please add a test case here as well. And just to be sure: You add those properties to the Events like iOS does? Parity is very important here.
Verified the implementation. Closing. Environment: Appc Studio : 4.7.0.201607070843 Ti SDK : 5.4.0.v20160705213725 Ti CLI : 5.0.9 Alloy : 1.9.1 MAC El Capitan : 10.11.5 Appc NPM : 4.2.8-1 Appc CLI : 5.4.0-28 Node: 4.4.4 Nexus 6 - Android 6.0.1