use of de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment in project AdvancedMaterialDrawer by madcyph3r.
the class OnlyIconsActivity method init.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "The Menu has Only Icons");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, this.getResources().getDrawable(R.drawable.app_drawer_icon), true, new FragmentDummy(), "Fragment Section Icon Banner"));
menu.add(new MaterialItemSectionFragment(this, this.getResources().getDrawable(R.drawable.ic_extension_black_36dp), true, new FragmentDummy(), "Extension"));
menu.add(new MaterialItemSectionFragment(this, this.getResources().getDrawable(R.drawable.ic_list_black_36dp), true, new FragmentDummy(), "List"));
menu.add(new MaterialItemSectionFragment(this, this.getResources().getDrawable(R.drawable.ic_favorite_black_36dp), true, new FragmentDummy(), "Favorite").setSectionColor(Color.parseColor("#ff0858")));
// load menu
this.loadMenu(menu);
// load the MaterialItemSectionFragment, from the given startIndex
this.loadStartFragmentFromMenu(menu);
}
use of de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment in project AdvancedMaterialDrawer by madcyph3r.
the class MaterialNavigationDrawer method loadStartFragmentFromMenu.
protected void loadStartFragmentFromMenu(MaterialMenu menu, String runtimeExceptionMessage) {
MaterialItemSectionFragment section = null;
if (menu.getStartIndex() > -1) {
if (menu.getItem(menu.getStartIndex()) instanceof MaterialItemSectionFragment) {
section = (MaterialItemSectionFragment) menu.getItem(menu.getStartIndex());
} else {
throw new RuntimeException("The index doesn't point on a MaterialFragmentSection.");
}
} else {
section = menu.getFirstFragmentItem();
}
if (section != null) {
changeToolbarColor(section);
changeFragment((Fragment) section.getFragment(), section.getFragmentTitle());
currentSectionFragment = section;
// try to select. then it doesn't work, it's not the current menu
if (currentMenu.getItems().contains(currentSectionFragment)) {
section.select();
sectionFragmentLastBackPatternList.add(section);
}
} else {
throw new RuntimeException(runtimeExceptionMessage);
}
}
use of de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment in project AdvancedMaterialDrawer by madcyph3r.
the class NoHeaderActivity method init.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "This example has no header in the drawer. " + "Call " + "setCustomMenu(), to set your menu.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "No Header"));
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"));
// load menu
this.loadMenu(menu);
// load the MaterialItemSectionFragment, from the given startIndex
this.loadStartFragmentFromMenu(menu);
}
use of de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment in project AdvancedMaterialDrawer by madcyph3r.
the class NoHeaderBelowToolbarActivity method init.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "This example has no header in the drawer. " + "The drawer is shown under the toolbar. " + "Call " + "setCustomMenu(), to set your menu.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "No Header Below Toolbar"));
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"));
// load menu
this.loadMenu(menu);
// load the MaterialItemSectionFragment, from the given startIndex
this.loadStartFragmentFromMenu(menu);
}
use of de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemThreeChangeListenerActivity 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