use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemTwoExtraMenuActivity method getHeadItem1.
private MaterialHeadItem getHeadItem1() {
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "This example shows the head item style with two items. " + "The first three head items ar shown with a picture. To get the other head items, " + "press the down arrow button in the header. " + "Under the items, you see the extra menu. " + "See the method headerType in the source code.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Switcher Extra Menu (Two Items)"));
menu.add(new MaterialItemSectionFragment(this, "Section 1", new FragmentDummy(), "Section 1"));
menu.add(new MaterialItemSectionFragment(this, "Section 2", new FragmentDummy(), "Section 2"));
menu.add(new MaterialItemSectionFragment(this, "Section 3", new FragmentDummy(), "Section 3"));
// create Head Item
// use bitmap and make a circle photo
final Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.head_item_icon);
final RoundedCornersDrawable drawableAppIcon = new RoundedCornersDrawable(getResources(), bitmap);
MaterialHeadItem headItem = new MaterialHeadItem(this, "A HeadItem", "A Subtitle", drawableAppIcon, R.drawable.mat1, menu);
return headItem;
}
use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemTwoExtraMenuActivity method init.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// add head Item (menu will be loaded automatically)
this.addHeadItem(getHeadItem1());
this.addHeadItem(getHeadItem2());
// load menu
this.loadMenu(getCurrentHeadItem().getMenu());
// load the MaterialItemSectionFragment, from the given startIndex
this.loadStartFragmentFromMenu(getCurrentHeadItem().getMenu());
// create switcher extra menu
MaterialItemSectionOnClick section = new MaterialItemSectionOnClick(this, "do something");
section.setOnSectionClickListener(new MaterialSectionOnClickListener() {
@Override
public void onClick(MaterialItemSection section, View view) {
Toast.makeText(drawer, " do something here", Toast.LENGTH_LONG).show();
}
});
MaterialMenu menu = new MaterialMenu();
menu.add(section);
// add menu to switcher
this.setSwitcherExtraMenu(menu, false);
// show switch button, even if only one head item
this.setSwitchShowForce(true);
}
use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemTwoExtraMenuActivity method getHeadItem2.
private MaterialHeadItem getHeadItem2() {
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Section 1 (Head 2)", new FragmentDummy(), "Section 1 (Head 2)"));
menu.add(new MaterialItemSectionFragment(this, "Section 2", new FragmentDummy(), "Section 2"));
// create Head Item
TextDrawable headPhoto = TextDrawable.builder().buildRound("B", Color.BLUE);
MaterialHeadItem headItem = new MaterialHeadItem(this, "B HeadItem", "B Subtitle", headPhoto, R.drawable.mat6, menu);
return headItem;
}
use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemTwoNoFragmentLoadOnChangeActivity method getHeadItem1.
private MaterialHeadItem getHeadItem1() {
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "If you change the head item, the fragment doesn't change.\" +\n" + " \" Useful, if you don't want to replace the current fragment on a new head item.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Fragment Doesn't Change On HeadItem Change (Two Items)"));
menu.add(new MaterialItemSectionFragment(this, "Section 1", new FragmentDummy(), "Section 1"));
menu.add(new MaterialItemSectionFragment(this, "Section 2", new FragmentDummy(), "Section 2"));
menu.add(new MaterialItemSectionFragment(this, "Section 3", new FragmentDummy(), "Section 3"));
// create Head Item
// use bitmap and make a circle photo
final Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.head_item_icon);
final RoundedCornersDrawable drawableAppIcon = new RoundedCornersDrawable(getResources(), bitmap);
MaterialHeadItem headItem = new MaterialHeadItem(this, "A HeadItem", "A Subtitle", drawableAppIcon, R.drawable.mat1, menu);
// don't change fragment on change
headItem.setLoadFragmentOnChanged(false);
return headItem;
}
use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemFiveActivity method getHeadItem2.
private MaterialHeadItem getHeadItem2() {
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Section 1 (Head 2)", new FragmentDummy(), "Section 1 (Head 2)"));
menu.add(new MaterialItemSectionFragment(this, "Section 2", new FragmentDummy(), "Section 2"));
// create Head Item
TextDrawable headPhoto = TextDrawable.builder().buildRound("B", Color.BLUE);
MaterialHeadItem headItem = new MaterialHeadItem(this, "B HeadItem", "B Subtitle", headPhoto, R.drawable.mat6, menu);
return headItem;
}
Aggregations