use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemThreeActivity 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.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class ImageHeaderActivity 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 an image header in the drawer. " + "Don't forget to call " + "setImageHeader(), to set your image.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Image 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);
// set image for_header
this.setImageHeader(getResources().getDrawable(R.drawable.mat6), 150, ImageView.ScaleType.FIT_XY);
}
use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class ImageHeaderBelowToolbarActivity 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 an image header in the drawer. " + "The drawer is shown under the toolbar. " + "Don't forget to call " + "setImageHeader(), to set your image.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Image 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);
// set image for_header
this.setImageHeader(getResources().getDrawable(R.drawable.mat6), 150, ImageView.ScaleType.FIT_XY);
}
use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemOneAvatarOnClickListenerActivity 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 click on the avatar image from the head item.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Head Item Style (One Item), Avatar OnClick Listener"));
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, "My HeadItem", "My Subtitle", drawableAppIcon, R.drawable.mat1, menu);
// set Avatar on click listener
headItem.setAvatarOnClickListener(new MaterialHeadItemAvatarOnClickListener() {
@Override
public void onClick(MaterialHeadItem headItem) {
Toast.makeText(drawer, "avatar on click", Toast.LENGTH_LONG).show();
}
});
this.addHeadItem(headItem);
// load menu
this.loadMenu(getCurrentHeadItem().getMenu());
// load the MaterialItemSectionFragment, from the given startIndex
this.loadStartFragmentFromMenu(getCurrentHeadItem().getMenu());
}
use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemOneBackgroundOnClickListenerActivity 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 click on the background image from the head item.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Head Item Style (One Item), Background OnClick Listener"));
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, "My HeadItem", "My Subtitle", drawableAppIcon, R.drawable.mat1, menu);
// set Avatar on click listener
headItem.setBackgroundOnClickListener(new MaterialHeadItemBackgroundOnClickListener() {
@Override
public void onClick(MaterialHeadItem headItem) {
Toast.makeText(drawer, "background on click", Toast.LENGTH_LONG).show();
}
});
this.addHeadItem(headItem);
// load menu
this.loadMenu(getCurrentHeadItem().getMenu());
// load the MaterialItemSectionFragment, from the given startIndex
this.loadStartFragmentFromMenu(getCurrentHeadItem().getMenu());
}
Aggregations