[TIMOB-14011] BlackBerry: Implement the 'isLandscape' method in gestures
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2014-06-11T11:42:37.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | 2013 Sprint 12 BB, 2013 Sprint 12, Release 3.1.2, Release 3.2.0 |
| Components | BlackBerry |
| Labels | blackberry, module_orientation, qe-3.3.0, qe-testadded, sdk-bb |
| Reporter | Lokesh Choudhary |
| Assignee | Pedro Enrique |
| Created | 2013-05-28T21:26:29.000+0000 |
| Updated | 2014-06-11T18:58:33.000+0000 |
Description
We had a community developer asking for isLandscape property of gestures on the blackberry google groups.
PR: https://github.com/appcelerator/titanium_mobile_blackberry/pull/107
Sample code:
var win = Titanium.UI.createWindow({ orientationModes: [Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT, Ti.UI.PORTRAIT] }); var btn = Ti.UI.createButton({ title: 'orientation test' }); btn.addEventListener('click', function(){ if(Ti.Gesture.isPortrait()) { alert('is portrait'); } else if(Ti.Gesture.isLandscape()){ alert('is landscape'); } else if(Ti.Gesture.isFaceUp()){ alert('is face up'); } else if(Ti.Gesture.isFaceDown()){ alert('is face down'); } else { alert('is unknown'); } }); win.add(btn); win.open();Mac osx 10.9.3 Mavericks Appcelerator Studio, build: 3.3.0.201405271647 Titanium SDK, build: 3.3.0.v20140524224144 Node.JS Version: v0.10.13 NPM Version: 1.3.2 acs@1.0.14 alloy@1.4.0-beta npm@1.3.2 titanium@3.3.0-beta titanium-code-processor@1.1.1 Device: BB Z10 (10.2.1) alert "is portrait" only, disregarding the orientation
The native code is correct:
For some reason it always returns "bb::device::DeviceOrientation::TopUp" Investigating with BB at the moment.bb::device::DeviceInfo info; bb::device::DeviceOrientation::Type orientation = info.orientation(); if(orientation == bb::device::DeviceOrientation::TopUp || orientation == bb::device::DeviceOrientation::BottomUp) { return Boolean::New(true); } return Boolean::New(false);Update here?
PR: https://github.com/appcelerator/titanium_mobile_blackberry/pull/264
Add to tiapp.xml
Tested and verified fixed with: Mac osx 10.9.3 Mavericks Appcelerator Studio, build: 3.3.0.201406061445 Titanium SDK, build: 3.3.0.v20140611084912 Node.JS Version: v0.10.13 NPM Version: 1.3.2 acs@1.0.14 alloy@1.4.0-beta npm@1.3.2 titanium@3.3.0-beta2 titanium-code-processor@1.1.1 Device: BB Z10 (10.2.1)<blackberry> <orientation>auto</orientation> </blackberry>Actual result
the alert corresponding to orientation