use of de.madcyph3r.example.example.FragmentInstruction 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.example.example.FragmentInstruction 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.example.example.FragmentInstruction in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemFiveExtraMenuActivity 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. \" +\n" + " \"The first three head items ar shown with a picture. To get the other head items, \" +\n" + " \"press the down arrow button in the header. \" +\n" + " \"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, "Switcher Extra Menu (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);
return headItem;
}
use of de.madcyph3r.example.example.FragmentInstruction in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemThreeDontCloseOnChangeActivity 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 three items. \" +\n" + " \"If a new head item is chosen, the drawer will not close. \" +\n" + " \"See the method headerType in the source code.");
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 (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);
// don't close the drawer, if this head item chosen
headItem.setCloseDrawerOnChanged(false);
return headItem;
}
use of de.madcyph3r.example.example.FragmentInstruction in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemTwoExtraMenuActivity 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 two 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. " + "See the method headerType in the source code.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Switcher Extra 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;
}
Aggregations