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

Android DrawerLayout "open" event also fires "open" event of parent Window

    Details

      Description

      When attaching the eventListener "open" to the drawer view, this also triggers the "open" eventListener of the parent window it has been added to.

      EDIT: it also happens with the close event.

      SDK: 8.1.1.GA

      Code example:

       
      var win = Ti.UI.createWindow();
       
      var leftView = Ti.UI.createView({ backgroundColor:'red' });
      var centerView = Ti.UI.createView({ backgroundColor:'yellow' });
      var rightView = Ti.UI.createView({ backgroundColor:'orange' });
       
      var drawer = Ti.UI.Android.createDrawerLayout({
          leftView: leftView,
          centerView: centerView,
          rightView: rightView
      });
      var btn = Ti.UI.createButton({ title: 'RIGHT' });
       
      btn.addEventListener('click', function() {
          drawer.toggleRight();
      });
       
      centerView.add(btn);
       
      win.addEventListener('open', function(){
      	
      	console.log('window opened');	
      	
          var activity = win.getActivity(),
              actionBar = activity.getActionBar();
       
          if (actionBar) {
              actionBar.displayHomeAsUp = true;
              actionBar.onHomeIconItemSelected = function() {
                  drawer.toggleLeft();
              };
          }
      });
       
      drawer.addEventListener('open', function() {
      	console.log('drawer opened');	
      });
       
      drawer.addEventListener('close', function() {
      	console.log('drawer closed');	
      });
       
      win.add(drawer);
      win.open();
      
      

        Attachments

          Activity

            People

            • Assignee:
              gmathews Gary Mathews
              Reporter:
              arif Arjan
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Source Code