Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11339] Android: TabGroup - Unexpected output in a console on Android

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-10-25T17:59:03.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sRelease 3.0.0, Release 3.1.0, 2012 Sprint 21 API, 2012 Sprint 21
ComponentsAndroid
Labelsapi, module_tabgroup, qe-and100112, qe-testadded, regression
ReporterTamila Smolich
AssigneeHieu Pham
Created2012-10-10T00:07:36.000+0000
Updated2013-06-11T18:14:54.000+0000

Description

Description: While testing TabGroup I noticed an unexpected output in a console. This is a regression, does not occur on 2.1.3. Steps: 1. Run the following code and check the console:
var tabGroup = Ti.UI.createTabGroup();

var win1 = Ti.UI.createWindow({
	name: "win 1"
});
var tab1 = Ti.UI.createTab({
	name: "Tab 1",
	title:'Tab 1',
	window:win1
});

var win2 = Ti.UI.createWindow({
	name: "win 2",
	title:'Tab 2',
	backgroundColor:'#fff'
});
var tab2 = Ti.UI.createTab({
	name: "Tab 2",
	title:'Tab 2',
	window:win2
});

tabGroup.addTab(tab1);
tabGroup.addTab(tab2);

tabGroup.addEventListener('focus', function(e){
	Ti.API.info('-------------> tabGroup focus event fired! - ' + e.source.name);
});
tab1.addEventListener('focus', function(e){
	Ti.API.info('-------------> tab1 focus event fired! - ' + e.source.name);
});
tab2.addEventListener('focus', function(e){
	Ti.API.info('-------------> tab2 focus event fired! - ' + e.source.name);
});
win1.addEventListener('focus', function(e){
	Ti.API.info('-------------> win1 focus event fired! - ' + e.source.name);
});
win2.addEventListener('focus', function(e){
	Ti.API.info('-------------> win2 focus event fired! - ' + e.source.name);
});

tab1.addEventListener('blur', function(e){
	Ti.API.info('**************> tab1 blur event fired! - ' + e.source.name);
});
tab2.addEventListener('blur', function(e){
	Ti.API.info('**************> tab2 blur event fired! - ' + e.source.name);
});
win1.addEventListener('blur', function(e){
	Ti.API.info('**************> win1 blur event fired! - ' + e.source.name);
});
win2.addEventListener('blur', function(e){
	Ti.API.info('**************> win2 blur event fired! - ' + e.source.name);
});

tabGroup.open();
Expected result: After step 1. The following appears in the console/logcat:
-------------> tab1 focus event fired! - Tab 1 
-------------> tabGroup focus event fired! - Tab 1 
-------------> win1 focus event fired! - win 1
After step 2. Should see something similar in the console/logcat:
**************> tab1 blur event fired! - Tab 1 
**************> win1 blur event fired! - win 1 
-------------> tab2 focus event fired! - Tab 2 
-------------> tabGroup focus event fired! - Tab 2 
-------------> win2 focus event fired! - win 2 
**************> tab2 blur event fired! - Tab 2 
**************> win2 blur event fired! - win 2 
-------------> tab1 focus event fired! - Tab 1 
-------------> tabGroup focus event fired! - Tab 1 
-------------> win1 focus event fired! - win 1
Actual result: After step 1:
I/TiAPI(14231):  -------------> win1 focus event fired! - Tab 1
I/TiAPI(14231):  -------------> tab1 focus event fired! - Tab 1
I/TiAPI(14231):  -------------> tabGroup focus event fired! - Tab 1
or
I/TiAPI(12643):  -------------> win1 focus event fired! - win 1
I/TiAPI(12643):  -------------> tab1 focus event fired! - win 1
I/TiAPI(12643):  -------------> tabGroup focus event fired! - win 1
After step 2:
I/TiAPI(14946):  **************> win1 blur event fired! - Tab 1
I/TiAPI(14946):  **************> tab1 blur event fired! - Tab 1
I/TiAPI(14946):  -------------> win2 focus event fired! - Tab 2
I/TiAPI(14946):  -------------> tab2 focus event fired! - Tab 2
I/TiAPI(14946):  -------------> tabGroup focus event fired! - Tab 2

Comments

  1. Hieu Pham 2012-10-11

    The ordering of focus/blur has been modified to: win -> tab -> tabGroup.
  2. Hieu Pham 2012-10-13

    3.0.X PR: https://github.com/appcelerator/titanium_mobile/pull/3193 Master PR: https://github.com/appcelerator/titanium_mobile/pull/3160
  3. Tamila Smolich 2012-10-17

    Closing as fixed. Verified and tested on: Titanium Studio, build: 3.0.0.201210151149 Titanium SDK, builds: 3.0.0.v20121017100120; 3.1.0.v20121017102121 Device: Nexus 7 (4.1.1)

JSON Source