use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class LightThemeActivity method init.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "This example shows the light theme. You can set the light theme to the application " + "or activity tag in the AndroidManifest.xml . See android:theme=\"@style/MaterialNavigationDrawerTheme.Light\" in the " + "activity tag for this activity.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Light Theme"));
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.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class MaterialNavHeadItemActivity method switchHeadItemsIcon.
private void switchHeadItemsIcon(final MaterialHeadItem newFirstHeadItem, boolean animation) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && animation) {
// change with animation
switchHeadItemsIconApi14(newFirstHeadItem);
} else {
// change no animation
changeHeadItems(headItemManager.get(0), newFirstHeadItem);
notifyHeadItemsDataChanged();
if (newFirstHeadItem.getMenu() != null && newFirstHeadItem.getMenu().getItems() != null && newFirstHeadItem.getMenu().getItems().size() > 0) {
MaterialMenu menu = newFirstHeadItem.getMenu();
// load fragment on headitem change
if (menu != currentMenu) {
loadMenu(menu);
sectionFragmentLastBackPatternList.clear();
if (newFirstHeadItem.isLoadFragmentOnChanged()) {
loadStartFragmentFromMenu(menu, "isLoadFragmentOnChanged is true, but the menu has no" + " MaterialItemSectionFragment. Add one MaterialItemSectionFragment or set" + " isLoadFragmentOnStartFromMenu to false and set your own fragment");
} else if (currentMenu.getItems().contains(getCurrentSectionFragment())) {
getCurrentSectionFragment().select();
}
} else if (currentMenu.getItems().contains(getCurrentSectionFragment())) {
getCurrentSectionFragment().select();
}
if (headItemManager.get(0).isCloseDrawerOnChanged() && !deviceSupportMultiPane()) {
drawerLayout.closeDrawer(drawerViewGroup);
}
}
// set switcher button to default
headItemButtonSwitcher.setImageResource(R.drawable.ic_arrow_drop_down_white_24dp);
headItemSwitcherOpen = false;
}
}
use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class MaterialNavHeadItemActivity method initHeaderAndMenu.
private void initHeaderAndMenu(Bundle savedInstanceState) {
// init headitem views
if (headItemManager.size() > 0) {
// currentHeadItem = headItemManager.get(0);
notifyHeadItemsDataChanged();
} else {
throw new RuntimeException("No head item");
}
if (headItemManager.get(0).getMenu() != null) {
MaterialMenu menu = headItemManager.get(0).getMenu();
loadMenu(menu);
// load fragment on start from menu
if (isLoadFragmentOnStartFromMenu()) {
loadStartFragmentFromMenu(menu, "isLoadFragmentOnStartFromMenu is true, but the menu has no MaterialItemSectionFragment. Add one MaterialItemSectionFragment or set isLoadFragmentOnStartFromMenu to false and set your own fragment");
}
}
}
use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class MultiPaneSupportActivity method init.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "If you have a tablet, the drawer will be always shown. See " + "the styles.xml for the tablet support.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "MultiPane (Tablet) Support"));
menu.add(new MaterialItemDevisor());
menu.add(new MaterialItemLabel(this, "Sections"));
menu.add(new MaterialItemSectionFragment(this, "Section 1", new FragmentDummy(), "Section 1"));
// load menu
this.loadMenu(menu);
// load first MaterialItemSectionFragment in the menu, because there is no start position
this.loadStartFragmentFromMenu(menu);
}
use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class MultiPaneSupportBelowToolbarActivity method init.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "If you have a tablet, the drawer will be always shown under the toolbar.\" +\n" + " \" See the styles.xml for the tablet and below toolbar support.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "MultiPane (Tablet) And Below ToolBar Support"));
menu.add(new MaterialItemDevisor());
menu.add(new MaterialItemLabel(this, "Sections"));
menu.add(new MaterialItemSectionFragment(this, "Section 1", new FragmentDummy(), "Section 1"));
// load menu
this.loadMenu(menu);
// load first MaterialItemSectionFragment in the menu, because there is no start position
this.loadStartFragmentFromMenu(menu);
}
Aggregations