[TIMOB-23928] orientationchange event problems
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2019-09-19T17:17:38.000+0000 |
Affected Version/s | Release 5.5.0 |
Fix Version/s | n/a |
Components | Android |
Labels | android, orientationChange |
Reporter | Guile |
Assignee | Unknown |
Created | 2016-09-19T12:59:22.000+0000 |
Updated | 2019-09-19T17:17:38.000+0000 |
Description
Hello,
There might be a problem with the event orientationchange : it is not triggered the first time, and is triggered just before the orientation change.
This happens since SDK 5.0.
I don't have this problem with SDK 3.5.2
To understand this behaviour, I have created a new Alloy Project, and added this code in alloy.js
{// The event listener
Ti.Gesture.addEventListener('orientationchange', function (e) {
Ti.API.info('w:' + Ti.Platform.displayCaps.platformWidth + ' h:' + Ti.Platform.displayCaps.platformHeight + ' isPortrait:' + e.source.isPortrait());
});
// An event-independant code to "catch" orienation change
var prevW = Ti.Platform.displayCaps.platformWidth, prevH = Ti.Platform.displayCaps.platformHeight;
setInterval(function () {
if (prevW != Ti.Platform.displayCaps.platformWidth || prevH != Ti.Platform.displayCaps.platformHeight) {
prevW = Ti.Platform.displayCaps.platformWidth;
prevH = Ti.Platform.displayCaps.platformHeight;
Ti.API.info('orientation changed? w:' + prevW + ' h:' + prevH);
}
}, 10);
}
And here is the log
* I was in portrait and I changed the orientation now to landscape, note the absence of the event log
[INFO] : orientation changed? w:2560 h:1504
* I change the orientation again from landscape to portrait... the event log shows that we are in landscape... The interval log shows we are indeed in portrait !
[INFO] : w:2560 h:1504 isPortrait:false
[INFO] : orientation changed? w:1600 h:2464
* I change the orientation endly from portrait to landscape... the event log shows that we are now in portrait... The interval log is right the tablet is in landscape !
[INFO] : w:1600 h:2464 isPortrait:true
[INFO] : orientation changed? w:2560 h:1504
Closing issue as “Cannot Reproduce”. We have tested the code provided, and found that it is out of date with our current release (8.1.1.GA as of the date of closure), and out of date with mobile OS versions. Updating the code may not reproduce the issue reported, or be a valid test case. If community members feel that the issue is still valid, please add a comment, and include code that demonstrates/reproduces the issue. Axway Appcelerator Studio, build: 5.1.4.201909061933 macOS : 10.14.6 Node.js Version : 8.9.1 npm Version : 5.5.1 Appcelerator CLI : 7.1.1 Titanium CLI CLI Version : 5.2.1 node-appc Version : 0.2.49 Titanium SDKs : 8.1.1.GA Android API 29