Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6844] Android: UI - hardware button events not fired for heavyweight windows in tabGroups

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-03-11T18:12:15.000+0000
Affected Version/sRelease 1.8.0.1
Fix Version/sRelease 1.8.0.1, Sprint 2011-51, Release 2.0.0, Release 1.8.1
ComponentsAndroid
Labelsregression, verified-1.8.0.1
ReporterDavid Palita
AssigneeMarshall Culpepper
Created2011-12-22T02:59:37.000+0000
Updated2014-06-19T12:44:40.000+0000

Description

Problem

Windows in tabgroup do not get any event anymore. Specifically the android:back is not caught. The same code works as expected on 1.7.5 (same device)

Test case

Here is a sample app.js to reproduce :
  var win1 =Ti.UI.createWindow({
  backgroundColor: '#FFFFFF',
  title: 'Win1',
  fullscreen: false,
  navBarHidden: true
});

var tab1 = Ti.UI.createTab({
  title: 'Tab1',
  window: win1
});

var win2 =Ti.UI.createWindow({
  backgroundColor: '#000000',
  title: 'Win2',
  fullscreen: false,
  navBarHidden: true
});
var tab2 = Ti.UI.createTab({
  title: 'Tab2',
  window: win2
});

var tabGroup = Ti.UI.createTabGroup();

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

tabGroup.open();

win1.addEventListener('android:back', function(){
  Ti.API.info('Win 1 caught android:back');
});

win2.addEventListener('android:back', function(){
  Ti.API.info('Win 2 caught android:back');
});

win1.addEventListener('android:search', function(){
  Ti.API.info('Win 1 caught android:search');
});

win1.addEventListener('android:voldown', function(){
  Ti.API.info('Win 1 caught android:voldown');
});
Note that for standard heavyweight windows (without the tabgroup), it works *as expected* on both 1.8.0.1 and 1.7.5:
var win1 =Ti.UI.createWindow({
  backgroundColor: '#FFFFFF',
  title: 'Win1',
  fullscreen: false,
  navBarHidden: true
});

win1.open();

win1.addEventListener('android:back', function(){
  Ti.API.info('Win 1 caught android:back');
});

win1.addEventListener('android:search', function(){
  Ti.API.info('Win 1 caught android:search');
});

win1.addEventListener('android:voldown', function(){
  Ti.API.info('Win 1 caught android:voldown');
});

Comments

  1. Ivan Skugor 2011-12-22

    "TabGroup" component does not support "android:back", could be useful to have that event supported because then we wouldn't have to add "android:back" event to every window in tab group.
  2. Paul Dowsett 2011-12-22

    I have tested this and can confirm that it works as expected in 1.7.5 but not in 1.8.0.1 RC3. A standard heavyweight window works as expected for both versions.
  3. Paul Dowsett 2011-12-22

    David Thanks for the ticket. Please note the changes I made, to bring it in line with the [JIRA Ticket Checklist](https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist). Cheers
  4. Wilson Luu 2011-12-22

    Bug is still persistant on: SDK build: 1.8.0.1.v20111221194633 Runtime: V8, Rhino Titanium Studio, build: 1.0.7.201112152014 Device: Nexus S (2.3.6) Note: Was not able to reproduce bug in 1.7.5 on Nexus S (2.3.6). And, the standard heavyweight windows code works as expected on 1.8.0.1.v20111221194633 (V8/Rhino) on Nexus S (2.3.6).
  5. Wilson Luu 2011-12-22

    Verified fix on: SDK build: 1.8.0.1.v20111222130907 Runtime: V8, Rhino Titanium Studio, build: 1.0.7.201112152014 Device: Nexus S (2.3.6) Note: * The heavyweight windows code still works as expected on 1.8.0.1.v20111222130907 * Will not close bug until verified in 1.9.0
  6. David Palita 2011-12-23

    Thanks for the incredibly fast fix, you guys are amazing. Sorry about the initial ticket formatting, I wasn't aware of your JIRA checklist... I'll comply with it in the future. Happy holidays !
  7. Lorenzo 2011-12-29

    I'm continue experimenting same problem with nightly build SDK build: 1.9.0.v20111228180134 Runtime: V8, Rhino Titanium Studio, build: 1.0.7.201112152014 My first window is a modal window with four buttons. If I open a normal window and go back, android:back button works fine. If I open a tabgroup window and go back, android:back button doesn't work and say me "dialog activity is destroyed, unable to show dialog with message". So If I open a tabgroup window and go back, previous activity is destroyed. I have no problem with 1.7.5.
  8. Allen Yeung 2011-12-29

    Hi Lorenzo, Could you please provide an app.js and reproducible steps on the problem you are seeing? I've created a model window that opens a tab group, and back works fine for me. Thanks, Allen
  9. Lorenzo 2011-12-30

    Ok, here is a simple code of error doing a android:back event after open a tabgroup (fails with 1.8.0.1, and 1.9, works fine with 1.7.5 and early versions of 1.8.0):
       Titanium.UI.setBackgroundColor('#000');
       
       var main_win = Titanium.UI.createWindow({  
           title:"test",
           backgroundColor:'#FFF',
           modal: true,
           exitOnClose: true
       });
       
       main_win.addEventListener('android:back', function(e) {
       	var msg_pregunta = Titanium.UI.createAlertDialog({
       		title:"Quit",
       		message:"Do yo want to quit?"
       	});
       	msg_pregunta.buttonNames = ['OK','Cancelar'];
       
       	msg_pregunta.addEventListener('click', function(e) {
       		if(e.index==0){
       			main_win.close();
       		}
       	});
       	msg_pregunta.show();
       });
       
       var btn_asterisk = Titanium.UI.createButton({
          title:'Asterisk',
          height:Ti.Platform.displayCaps.platformHeight * 0.22,
          width:Ti.Platform.displayCaps.platformWidth * 0.35,
          left:Ti.Platform.displayCaps.platformWidth * 0.10,
          top:Ti.Platform.displayCaps.platformHeight * 0.58,
       });
       
       btn_asterisk.addEventListener('click', function(){
       	Titanium.include('app_asterisk.js');
       });
       
       main_win.add(btn_asterisk);
       
       main_win.open();
       
       var tabGroup = Titanium.UI.createTabGroup();
       
       var win_llamadas = Titanium.UI.createWindow({  
           title:'Calls',
           backgroundColor:'#000',
       });
       var tab1 = Titanium.UI.createTab({  
           icon:'images/KS_nav_views.png',
           title:'Calls',
           window:win_llamadas
       });
       
       var win_buzon = Titanium.UI.createWindow({  
           title:'Inbox',
           backgroundColor:'#000',
       });
       var tab2 = Titanium.UI.createTab({  
           icon:'images/KS_nav_ui.png',
           title:'Inbox',
           window:win_buzon
       });
       
       var win_listanegra = Titanium.UI.createWindow({  
           title:'Black list',
           backgroundColor:'#000',
       });
       
       var tab3 = Titanium.UI.createTab({  
           icon:'images/KS_nav_ui.png',
           title:'Black list',
           window:win_listanegra
       });
       
       tabGroup.addTab(tab1);
       tabGroup.addTab(tab2);
       tabGroup.addTab(tab3);
       
       tabGroup.open();
       
  10. Wilson Luu 2012-01-11

    Closing bug. Already verified in 1.8.0.1.
  11. Lorenzo 2012-02-01

    In 1.8.1 version itsn't fixed. Same problem. If you open a heavyweight window after a normal window. Android back event itn's fired. Refer to my example in the third post up.

JSON Source