GitHub Issue | n/a |
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2013-07-16T21:50:36.000+0000 |
Affected Version/s | Release 1.7.6 |
Fix Version/s | Sprint 2011-50, Release 1.7.6, Release 1.8.0.1, 2013 Sprint 15 API, 2013 Sprint 15 |
Components | Android |
Labels | module_orientation, parity, qe-3.1.1, qe-testadded |
Reporter | Radamantis Torres-Lechuga |
Assignee | Hieu Pham |
Created | 2011-12-12T17:16:50.000+0000 |
Updated | 2017-03-21T22:25:20.000+0000 |
Issue
When user change the tab and then rotate the device, the orientation change event listener is not getting fired. I have attached a sample code and steps to recreate this issue is as below
Steps to reproduce
1. Switch to tab2
2. tilt the device to landscape
3. click on tab1 and rotate the phone to portrait.
Now the gesture change event will not be fired.
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff',
navBarHidden:false
});
var win3 = Titanium.UI.createWindow({
title:'Tab 3',
backgroundColor:'blue',
navBarHidden:false
});
win3.orientationModes = [
Titanium.UI.PORTRAIT,
Titanium.UI.LANDSCAPE_LEFT,
Titanium.UI.LANDSCAPE_RIGHT];
var bt = Ti.UI.createButton({
backgroundImage:'default_app_logo.png',
width:44,
height:39,
top:0,
right:'6.25%'
});
bt.addEventListener('click', function(e) {
tab1.open(win3);
});
function createnewview(_currOrientation) {
var ds = [];
if(_currOrientation === 'landscape') {
var r1 = Ti.UI.createTableViewRow({
height:50,
backgroundColor:'green'
});
ds.push(r1);
} else {
var r = Ti.UI.createTableViewRow({
height:50,
backgroundColor:'yellow'
});
ds.push(r);
}
return ds;
}
function getOrientation(o) {
switch (o) {
case Titanium.UI.PORTRAIT:
return 'portrait';
case Titanium.UI.UPSIDE_PORTRAIT:
return 'portrait';
case Titanium.UI.LANDSCAPE_LEFT:
return 'landscape';
case Titanium.UI.LANDSCAPE_RIGHT:
return 'landscape';
}
};
var datasource = createnewview(getOrientation(Titanium.Gesture.orientation));
var tv = Ti.UI.createTableView({
height : 100,
data: datasource
});
win1.add( bt);
Ti.Gesture.addEventListener('orientationchange', function(e) {
alert('changed')
/*setTimeout(function(){
var _currOrientation = getOrientation(Titanium.Gesture.orientation);
tv.data = createnewview(_currOrientation)
if(_currOrientation === 'landscape') {
tabGroup.animate({
bottom:-60
});
win3.hideNavBar();
} else {
tabGroup.animate({
bottom:0
});
win3.showNavBar();
}
},300);*/
});
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 1',
window:win1
});
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({
title:'Tab 2',
backgroundColor:'blue',
navBarHidden:false
});
var tab2 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 2',
window:win2
});
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
// open tab group
tabGroup.open();
Expected behavior
If TiSDK 1.8.01 is used the event is fired when we follow the steps above. We could not locate any existing JIRA log that has fixed the issue.
Closing bug. Verified fix on: SDK build: 1.9.0.v20120112104633 Runtime: V8, Rhino Titanium Studio, build: 1.0.8.201201111843 Device: Droid 3 (2.3.4)
Issue is reproducible. This is not a regression. Issue occurs since 2.1.4.GA Environment used: Device : Google Nexus 7, Android Version: 4.1 SDK: 3.1.1.v20130517185716 CLI version : 3.1.0 OS : MAC OSX 10.7.5 Appcelerator Studio, build: 3.1.2.201305181607 XCode : 4.5.1
Tested on Galaxy Nexus and Nexus 7. Unable to reproduce. Gesture events fired as expected.
Closing ticket as the issue cannot be reproduced and due to the above comments.