use of de.madcyph3r.materialnavigationdrawer.menu.item.style.MaterialItemDevisor in project AdvancedMaterialDrawer by madcyph3r.
the class MaterialNavigationDrawer method loadMenu.
// protected abstract MaterialMenu loadMenuType();
protected void loadMenu(MaterialMenu menu, boolean forceReload) {
if (menu != null && (menu != currentMenu || forceReload)) {
// set the new current menu
currentMenu = menu;
itemSections.removeAllViews();
itemBottomSections.removeAllViews();
// create Menu
List<MaterialMenuItem> itemList = menu.getItems();
for (int i = 0; i < itemList.size(); i++) {
if (itemList.get(i) instanceof MaterialItemSection) {
MaterialItemSection section = (MaterialItemSection) itemList.get(i);
if (section.isBottom())
addBottomSection((MaterialItemSection) itemList.get(i));
else
addSection((MaterialItemSection) itemList.get(i));
} else if (itemList.get(i) instanceof MaterialItemCustom) {
MaterialItemCustom custom = (MaterialItemCustom) itemList.get(i);
if (custom.isBottom())
addBottomCustom((MaterialItemCustom) itemList.get(i));
else
addCustom((MaterialItemCustom) itemList.get(i));
} else if (itemList.get(i) instanceof MaterialItemDevisor) {
MaterialItemDevisor devisor = (MaterialItemDevisor) itemList.get(i);
if (devisor.isBottom())
addDevisorBottom();
else
addDevisor();
} else if (itemList.get(i) instanceof MaterialItemLabel) {
MaterialItemLabel label = (MaterialItemLabel) itemList.get(i);
if (label.isBottom())
addBottomLabel((MaterialItemLabel) itemList.get(i));
else
addLabel((MaterialItemLabel) itemList.get(i));
}
}
// unselect all items
for (int i = 0; i < itemList.size(); i++) {
try {
((MaterialItemSection) itemList.get(i)).unSelect();
} catch (ClassCastException e) {
// nothing to do here
}
}
}
}
use of de.madcyph3r.materialnavigationdrawer.menu.item.style.MaterialItemDevisor in project AdvancedMaterialDrawer by madcyph3r.
the class ActionBarOverlayActivity method init.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "Open the menu and press the section 'Show Overlay', to see it." + " To add overlay support, see 'android:theme=\"@style/ActionBarOverlayTheme\"' in the AndroidManifest.xml and the" + " part for this activity." + " The style is defined in the styles.xml with the name ActionBarOverlayTheme. " + "Or set it on runtime. For this, see the source code from this example.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Actionbar Overlay"));
menu.add(new MaterialItemSectionFragment(this, "Show Overlay", new FragmentActionBarOverlay(), "Show Overlay"));
menu.add(new MaterialItemDevisor());
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);
}
Aggregations