Titanium Mobile
  1. Titanium Mobile
  2. TIMOB-11664

Android: TabGroup: Tabgroup focus event fired twice on application launch and one of those with source as undefined

    Details

      Description

      Tabgroup focus event fired twice on launch of application with tabgroup.

      This is a regression and does not happen on 2.1.3 and 2.1.4

      Steps to Reproduce:
      1. Create an application with code below
      2. Launch the application and check console

      Actual Result:
      The tabgroup focus event is fired twice and one of those have source undefined. Following are the console logs:
      I/TiAPI(8612): -------------> win1 focus event fired! - win 1
      I/TiAPI(8612): -------------> tab1 focus event fired! - Tab 1
      I/TiAPI(8612): -------------> tabGroup focus event fired! - Tab 1
      I/TiAPI(8612): -------------> tabGroup focus event fired! - undefined

      Expected Result:
      The tabgroup focus event should be fired only once

      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();
      

        Issue Links

          Activity

          Hide
          Ingo Muschenetz added a comment -

          focus event is propagating when it shouldn't.

          Show
          Ingo Muschenetz added a comment - focus event is propagating when it shouldn't.
          Show
          Ping Wang added a comment - PR: https://github.com/appcelerator/titanium_mobile/pull/3402
          Hide
          Ping Wang added a comment -

          For FR, please run the above test case for 'android:targetSdkVersion="8"' and 'android:targetSdkVersion="14"' to make sure it works fine for both old-style tabgroup and action bar style tabgroup.

          Show
          Ping Wang added a comment - For FR, please run the above test case for 'android:targetSdkVersion="8"' and 'android:targetSdkVersion="14"' to make sure it works fine for both old-style tabgroup and action bar style tabgroup.
          Show
          Ping Wang added a comment - 3_0_X PR: https://github.com/appcelerator/titanium_mobile/pull/3418
          Hide
          Tamila Smolich (Inactive) added a comment -

          Closing as fixed. Tested on:
          Titanium Studio, build: 3.0.0.201211301903
          Titanium SDK, builds: 3.0.0.v20121130200208; 3.1.0.v20121203181001
          Devices: Samsung Galaxy S III (4.0.4)

          Show
          Tamila Smolich (Inactive) added a comment - Closing as fixed. Tested on: Titanium Studio, build: 3.0.0.201211301903 Titanium SDK, builds: 3.0.0.v20121130200208; 3.1.0.v20121203181001 Devices: Samsung Galaxy S III (4.0.4)

            People

            • Assignee:
              Ping Wang
              Reporter:
              Satyam Sekhri
            • Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development