use of de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemTwoNoFragmentLoadOnChangeActivity method getHeadItem2.
// head item 2 has no menu You can use this for an avatar click
private MaterialHeadItem getHeadItem2() {
// 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"));
// 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);
// don't change fragment on change
headItem.setLoadFragmentOnChanged(false);
return headItem;
}
use of de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemTwoOnlyOneHasMenuActivity method getHeadItem1.
private MaterialHeadItem getHeadItem1() {
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "The First Item has an menu. The second not, so the menu " + "doesn't swap, if you choose" + " the second head item. Useful, if you don't close the drawer onChange and you have an avatar click listener.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Only First HeadItem Has A 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.item.section.MaterialItemSectionFragment in project AdvancedMaterialDrawer by madcyph3r.
the class CustomHeaderActivity method init.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// Important: see example_custom_header.xml . android:fitsSystemWindows="true" is important,
// otherwise the statusbar overlays the custom header
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "This example has an custom header in the drawer. " + "Call setCustomHeader(), to set your custom header.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Custom 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);
// create and set the recycleview_header
View view = LayoutInflater.from(this).inflate(R.layout.example_custom_header, null);
this.setCustomHeader(view, 150);
}
use of de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment in project AdvancedMaterialDrawer by madcyph3r.
the class CustomHeaderBelowToolbarActivity method init.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// Important: see example_custom_header.xml . android:fitsSystemWindows="true" is important,
// otherwise the statusbar overlays the custom header
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "This example has an custom header in the drawer. " + "The drawer is shown under the toolbar. " + "Call setCustomHeader(), to set your custom header.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Custom 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);
// create and set the recycleview_header
View view = LayoutInflater.from(this).inflate(R.layout.example_custom_header_below_toolbar, null);
this.setCustomHeader(view, 150);
}
use of de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemFiveActivity 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