Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-1742

Android: Window in TabGroup loses event listeners

    Details

      Description

      {html}<div><p>This is similar problem to "Android: Window Closed with Back
      Button Won't Reopen" (<a href=
      "https://appcelerator.lighthouseapp.com/projects/32238-titanium-mobile/tickets/1470">https://appcelerator.lighthouseapp.com/projects/32238-titanium-mobi...</a>)
      but this happens if you use TabGroups instead Windows.</p>
      <ol>
      <li>Create two TabGroups with two windows.<br></li>
      <li>Attach a click event listener to the window in first TabGroup.
      This listener should open the second TabGroup.<br></li>
      <li>Open first TabGroup.<br></li>
      <li>Click on window and activate listener.<br></li>
      <li>Second TabGroup will open.<br></li>
      <li>Click Android back button, this will close second
      TabGroup.<br></li>
      <li>Click on window and activate listener. Nothing happens.</li>
      </ol>
      <p>Testcase:</p>
      <pre>
      <code>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();
      });</code>
      </pre>
      <p>Trace:</p>
      <pre>
      <code>// 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</code>
      </pre>
      <p>EDITED:<br>
      Tested with mobilesdk-1.4.1-20100904221103-osx.zip</p></div>{html}

        Attachments

          Activity

            People

            • Assignee:
              jhaynie Jeff Haynie (Inactive)
              Reporter:
              lukasz Lukasz
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-1561
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration