Open PietroGranati opened 9 years ago
I think this stop working site api level 21, I have the same problem I want to set the hamburger icon and make it toggle the side menu, but I can't find any solution on Android.
@PietroGranati do you found any solution?
@invaderhd just came across this through https://github.com/ricardoalcocer/actionbarextras/issues/87
Try updating to 1.1.6 if you are using 4.1.0.GA This should be fixed here #173
/cc @PietroGranati
@manumaticx Your drawer is a great fix, but I have a client that went a bit crazy because they hated the actionbar on top of the drawer. Since Titanium does not support the new ToolBar widget, I need to go back to this.
I'd love to know if anyone got the onclick listener working in this module...
Not sure if this will help, but I had a similar problem.
Added
hamburgerIcon : true
and my menus all came back.
@rwuttke you added hamburgerIcon: true where?
You add it to the drawer? This icon handle click events?
Please show a portion of your code.
@rwuttke Where did you put that? @invaderhd Nope no solution
Sorry guys for being way to terse.
In the creation of the napp drawer itself. Add that as an attribute, or you can call .setHamburgerIcon(true) on the window you created.
var NappDrawerModule = require('dk.napp.drawer');
var mainWindow = NappDrawerModule.createDrawer({
fullscreen:false,
leftWindow: leftMenuView,
centerWindow: centerView,
rightWindow: rightMenuView,
fading: 0.2, // 0-1
parallaxAmount: 0.2, //0-1
shadowWidth:"40dp",
leftDrawerWidth: "200dp",
rightDrawerWidth: "200dp",
animationMode: NappDrawerModule.ANIMATION_NONE,
closeDrawerGestureMode: NappDrawerModule.CLOSE_MODE_MARGIN,
openDrawerGestureMode: NappDrawerModule.OPEN_MODE_ALL,
orientationModes: [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT],
hamburgerIcon : true // Add this line
});
@rwuttke and only with this code the hamburger icon handle the click automatically and open and close the drawer?
In my app I manage to add the hamburger icon but it won't do nothing on click.
Well you would still need the event handlers, this was just to show what I added to the creation.
I had code similar to the OP, and the setOnHomeIconItemSelected was not being fired, adding this in just worked, the event was fired.
actionBar.setOnHomeIconItemSelected(function() {
Ti.API.info("CLICK");
$.drawer.toggleLeftWindow();
});
The Ti.API.info should be in the log and the left window should toggle.
If you have the code for creating the options menu and such, this should just start working as well, ie the menu items, or icons if you are using them, should appear and the click events should be fired.
@rwuttke It work!! Thank you
I have to change this:
actionBar.onHomeIconItemSelected = function(e) {
Ti.API.info("Home icon clicked!");
$.drawer.openLeftWindow();
};
to to your example:
actionBar.setOnHomeIconItemSelected(function() {
Ti.API.info("Home icon clicked!");
$.drawer.openLeftWindow();
});
This is really a strange problem but it works now.
@rwuttke Can you try to open one app then open the app that you are developing without close the other app only minimize and check if the hamburger icon receive the click.
In my case if I open the app the app without anything open on android the click if fired if I have multiple apps opened I don't get any click event. Can someone confirm this?
I think I need to change to other module this module is driving me crazy
@invaderhd I have no problems with that, I can change between apps, come back and the hamburger is working fine.
@rwuttke My problem it not changing between app if for example you open your app, then open other app for example chrome, then only your app and open it again, is in this point that my hamburger stop working.
Since I'm unable to get this completly fix I decided to use https://github.com/manumaticx/Ti.DrawerLayout, we only need to add this to the style
drawerLayout: true
and everything works great on android.
O thanks god! HamburgerIcon : true save wasting one week researching about menu problem.
$.drawer.addEventListener('open', onNavDrawerWinOpen);
function onNavDrawerWinOpen(evt) { this.removeEventListener('open', onNavDrawerWinOpen);
}
Ti Api info never show in console