Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24537] Android: Ti.Gesture should provide device orientation like iOS

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-11-15T00:09:36.000+0000
Affected Version/sRelease 6.0.3
Fix Version/sRelease 7.0.0
ComponentsAndroid
Labelsandroid, breaking-change, gesture, orientation, parity
ReporterVictor Vazquez Montero
AssigneeJoshua Quick
Created2017-03-27T19:29:36.000+0000
Updated2017-11-15T06:21:23.000+0000

Description

Description

TI Gesture does not fire orientationchange event on Android. It works fine on iOS

Steps to Replicate

1. Lauch app and tilt the device.

Expected results

Fire event as it does on iOS

Attachments

FileDateSize
S5_video.mp42017-04-12T20:59:52.000+00005237043
TiGestureTest.zip2017-03-27T19:30:04.000+000010475776

Comments

  1. Lokesh Choudhary 2017-04-04

    [~emerriman], I could not reproduce the issue. For me orientationchange in Ti.Gesture is correctly fired for the different orientation types. In the example app, I see the window is set to have 2 orientation modes Titanium.UI.PORTRAIT & Titanium.UI.UPSIDE_PORTRAIT. From the docs:
       Android and Mobile Web do not report the "reverse" orientations, UPSIDE_PORTRAIT and LANDSCAPE_RIGHT. These are reported as PORTRAIT and LANDSCAPE_LEFT, respectively.
       
    Ref: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Gesture-event-orientationchange
  2. Victor Vazquez Montero 2017-04-06

    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
  3. Lokesh Choudhary 2017-04-06

    [~vvazquezmontero], Thanks, appreciate it. I will check it out.
  4. Eric Merriman 2017-04-10

    [~lchoudhary] please check this out again, then assign to Josh if able to repro. If unable, let me know.
  5. Lokesh Choudhary 2017-04-11

    [~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:*
       function doClick(e) {
           alert($.label.text);
       }
       
       $.index.open();
       
       Ti.Gesture.addEventListener('orientationchange', function(){
       	alert('Orientation Changed');
       });
       
    *index.tss code:*
       ".container": {
       	backgroundColor:"white"
       }
       
       "Label": {
       	width: Ti.UI.SIZE,
       	height: Ti.UI.SIZE,
       	color: "#000"
       }
       
       "#label": {
       	font: {
       		fontSize: 12
       	}
       }
       
  6. Victor Vazquez Montero 2017-04-12

    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
  7. Lokesh Choudhary 2017-04-12

    [~vvazquezmontero], Ok we have a Samsung S5 will try to reproduce.
  8. Lokesh Choudhary 2017-04-12

    [~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.
  9. Victor Vazquez Montero 2017-04-12

    I'l share with the customer and see what they give back. Thank you [~lchoudhary]
  10. Victor Vazquez Montero 2017-04-13

    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."
  11. Victor Vazquez Montero 2017-04-25

    [~lchoudhary] Hey Lokesh any update on this ticket with the additional comment from the cusomter?
  12. Lokesh Choudhary 2017-04-26

    [~vvazquezmontero], We are working on this issue.
  13. Lokesh Choudhary 2017-04-26

    Failing review as PR was declined.
  14. Joshua Quick 2017-04-26

    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.
  15. Victor Vazquez Montero 2017-05-08

    [~jquick] Hello Joshua, Is there any viable work around which the customer can do to get the desired behavior?
  16. Joshua Quick 2017-05-08

    [~vvazquezmontero], unfortunately no.
  17. Victor Vazquez Montero 2017-08-24

    [~jquick] Thanks for the update!
  18. Joshua Quick 2017-11-04

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/9585
  19. Lokesh Choudhary 2017-11-07

    FR Passed. Waiting for merge to get enabled to merge.
  20. Abir Mukherjee 2017-11-15

    PR merged.
  21. Abir Mukherjee 2017-11-15

    Changes are seen in SDK 7.0.0.v20171114202841.

JSON Source