Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8222] Android: Open event for window on first tab of tab group fires when it shouldn't

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-05-12T23:24:06.000+0000
Affected Version/sRelease 1.8.0.1
Fix Version/s2014 Sprint 10, 2014 Sprint 10 SDK, Release 3.3.0
ComponentsAndroid
Labelsmodule_tabgroup, qe-closed-3.3.0, qe-testadded, regression
ReporterOpie Cyrus
AssigneeVishal Duggal
Created2012-03-23T08:40:56.000+0000
Updated2014-12-10T04:43:27.000+0000

Description

In Kitchen Sink, the open event for the window attached to the first tab will fire when the tab group is opened even if the active tab when opened is the second tab. This can be seen by using the test case in timob-8192 (assumes 8192 is merged into master). The open event in the situation described above should not fire.

Comments

  1. Sunila 2014-02-15

    When the tabs are added, it is handled in the javascript until open is called which then calls setTabs from javascript. Added code in javascript to handle setActiveTab before tab is opened. https://github.com/appcelerator/titanium_mobile/pull/5356
  2. Sunila 2014-04-09

    Test case See that setActiveTab and getActiveTab doesn't work until the tab is opened. // 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' }); win1.addEventListener('open', function(){ alert('win1 open event fired'); }); var tab1 = Titanium.UI.createTab({ icon:'KS_nav_views.png', title:'Tab 1', window:win1 }); var label1 = Titanium.UI.createLabel({ color:'#999', text:'I am Window 1', font:{fontSize:20,fontFamily:'Helvetica Neue'}, textAlign:'center', width:'auto' }); win1.add(label1); // // create controls tab and root window // var win2 = Titanium.UI.createWindow({ title:'Tab 2', backgroundColor:'#fff' }); win2.addEventListener('open', function(){ alert('win2 open event fired'); }); var tab2 = Titanium.UI.createTab({ icon:'KS_nav_ui.png', title:'Tab 2', window:win2 }); var label2 = Titanium.UI.createLabel({ color:'#999', text:'I am Window 2', font:{fontSize:20,fontFamily:'Helvetica Neue'}, textAlign:'center', width:'auto' }); win2.add(label2); // // add tabs // tabGroup.addTab(tab1); tabGroup.addTab(tab2); tabGroup.setActiveTab(1); alert(tabGroup.getActiveTab()); // open tab group tabGroup.open();
  3. Lokesh Choudhary 2014-05-06

    Verified the fix. The event listener for the expected window is fired when the app is launched & tabgroup is opened. Closing. Environment: Appc Studio : 3.3.0.201405011408 Ti SDK : 3.3.0.v20140502133323 Mac OSX : 10.8.5 Alloy : 1.4.0-dev CLI - 3.3.0-dev Galaxy S5 - android 4.4.2
  4. Lokesh Choudhary 2014-05-06

    Reopening the ticket. I guess I made a mistake in understanding the ticket. Used the code in the ticket to test. With sdk 3.3.0.v20140502133323 i see that the active tab on launch is tab 1 & not tab 2 as set in the code & both the open events are fired first for win 2 & second for win 1. With sdk 3.2.3.GA , it works as expected. On launch the active tab is tab2 & we see the win2 open event fired after tapping on tab1 the win1 open event is fired. Environment: Appc Studio : 3.3.0.201405011408 Ti SDK : 3.3.0.v20140502133323 Mac OSX : 10.8.5 Alloy : 1.4.0-dev CLI - 3.3.0-dev Galaxy S5 - android 4.4.2
  5. Vishal Duggal 2014-05-12

    Pull pending against master https://github.com/appcelerator/titanium_mobile/pull/5674
  6. Pragya Rastogi 2014-05-15

    Verified the fix on: OSX: 10.9.2 Xcode: 5.1.1 Studio - 3.3.0.201405121247 SDK -3.3.0.v20140514163013 acs-1.0.14 alloy-1.4.0-alpha npm-1.3.2 titanium-3.3.0-dev titanium-code-processor-1.1.1 Device: Nexus 5 (4.4.2) SetActiveTab(1) opens tab 2 first which is expected behaviour

JSON Source