[TIMOB-1742] Android: Window in TabGroup loses event listeners
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:57:02.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.6.0 M07 |
Components | Android |
Labels | android, back, backbutton, button, close, defect, event, eventlistener, listener, release-1.6.0, tabGroup, tabgroup |
Reporter | Lukasz |
Assignee | Jeff Haynie |
Created | 2011-04-15T03:01:04.000+0000 |
Updated | 2011-04-17T01:57:02.000+0000 |
Description
This is similar problem to "Android: Window Closed with Back Button Won't Reopen" (https://appcelerator.lighthouseapp.com/projects/32238-titanium-mobile/tickets/1470">https://appcelerator.lighthouseapp.com/projects/32238-titanium-mobi...) but this happens if you use TabGroups instead Windows.
- Create two TabGroups with two windows.
- Attach a click event listener to the window in first TabGroup.
This listener should open the second TabGroup.
- Open first TabGroup.
- Click on window and activate listener.
- Second TabGroup will open.
- Click Android back button, this will close second
TabGroup.
- Click on window and activate listener. Nothing happens.
Testcase:
Titanium.UI.setBackgroundColor('#000');
// create tab group
var tabGroup1 = Titanium.UI.createTabGroup();
var tabGroup2 = Titanium.UI.createTabGroup();
// create base UI tab and root window
var win1 = Titanium.UI.createWindow({
navBarHidden:false,
title:'Tab 1',
backgroundColor:'#fff'
});
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({
navBarHidden:false,
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);
// add tabs
tabGroup1.addTab(tab1);
tabGroup1.addTab(tab2);
// open first tab group
tabGroup1.open();
// create base UI tab and root window
var win3 = Titanium.UI.createWindow({
navBarHidden:false,
title:'Tab 3',
backgroundColor:'#fff'
});
var tab3 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 3',
window:win3
});
var label3 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 3',
font:{
fontSize:20,
fontFamily:'Helvetica Neue'
},
textAlign:'center',
width:'auto'
});
win3.add(label3);
// create controls tab and root window
var win4 = Titanium.UI.createWindow({
navBarHidden:false,
title:'Tab 4',
backgroundColor:'#fff'
});
var tab4 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 4',
window:win4
});
var label4 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 4',
font:{
fontSize:20,
fontFamily:'Helvetica Neue'
},
textAlign:'center',
width:'auto'
});
win4.add(label4);
// add tabs
tabGroup2.addTab(tab3);
tabGroup2.addTab(tab4);
// attach click listener
win1.addEventListener('click', function(){
// this will fire only once
Ti.API.debug('fired click listener!');
tabGroup2.open();
});
Trace:
// first click
[TRACE] E/TiUIView( 2146): (main) [8045,11705] TAP, TAP, TAP
[DEBUG] [28,11733] fired click listener!
[TRACE] I/TabGroupProxy( 2146): (main) [8,11741] handleOpen
[TRACE] I/ActivityManager( 61): Starting activity: Intent { cmp=com.AndroidBackButton/ti.modules.titanium.ui.TiTabActivity (has extras) }
[TRACE] D/PhoneWindow( 2146): couldn't save which view has focus because the focused view com.android.internal.policy.impl.PhoneWindow$DecorView@43e92980 has no id.
[TRACE] W/TiTabActivity( 2146): (main) [104,11845] Notifying TiTabGroup, activity is created
[TRACE] W/TiActivity( 2146): (main) [198,12043] Notifying TiUIWindow, activity is created
[TRACE] I/ActivityManager( 61): Displayed activity com.AndroidBackButton/ti.modules.titanium.ui.TiTabActivity: 417 ms (total 417 ms)
// back button
[TRACE] W/KeyCharacterMap( 2146): No keyboard for id 0
[TRACE] W/KeyCharacterMap( 2146): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
[TRACE] E/TiActivity( 2146): (main) [4082,16125] Layout cleanup.
// second click
[TRACE] E/TiUIView( 2146): (main) [2329,18454] TAP, TAP, TAP
EDITED:
Tested with mobilesdk-1.4.1-20100904221103-osx.zip
Attachments
File | Date | Size |
---|---|---|
app.js | 2011-04-15T03:01:05.000+0000 | 3761 |