Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13363] Android: TabGroup - TabGroup.setActiveTab() does not open the intended tab for the first time.

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-04-16T18:34:16.000+0000
Affected Version/sRelease 3.1.0
Fix Version/s2013 Sprint 08 API, 2013 Sprint 08, Release 3.1.1, Release 3.2.0
Componentsn/a
Labelsqe-3.1.0, qe-closed-3.1.1
ReporterAnshu Mittal
AssigneeHieu Pham
Created2013-04-04T12:59:30.000+0000
Updated2013-05-30T01:45:59.000+0000

Description

TabGroup.setActiveTab() does not open the intended tab for the first time. This is not regression since the issue occurs on 3.0.2 GA as well. Steps to reproduce: 1. Create an app using the code below. 2. Launch the test app. A window with five buttons is opened. 3. Click on 'open activeTab1'. Actual: Tab0 is opened. Expected: Tab1 should be opened.
var window1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#fff',
    layout:'vertical'
});
	 
	var b1 = Ti.UI.createButton({
	    title:'Open activeTab 1',
	    top:5
	})
	var b2 = Ti.UI.createButton({
	    title:'Open activeTab 2',
	    top:5
	})
	var b3 = Ti.UI.createButton({
	    title:'Open activeTab tab1',
	    top:5
	})
	var b4 = Ti.UI.createButton({
	    title:'Open activeTab tab2',
	    top:5
	})
	var b5 = Ti.UI.createButton({
	    title:'Open ',
	    top:5
	})
	window1.add(b1);
	window1.add(b2);
	window1.add(b3);
	window1.add(b4);
	window1.add(b5);
	var tabGrp = Ti.UI.createTabGroup();
	 
	var win0 = Ti.UI.createWindow({
	    title:'TAB 0',
	    backgroundColor:'white'
	})
	 
	var tab0 = Ti.UI.createTab({
	    window:win0,
	    title:'tab0'
	})
	 
	var closeBtn0 = Ti.UI.createButton({
	    title:'CLOSE TABGRP'
	})
	 
	win0.add(closeBtn0);
	 
	var win1 = Ti.UI.createWindow({
	    title:'TAB 1',
	    backgroundColor:'white'
	})
	 
	var tab1 = Ti.UI.createTab({
	    window:win1,
	    title:'tab1'
	})
	 
	var closeBtn1 = Ti.UI.createButton({
	    title:'CLOSE TABGRP'
	})
	 
	win1.add(closeBtn1);
	 
	var win2 = Ti.UI.createWindow({
	    title:'TAB 2',
	    backgroundColor:'white'
	})
	 
	var tab2 = Ti.UI.createTab({
	    window:win2,
	    title:'tab2'
	})
	 
	var closeBtn2 = Ti.UI.createButton({
	    title:'CLOSE TABGRP'
	})
	 
	win2.add(closeBtn2);
	 
	 
	tabGrp.tabs = [tab0,tab1,tab2];
	 
	b1.addEventListener('click',function(){
	    tabGrp.activeTab = 1;
	    tabGrp.open();
	})
	 
	b2.addEventListener('click',function(){
	    tabGrp.activeTab = 2;
	    tabGrp.open();
	})
	 
	b3.addEventListener('click',function(){
	    tabGrp.activeTab = tab1;
	    tabGrp.open();
	})
	 
	b4.addEventListener('click',function(){
	    tabGrp.activeTab = tab2;
	    tabGrp.open();
	})
	 
	b5.addEventListener('click',function(){
	    tabGrp.open();
	})
	 
	closeBtn0.addEventListener('click',function(){
	    tabGrp.close();
	})
	 
	closeBtn1.addEventListener('click',function(){
	    tabGrp.close();
	})
	 
	closeBtn2.addEventListener('click',function(){
	    tabGrp.close();
	})
	 window1.open();

	

Comments

  1. Hieu Pham 2013-04-10

    Master PR: https://github.com/appcelerator/titanium_mobile/pull/4136
  2. Hieu Pham 2013-04-15

    PR: https://github.com/appcelerator/titanium_mobile/pull/4136
  3. Ping Wang 2013-05-17

    3_1_X: https://github.com/appcelerator/titanium_mobile/pull/4291
  4. Federico Casali 2013-05-30

    Verified as fixed with Android Galaxy Nexus 4.2.2 Appcelerator Studio 3.1.1.201305282349 Titanium SDK 3.1.1.v20130524180421 Alloy 1.1.3-alpha Titanium-Code-Processor 1.1.3-alpha3 Closing.

JSON Source