use of de.madcyph3r.materialnavigationdrawer.tools.RoundedCornersDrawable in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemFiveDontCloseOnChangeActivity method getHeadItem1.
private MaterialHeadItem getHeadItem1() {
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "This example shows the head item style with Five items. " + "If a new head item is chosen, the drawer will not close. ");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Don't Close Drawer On HeadItem Change (Five 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);
// don't close the drawer, if this head item chosen
headItem.setCloseDrawerOnChanged(false);
return headItem;
}
use of de.madcyph3r.materialnavigationdrawer.tools.RoundedCornersDrawable in project AdvancedMaterialDrawer by madcyph3r.
the class AddRemoveHeadItemRuntimeActivity method getHeadItem1.
private MaterialHeadItem getHeadItem1() {
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "Here you can add new head-items and/or remove existing head-items. " + "Open the menu and choose the action you want.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create sections
MaterialItemSectionFragment instruction = new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Add Remove HeadItem At Runtime");
MaterialItemSectionOnClick addSection = new MaterialItemSectionOnClick(this, "Add Head Item");
MaterialItemSectionOnClick removeSection = new MaterialItemSectionOnClick(this, "Remove Last Head Item");
// add OnClickListener to MaterialItemSectionOnClick sections
addSection.setOnSectionClickListener(new MaterialSectionOnClickListener() {
@Override
public void onClick(MaterialItemSection section, View view) {
// add headItem, true is needed for view change
drawer.addHeadItem(getHeadItem3(), true);
}
});
removeSection.setOnSectionClickListener(new MaterialSectionOnClickListener() {
@Override
public void onClick(MaterialItemSection section, View view) {
if (drawer.getHeadItemManager().size() > 1)
drawer.removeHeadItem(drawer.getHeadItemManager().size() - 1);
else
Toast.makeText(drawer, "You can't remove all head-items.", Toast.LENGTH_SHORT).show();
}
});
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(instruction);
menu.add(addSection);
menu.add(removeSection);
// create headItem
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.tools.RoundedCornersDrawable in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItem100StaticBackgroundActivity method getHeadItem1.
private MaterialHeadItem getHeadItem1() {
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "This example shows the head item style with five items. " + "The first three head items ar shown with a picture. To get the other head items, " + "press the down arrow button in the header. " + "Under the items, you see the extra menu. ");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "100 static HeadItems"));
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.app_drawer_icon);
final RoundedCornersDrawable drawableAppIcon = new RoundedCornersDrawable(getResources(), bitmap);
MaterialHeadItem headItem = new MaterialHeadItem(this, "A HeadItem", "A Subtitle", drawableAppIcon, menu);
return headItem;
}
use of de.madcyph3r.materialnavigationdrawer.tools.RoundedCornersDrawable in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemThreeActivity method getHeadItem1.
private MaterialHeadItem getHeadItem1() {
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "This example shows the head item style with five items. " + "The first three head items ar shown with a picture. To get the other head items, " + "press the down arrow button in the header.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Head Item Style (Three 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.tools.RoundedCornersDrawable 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());
}
Aggregations