use of de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment in project AdvancedMaterialDrawer by madcyph3r.
the class NoClosePrevDrawerActivity_Activity method init.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "Open the drawer and choose the 'start activity' section. Then press back, \" +\n" + " \"you will get back to this activity.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "No Close Previous Drawer Activity"));
menu.add(new MaterialItemDevisor());
menu.add(new MaterialItemSectionActivity(this, "start Activity", new Intent(this, NoCloseActivity.class)));
// 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.item.section.MaterialItemSectionFragment in project AdvancedMaterialDrawer by madcyph3r.
the class SetCustomFragmentActivity method init.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// create menu
MaterialMenu menu = new MaterialMenu();
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);
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "This activity starts with a custom fragment. " + "It's not from the menu.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// set custom fragment
this.changeFragment(fragmentInstruction, "Custom Fragment Instruction");
}
use of de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment in project AdvancedMaterialDrawer by madcyph3r.
the class ChildFragment method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Get item selected and deal with it
switch(item.getItemId()) {
case android.R.id.home:
// your back action, here get the last section fragment called
// show the menu button and unlock the drawer
drawer.showActionBarMenuIcon(MaterialNavigationDrawer.ActionBarMenuItem.MENU);
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
MaterialItemSectionFragment fragmentSection = drawer.getCurrentSectionFragment();
// set the fragment from the selected section
drawer.changeFragment(fragmentSection.getFragment(), fragmentSection.getFragmentTitle());
// normally currentSection gets unselect on setCustomFragment call
// in the next relase, i will add a new method without unselect
drawer.getCurrentSectionFragment().select();
// }
return true;
}
return super.onOptionsItemSelected(item);
}
use of de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemFiveExtraMenuActivity method getHeadItem3.
private MaterialHeadItem getHeadItem3() {
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Section 1 (Head 3)", new FragmentDummy(), "Section 1 (Head 3)"));
menu.add(new MaterialItemSectionFragment(this, "Section 2", new FragmentDummy(), "Section 2"));
// create Head Item
TextDrawable headPhoto = TextDrawable.builder().buildRound("C", Color.GRAY);
MaterialHeadItem headItem = new MaterialHeadItem(this, "C HeadItem", "C Subtitle", headPhoto, R.drawable.mat6, menu);
return headItem;
}
use of de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemFiveExtraMenuActivity method getHeadItem4.
private MaterialHeadItem getHeadItem4() {
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Section 1 (Head 4)", new FragmentDummy(), "Section 1 (Head 4)"));
menu.add(new MaterialItemSectionFragment(this, "Section 2", new FragmentDummy(), "Section 2"));
// create Head Item
TextDrawable headPhoto = TextDrawable.builder().buildRound("D", Color.GRAY);
MaterialHeadItem headItem = new MaterialHeadItem(this, "D HeadItem", "D Subtitle", headPhoto, R.drawable.mat6, menu);
return headItem;
}
Aggregations