GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-07-11T02:57:30.000+0000 |
Affected Version/s | Release 1.7.6, Release 2.1.0, Release 1.8.2, Release 2.0.1 |
Fix Version/s | Release 2.1.0, Sprint 2012-10 API |
Components | Android |
Labels | SupportTeam, api, module_window, parity, qe-testadded |
Reporter | Federico Casali |
Assignee | Hieu Pham |
Created | 2012-05-03T12:06:55.000+0000 |
Updated | 2014-11-24T08:19:47.000+0000 |
Problem description
Focus eventListener is set in the parent window and it's correctly triggered when opening the window. Moving back from a child window to the parent window does not trigger the Focus event.
This happens both for heavyweight and lightweight children window from 1.8.2 SDK. On 1.7.6 it is correctly triggered only if the child window is a heavyweight.
Customer engagement notes
With the same code on iOS, Focus event it's always triggered.
ING will be using Lightweight windows inside a tabGroup and need to have the same behavior, using same code, between iOS and Android.
This is blocking issue for the customer.
Code to reproduce
Using the sample code below, button in win1 opens a Lightweight child window (win3). When win3 it's closed, focus event it's not triggered using all SDK versions.
Uncomment line 36 (fullscreen:false) in order to make 'win3' heavyweight. When win3 it's closed, focus event it's triggered only using SDK 1.7.6. With any other higher version it's not.
// 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'
});
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 1',
window:win1
});
win1.addEventListener('focus', function(){
alert('focused!')
});
var button = Ti.UI.createButton({
title:'open win3',
width:200,
height:100
});
button.addEventListener('click', function(){
var win3 = Ti.UI.createWindow({
title:'foobar',
backgroundColor:'blue',
// fullscreen:false
});
var button2 = Ti.UI.createButton({
title:'back to win1',
width:200,
height:100,
backgroundColor:'white'
});
button2.addEventListener('click', function(){
win3.close()
});
win3.add(button2);
win3.open();
});
win1.add(button);
var win2 = Titanium.UI.createWindow({
title:'Tab 2',
backgroundColor:'#fff'
});
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);
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
tabGroup.open();
Still not working correctly. Run the test case below On app start - win1 focus (passed) Switch to Tab2 - win1 blur, win2 focus (passed) Switch to Tab1 - win2 blur, win1 focus (passed) Press button to open win3 - win1 blur, win3 focus (fail. blur not fired for win1) Press button to close win3 - win3 blur, win1 focus (pass) Press button to open win3 - win1 blur, win3 focus (fail. blur not fired for win1) Switch to Tab2 - win3 blur, win2 focus (fail blur fired on win1) Switch to Tab1 - win2 blur, win3 focus (fail focus fired on win1) Press button to close win3 - win3 blur, win1 focus (fail. Neither focus nor blur fired)
Complex Test Case:
Another test case:
This is still happening to the customer
Fixed, tested on latest CIBuild, provided testcase to the customer.
QE team needs to add a test case so leave the fixed tickets in resolved state.
Closing issue Tested with Ti Studio build 2.1.0.201206172244 Ti Mobile SDK2.1.0.v20120618134156 hash r00905cd0 OSX Lion 10.7.3 Nexus S OS 4.0.4 The expected behavior is shown
Reopening to update labels.
Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/4967