Skip to content

Instantly share code, notes, and snippets.

@Namib
Created December 22, 2014 06:06
Show Gist options
  • Save Namib/b5eb49560f476c18df7a to your computer and use it in GitHub Desktop.
Save Namib/b5eb49560f476c18df7a to your computer and use it in GitHub Desktop.
var thisWin=$.index;
var main=$.firstview;
// store drawermenu and main in global variable for easy access from menu
Alloy.CFG.drawermenu=$.drawermenu;
Alloy.CFG.main=main;
Alloy.CFG.contactus = $.secondview;
Alloy.CFG.thisWin = thisWin;
var menu=Alloy.createController('menu').getView();
$.drawermenu.init({
menuview:menu,
mainview:main,
duration:200,
parent: thisWin
});
thisWin.addEventListener('open',function(e){
var actionBarHelper = require('com.alcoapps.actionbarhelper')(thisWin);
actionBarHelper.setIcon('/drawericonw@2x.png');
actionBarHelper.setTitle('Demo');
actionBarHelper.setUpAction(function(e){
$.drawermenu.showhidemenu();
});
actionBarHelper.displayHomeAsUp(false);
});
thisWin.open();
<Alloy>
<Window class="container">
<Require type="widget" src="com.alcoapps.drawermenu" id="drawermenu"/>
<!--Home screen-->
<View id = "firstview" title="" fullscreen="false" backgroundImage="/images/background_home_3.png" backgroundRepeat="false" visible="true">
<Label id="welcomeLabel" text="Welcome"/>
<Label id="promotionsLabel" text="LATEST OFFERS"/>
<ScrollableView id="scrollableView" ></ScrollableView>
</View>
<!--Contact us screen-->
<View id="secondview" title="" backgroundImage="/images/InternalScreen.png" backgroundRepeat="false" visible="false">
<Label id="LblLocal" text = "contact us"/>
<Button id="buttonbrach" />
<Button id="buttonFeedback"/>
<Button id="buttonAbout"/>
</View>
</Window>
</Alloy>
var args = arguments[0] || {};
function menuclick(e){
var rowId=e.rowData.rowId;
switch (rowId){
case "1":
Alloy.CFG.main.visible = true;
Alloy.CFG.contactus.visible = false;
break;
case "2":
//Alloy.CFG.main.backgroundColor="#3C3F93";
Alloy.CFG.main.visible = false;
Alloy.CFG.contactus.visible = true;
break;
}
Alloy.CFG.drawermenu.showhidemenu();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment