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

Android: Drawer hamburger menu disappears on click

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: Release 7.4.0, Release 7.3.0, Release 7.2.0
    • Fix Version/s: Release 7.5.0
    • Component/s: Android
    • Labels:
      None
    • Story Points:
      3
    • Sprint:
      2016 Sprint 17 SDK

      Description

      While trying to get a reproducible case for memory-issues, I found another issue where when clicking the hamburger menu of a drawer layout will hide it and does not make it come back.

      Test-Case:

      var window = Ti.UI.createWindow({ backgroundColor: 'white', theme: 'Theme.AppCompat.NoTitleBar', exitOnClose: false });
       
      var btn = Ti.UI.createButton({
      	title: 'Trigger'
      });
       
      btn.addEventListener('click', function() {
      	var window2 = Ti.UI.createWindow({  title: 'Test' });
      	var left = Ti.UI.createView({ backgroundColor: 'red' });
      	var center = Ti.UI.createView({ backgroundColor: 'blue' });
       
      	var button2 = Ti.UI.createButton({ title: 'Close'});
      	left.add(button2);
       
      	button2.addEventListener('click', function () {
      		drawer.closeLeft();
      		window.open();
      		window2.close();
      	})
       
      	var drawer = Ti.UI.Android.createDrawerLayout({
      		centerView: center,
      		leftView: left
      	});
      	window2.add(drawer);
      	window2.open();
      	window.close();
      });
       
      window.add(btn);
      window.open();
      

      Work-Around:
      The solution is to set up the hamburger button on the ActionBar yourself like this...

      window.addEventListener("open", function(e) {
      	var actionBar = window.activity.actionBar;
      	if (actionBar) {
      		actionBar.displayHomeAsUp = true;
      		actionBar.homeButtonEnabled = true;
      		actionBar.onHomeIconItemSelected = function(e) {
      			// Handle the hamburger button click here...
      		};
      	}
      });
      

      We document this here...
      https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Android.ActionBar

        Attachments

          Activity

            People

            • Assignee:
              gmathews Gary Mathews
              Reporter:
              hknoechel Hans Knöchel
              Reviewer:
              Yordan Banev
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Source Code