Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4388] Implement getPressure in Android view

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2016-04-25T20:27:43.000+0000
Affected Version/sRelease 1.7.0
Fix Version/sRelease 5.4.0
ComponentsAndroid
Labelstbs-1.8.0
ReporterMichael Gangolf
AssigneeHans Knöchel
Created2011-06-06T11:04:31.000+0000
Updated2016-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

Comments

  1. Michael Gangolf 2016-04-02

    PR: https://github.com/appcelerator/titanium_mobile/pull/7906 Mapping pressure to force so 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:
       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();
       
    XML:
       <Alloy>
       	<Window class="container">
       		<Label id="txt"/>
       		<Label id="txt_s"/>
       		<View id="v"/>
       	</Window>
       </Alloy>
       
    TSS:
       ".container" : {
           backgroundColor: "white",
           layout: "vertical"
       }
       "Label" : {
           width: Ti.UI.SIZE,
           height: Ti.UI.SIZE,
           color: "#000"
       }
       "#v" : {
           width: 200,
           height: 200,
           backgroundColor: "red"
       }
       
  2. Hans Knöchel 2016-04-02

    [~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.
  3. Lokesh Choudhary 2016-07-08

    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

JSON Source