[TIMOB-24537] Android: Ti.Gesture should provide device orientation like iOS
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-11-15T00:09:36.000+0000 |
Affected Version/s | Release 6.0.3 |
Fix Version/s | Release 7.0.0 |
Components | Android |
Labels | android, breaking-change, gesture, orientation, parity |
Reporter | Victor Vazquez Montero |
Assignee | Joshua Quick |
Created | 2017-03-27T19:29:36.000+0000 |
Updated | 2017-11-15T06:21:23.000+0000 |
Description
Description
TI Gesture does not fire orientationchange event on Android. It works fine on iOSSteps to Replicate
1. Lauch app and tilt the device.Expected results
Fire event as it does on iOSAttachments
File | Date | Size |
---|---|---|
S5_video.mp4 | 2017-04-12T20:59:52.000+0000 | 5237043 |
TiGestureTest.zip | 2017-03-27T19:30:04.000+0000 | 10475776 |
[~emerriman], I could not reproduce the issue. For me
orientationchange
inTi.Gesture
is correctly fired for the different orientation types. In the example app, I see the window is set to have 2 orientation modesTitanium.UI.PORTRAIT
&Titanium.UI.UPSIDE_PORTRAIT
. From the docs:Ref: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Gesture-event-orientationchange
Hey [~lchoudhary], in the sample app Event is not fired first time the screen is rotated as it does on iOS. I have attached a video to shows what I am seeing. As well, I've removed the orientation modes from the tss file. https://axwaysoftware-my.sharepoint.com/personal/vvazquezmontero_axway_com/_layouts/15/guestaccess.aspx?guestaccesstoken=FpIUW41Uy1lcTHHqLCzVjS3RFgDdAHRD82lbvxihe30%3d&docid=2_1a556a9c1988e4b90861e13375920cbcb&rev=1 Best, Victor Montero
[~vvazquezmontero], Thanks, appreciate it. I will check it out.
[~lchoudhary] please check this out again, then assign to Josh if able to repro. If unable, let me know.
[~emerriman], [~vvazquezmontero] I tried again with the 6.0.3.GA & with code below & event gets fired properly even for the first time the device is rotated. One thing I am seeing is on emulator it does not fire the event for the first time while on device it does everytime. I tried it on 2 devices: 1. One plus one android 6.0.1 2. Nexus 6 android 6.0.1 I won't take what you see on an emulator as final result for orientation as most of orientation stuff is device sensor dependent if orientations are not explicitly specified, can you please try on a device if you still see the issue ? More ref: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Window-property-orientationModes *index.js code:*
*index.tss code:*
Hey [~lchoudhary], User says they can reproduce this bug on the following devices: An s5 running lollipop An s6 running marshmallow An htc one m8 running marshmallow A moto x running lollipop Best, Victor Montero
[~vvazquezmontero], Ok we have a Samsung S5 will try to reproduce.
[~vvazquezmontero], I tried on the S5 android 5.0 (lollipop) we had but still couldn't reproduce with the code above. I have attached this video for ref : [^S5_video.mp4]. Unsure why the customer is seeing the issue.
I'l share with the customer and see what they give back. Thank you [~lchoudhary]
Hey [~lchoudhary] the user is still seeing the same behavior where the ti.gesture is not firing using the code you provided. This is what they are responding "I'm looking for parity between the ios and android behavior. On ios orientationchange is fired when the device's orientation is changed, not the window (because the window is locked to portrait). I'm looking for the same behavior on android."
[~lchoudhary] Hey Lokesh any update on this ticket with the additional comment from the cusomter?
[~vvazquezmontero], We are working on this issue.
Failing review as PR was declined.
We currently document that Android provides the window orientation and iOS provides the device orientation here... https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Gesture-property-orientation So, at the moment, this is currently by design. What's being asked here is for us to make a breaking change and have this "orientation" property return the device orientation on Android to match the iOS (and Windows Phone) behavior. This is understandable since I'm not aware of any other API that provides device orientation, which means that an Android developer has no means of accessing device orientation. (An iOS and Windows Phone developer can listen to a Window's "postlayout" event to determine if the window orientation has changed.) This is being discussed internally by engineering at the moment. No ETA yet.
[~jquick] Hello Joshua, Is there any viable work around which the customer can do to get the desired behavior?
[~vvazquezmontero], unfortunately no.
[~jquick] Thanks for the update!
PR (master): https://github.com/appcelerator/titanium_mobile/pull/9585
FR Passed. Waiting for merge to get enabled to merge.
PR merged.
Changes are seen in SDK 7.0.0.v20171114202841.