Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19878] Android: Ti.Gesture orientation change is not always fired

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-11-15T00:10:14.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.0.0
ComponentsAndroid
Labels4.1.0, android, genymotion, orientation, orientationChange
ReporterStefan Schüller
AssigneeJoshua Quick
Created2015-07-29T09:23:29.000+0000
Updated2017-11-15T06:21:56.000+0000

Description

What happens:

On first rotation no event is triggered. On every orientation change thereafter, the wrong orientation is returned. I have observed similar behavior on a physical device but I can not reproduce it consistently. In genymotion it happens every time.

Note: The project must be an alloy project. The problem does not occur in a non alloy project. Orientation works correctly in TI SDK 4.0.0.GA

How to reproduce:

1. Create new Empty alloy project 2. Set index.js to:
function doClick(e) {
    alert($.label.text);
}

$.index.open();

Ti.Gesture.addEventListener('orientationchange', gestureChange);

function gestureChange(e) {
    console.log('orientation change...');
    console.log(e);
}
3. Start app in genymotion 4. Output from console: First rotation results in no output. Next rotation back into Portrait results in the following:
[INFO]  orientation change...
[INFO]  {"type":"orientationchange","source":{"landscape":true,"bubbleParent":true,"orientation":2,"apiName":"Ti.Gesture","portrait":false,"_events":{"orientationchange":{}}},"orientation":2,"bubbles":false,"cancelBubble":false}
Then rotating into Lanscape results in the following:
[INFO]  orientation change...
[INFO]  {"type":"orientationchange","source":{"landscape":false,"bubbleParent":true,"orientation":1,"apiName":"Ti.Gesture","portrait":true,"_events":{"orientationchange":{}}},"orientation":1,"bubbles":false,"cancelBubble":false}

Comments

  1. Andrey Tkachenko 2015-07-31

    I confirm. May be related to TIMOB-18956
  2. Andrey Tkachenko 2015-10-24

    Also 5.0.2 not only Alloy but in Genymotion only To test run KitchenSink: BASE UI -> Views -> List View -> Default Template
  3. Justin Toth 2015-12-15

    Any update on this? I have the same issue in Ti SDK 5.1.0.GA, non-Alloy project.
  4. Ashraf Abu 2015-12-15

  5. Arjan 2017-09-29

    This problem is still present and a pain in the ass, any update on this? Working on SDK 6.2.2.GA. Clean Alloy project. Happens in EVERY simulator. Screencast: https://streamable.com/dhm5i As you can see the first change isn't detected at all. After that the value is wrong (landscape is detected as portrait and visa versa). EDIT: also, switching from portrait to landscape (left/right) on a Samsung Tab 3 (Android 4.4.2) causes very inconstistant results: [ERROR] : {"type":"orientationchange","source":{"landscape":true,"portrait":false,"orientation":1,"apiName":"Ti.Gesture","bubbleParent":true,"_events":{"orientationchange":{}}},"orientation":1,"bubbles":false,"cancelBubble":false} [ERROR] : {"type":"orientationchange","source":{"landscape":true,"portrait":false,"orientation":2,"apiName":"Ti.Gesture","bubbleParent":true,"_events":{"orientationchange":{}}},"orientation":2,"bubbles":false,"cancelBubble":false} [ERROR] : {"type":"orientationchange","source":{"landscape":false,"portrait":true,"orientation":1,"apiName":"Ti.Gesture","bubbleParent":true,"_events":{"orientationchange":{}}},"orientation":1,"bubbles":false,"cancelBubble":false} [ERROR] : {"type":"orientationchange","source":{"landscape":false,"portrait":true,"orientation":4,"apiName":"Ti.Gesture","bubbleParent":true,"_events":{"orientationchange":{}}},"orientation":4,"bubbles":false,"cancelBubble":false}
  6. Maggie Chen 2017-10-12

    PR https://github.com/appcelerator/titanium_mobile/pull/9525
  7. Joshua Quick 2017-11-04

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

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

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

    Changes are seen in SDK 7.0.0.v20171114202841.

JSON Source