use of de.madcyph3r.materialnavigationdrawer.head.MaterialHeadItem 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.head.MaterialHeadItem 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.head.MaterialHeadItem 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());
}
use of de.madcyph3r.materialnavigationdrawer.head.MaterialHeadItem in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemThreeChangeListenerActivity method getHeadItem1.
private MaterialHeadItem getHeadItem1() {
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "Change the head item and the listener is called.\" +\n" + " \" You will see a toast message.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "HeadItem Change 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, "A HeadItem", "A Subtitle", drawableAppIcon, R.drawable.mat1, menu);
return headItem;
}
use of de.madcyph3r.materialnavigationdrawer.head.MaterialHeadItem in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemThreeChangeListenerActivity method init.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// add head Item (menu will be loaded automatically)
this.addHeadItem(getHeadItem1());
this.addHeadItem(getHeadItem2());
this.addHeadItem(getHeadItem3());
// set the listener
this.setHeadItemOnChangeListener(new MaterialHeadItemChangeListener() {
@Override
public void onBeforeChangeHeadItem(MaterialHeadItem newHeadItem) {
Toast.makeText(drawer, "before change head item", Toast.LENGTH_SHORT).show();
}
@Override
public void onAfterChangeHeadItem(MaterialHeadItem newHeadItem) {
Toast.makeText(drawer, "after change head item", Toast.LENGTH_SHORT).show();
}
});
// load menu
this.loadMenu(getCurrentHeadItem().getMenu());
// load the MaterialItemSectionFragment, from the given startIndex
this.loadStartFragmentFromMenu(getCurrentHeadItem().getMenu());
}
Aggregations