Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8714] Android: 'focus' events are not correctly handled for windows in a tabGroup

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-08-07T21:45:56.000+0000
Affected Version/sRelease 1.8.2
Fix Version/sRelease 2.1.0, Sprint 2012-09 Core, 2013 Sprint 16, 2013 Sprint 16 API, Release 3.1.2, Release 3.2.0
ComponentsAndroid
LabelsSupportTeam, core, module_tabgroup, parity, qe-testadded, regression
ReporterFederico Casali
AssigneePing Wang
Created2012-04-13T01:07:59.000+0000
Updated2013-08-08T10:56:38.000+0000

Description

Problem description

'Focus' events might not correctly handled when associated to a window set in tabGroup and with the url property

Steps to reproduce

Steps

- Create a tabGroup with 2 windows. - Set the url property for each window and define 'focus' event listener in the two 'win1.js' and 'win2.js' files. - Don't set event listeners in the app.js Result: 'focus' event listeners ae not triggered on Android (on iOS works fine).

Code

// app.js
var tabGroup = Titanium.UI.createTabGroup();

var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#fff',
    url:'win1.js'
});

var tab1 = Titanium.UI.createTab({  
    icon:'KS_nav_ui.png',
    title:'Win 1',
    window:win1
});

var win2 = Titanium.UI.createWindow({  
    title:'Tab 2',
    backgroundColor:'#fff',
    url:'win2.js'
});

var tab2 = Titanium.UI.createTab({  
    icon:'KS_nav_ui.png',
    title:'Win 2',
    window:win2
});

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

tabGroup.open();
// win1.js
var win1 = Ti.UI.currentWindow;

win1.addEventListener('focus',function(e){
	alert('test win1');
});

// win2.js
var win2 = Ti.UI.currentWindow;

win2.addEventListener('focus',function(e){
	alert('test win2');
});

Additional notes:

Customer ticket : http://support-admin.appcelerator.com/display/APP-221687/conversation/read_all

Comments

  1. Allen Yeung 2012-04-26

    Just verified that this is already fixed in master, but was still present in 2.0.1GA2. It was likely fixed as a result of https://github.com/appcelerator/titanium_mobile/pull/2069.
  2. Eric Merriman 2012-06-19

    Closing as fixed with SDK 2.1.0.v20120618154152.
  3. Priya Agarwal 2013-08-07

    This is regression. events are fired correctly in 3.1.1GA Verified with: Studio: 3.1.2.201308021524 SDK: 3.1.2.v20130806104555 acs:1.0.5 alloy:1.2.0-alpha6 titanium:3.1.2-alpha titanium-code-processor:1.0.2-alpha OS: OSX 10.8.4 Device: nexus 7(v4.3) Xcode:4.6.3 No alert is being displayed.
  4. Ping Wang 2013-08-07

    PR: https://github.com/appcelerator/titanium_mobile/pull/4553 3_1_X PR: https://github.com/appcelerator/titanium_mobile/pull/4554
  5. Priya Agarwal 2013-08-08

    Verified with: Studio: 3.1.2.201308071912 SDK: 3.1.2.v20130807171139 acs:1.0.5 alloy:1.2.0-alpha6 titanium:3.1.2-alpha titanium-code-processor:1.0.2-alpha OS: OSX 10.8.4 Device: nexus 7(v4.3) Xcode:4.6.3 focus events working fine for windows in a tabGroup.

JSON Source