{ "id": "170709", "key": "TIMOB-25647", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2018-01-24T19:26:56.000+0000", "created": "2018-01-03T12:35:46.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "android", "height", "orientation", "width" ], "versions": [], "issuelinks": [], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-01-24T19:26:56.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "description": "Just like previous issues related to orientation changes (which seem to be fixed now), there's a problem with device width/height detection now.\r\n\r\nInitially the device width and height values are correct. But, on the first orientation change it returns the same values. After the second change it returns the values that it should have returned the first time, which results in a reversed width/height value.\r\n\r\nWorkaround: read the properies for a second time, with a delay of +/- 1000 ms. This returns the correct value.\r\n\r\nURL to test project: https://content.skoften.net/test.zip (can't upload due to 10MB limit)", "attachment": [], "flagged": false, "summary": "Device width and height value incorrect on first orientation change (Android)", "creator": { "name": "arif", "key": "arif", "displayName": "Arjan", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "arif", "key": "arif", "displayName": "Arjan", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "* Node.js\r\n* ✓ node installed (v8.9.1)\r\n* ✓ npm installed (v5.5.1)\r\n* \r\n* Titanium CLI\r\n* ✓ cli bleeding edge (v5.0.14)\r\n* \r\n* Titanium CLI Dependencies\r\n* ✓ acs up-to-date (v2.0.8)\r\n* ✓ alloy up-to-date (v1.10.10)\r\n* ✓ appc-cli-titanium up-to-date (v4.4.6)\r\n* ✓ appc-inquirer up-to-date (v0.1.10)\r\n* ✓ appc-logger up-to-date (v1.1.27)\r\n* ✓ appc-platform-sdk up-to-date (v3.0.1)\r\n* ✓ appcd up-to-date (v1.0.1)\r\n* ✓ arrow up-to-date (v3.0.0)\r\n* ✓ async up-to-date (v1.5.2)\r\n* ✓ chalk up-to-date (v1.1.3)\r\n* ✓ char-spinner up-to-date (v1.0.1)\r\n* ✓ columnify up-to-date (v1.5.4)\r\n* ✓ commander up-to-date (v2.9.0)\r\n* ✓ debug up-to-date (v2.6.9)\r\n* ✓ ejs up-to-date (v2.5.7)\r\n* ✓ fields up-to-date (v0.1.24)\r\n* ✓ fs-extra up-to-date (v0.26.7)\r\n* ✓ inquirer up-to-date (v0.11.4)\r\n* ✓ ip up-to-date (v1.1.5)\r\n* ✓ jwt-simple up-to-date (v0.3.1)\r\n* ✓ lodash up-to-date (v3.10.1)\r\n* ✓ mkdirp up-to-date (v0.5.1)\r\n* ✓ node-appc up-to-date (v0.2.43)\r\n* ✓ node-forge up-to-date (v0.6.49)\r\n* ✓ node-ios-device up-to-date (v1.5.0)\r\n* ✓ npm-conf up-to-date (v1.1.3)\r\n* ✓ pac-proxy-agent up-to-date (v2.0.0)\r\n* ✓ plural up-to-date (v0.2.0)\r\n* ✓ progress up-to-date (v1.1.8)\r\n* ✓ recursive-readdir up-to-date (v2.2.1)\r\n* ✓ request up-to-date (v2.83.0)\r\n* ✓ retire up-to-date (v1.4.0)\r\n* ✓ semver up-to-date (v5.4.1)\r\n* ✓ tar up-to-date (v4.0.2)\r\n* ✓ tiapp.xml up-to-date (v0.2.2)\r\n* ✓ titanium up-to-date (v5.0.14)\r\n* ✓ version-bump-prompt up-to-date (v3.1.2)\r\n* ✓ which up-to-date (v1.3.0)\r\n* ✓ wrench up-to-date (v1.5.9)\r\n* \r\n* Titanium SDK\r\n* ✓ latest sdk installed (v7.0.1.GA)\r\n* ✓ selected sdk up-to-date (v7.0.1.GA)\r\n* \r\n* Mac OS X Environment\r\n* ✓ CLI Tools installed\r\n* \r\n* iOS Environment\r\n* ✓ Xcode installed (9.2)\r\n* ✓ iOS SDK installed (11.2)\r\n* ✓ WWDR cert installed\r\n* ✓ developer cert installed (2 found)\r\n* ✓ distribution cert installed (2 found)\r\n* ✓ dev provisioning installed (4 found)\r\n* ✓ dist provisioning installed (6 found)\r\n* \r\n* Android Environment\r\n* ✓ sdk installed (/Users/arjanbrinkman/Documents/Android/android-sdk-macosx)\r\n* ✓ tools installed (v25.2.5)\r\n* ! platform tools untested version 27.0.1; may or may not work\r\n* ✓ build tools installed (v26.0.2)\r\n* ✓ adb installed /Users/arjanbrinkman/Documents/Android/android-sdk-macosx/platform-tools/adb\r\n* ✕ android \"android\" executable not found; please reinstall Android SDK\r\n* ✓ emulator installed /Users/arjanbrinkman/Documents/Android/android-sdk-macosx/tools/emulator\r\n* ✓ mksdcard installed /Users/arjanbrinkman/Documents/Android/android-sdk-macosx/tools/mksdcard\r\n* ✓ zipalign installed /Users/arjanbrinkman/Documents/Android/android-sdk-macosx/build-tools/26.0.2/zipalign\r\n* ✓ aapt installed /Users/arjanbrinkman/Documents/Android/android-sdk-macosx/build-tools/26.0.2/aapt\r\n* ✓ aidl installed /Users/arjanbrinkman/Documents/Android/android-sdk-macosx/build-tools/26.0.2/aidl\r\n* ✓ targets installed (18 found)\r\n* ! avds no avds found\r\n* ✓ ndk installed (14.1.3816874)\r\n* ✓ ndk-build installed (/Users/arjanbrinkman/Documents/Android/android-ndk-r12b/ndk-build)\r\n* \r\n* Java Development Kit\r\n* ✓ jdk installed (v1.8.0)\r\n* ✓ java installed /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java\r\n* ✓ javac installed /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/javac\r\n* ✓ keytool installed /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/keytool\r\n* ✓ jarsigner installed /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/jarsigner\r\n* \r\n* - Tested on a real Samsung Tab A 10.1 running Android 7.0", "comment": { "comments": [ { "id": "432698", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, I can't download the sample app you provide the link to. Can you please send a valid link. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2018-01-03T21:59:17.000+0000", "updated": "2018-01-03T21:59:17.000+0000" }, { "id": "432700", "author": { "name": "arif", "key": "arif", "displayName": "Arjan", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Hi,\r\n\r\nWeird, the link works just fine here. \r\n\r\nTry this one: https://ufile.io/r0n3u\r\n\r\nOr maybe I can email it?\r\n\r\nCheers.", "updateAuthor": { "name": "arif", "key": "arif", "displayName": "Arjan", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2018-01-03T22:25:50.000+0000", "updated": "2018-01-03T22:25:50.000+0000" }, { "id": "433345", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~arif], this is not a Titanium bug. Let me explain...\r\n\r\n*How Ti.Gesture orientation works:*\r\nThe Ti.Gesture orientation properties and event is supposed to provide the device's orientation, not the app window's orientation. There is a big difference between the two. For example, if your app is set up to be portrait-only and you hold the phone landscape-right, then Ti.Gesture will report the orientation as being landscape-right, regardless of the app window's currently rendered upright orientation. This is how it's always worked on iOS and Window... but... there was a parity/portability issue on Android where this module would report the app window's orientation instead and this was a problem for Titanium developers since no other APIs offered device orientation. So, in Titanium 7.0.0, we've changed Ti.Gesture to provide device orientation to match how it works on iOS and Windows.\r\n\r\n*Why you should NOT use Ti.Gesture:*\r\nUsing Ti.Gesture orientation events to detect app window width/height changes is not reliable on any platform (Android, iOS, and Windows) for the following reasons...\r\n\r\n# You won't get this event in split-screen mode. Nor can you assume device orientation and app orientation matches in this case. (Ex: Device is held landscape and the 2 apps are shown in portrait form in split-screen mode.)\r\n# You won't get this event on Android when the windows switches in-and-out of immersive mode. Meaning the bottom virtual navigation bar is hidden or shown, causing the height of the app window to change, but the orientation doesn't change.\r\n# On iOS, the device orientation event is typically received before the app window is rotated to match by the OS. This is the case in the native Objective-C/Switch level. (It's an order of events issue.)\r\n\r\n*Best Solution:*\r\nWhat you should do instead is listen for the Ti.UI.Window's \"postlayout\" event. This event gets fired when the app window has been resized and the window's \"size\" property will be updated with the new width and height when your listener gets called, which is what you're after.\r\nhttp://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Window-event-postlayout\r\n\r\nI hope this helps!", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-19T20:19:06.000+0000", "updated": "2018-01-19T20:19:06.000+0000" }, { "id": "433585", "author": { "name": "arif", "key": "arif", "displayName": "Arjan", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Thanks for your comment Joshua, this helps!", "updateAuthor": { "name": "arif", "key": "arif", "displayName": "Arjan", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2018-01-24T13:09:24.000+0000", "updated": "2018-01-24T13:09:24.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }