use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class ActionBarButtonsActivity 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 choose the section \"Change Actionbar Buttons Section\". \" +\n" + " \"Now you get a view, there you can change the actionbar button.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Change/Hide Actionbar Button"));
menu.add(new MaterialItemDevisor());
menu.add(new MaterialItemSectionFragment(this, "Change Actionbar Button", new FragmentActionBarButtons(), "Change Actionbar Button"));
// load menu
this.loadMenu(menu);
// load first MaterialItemSectionFragment in the menu, because there is no start position
this.loadStartFragmentFromMenu(menu);
}
use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class AllMenuTypesActivity method init.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "This example shows all menu items. " + "Open the drawer and see ;).");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "All Menu Types"));
menu.add(new MaterialItemDevisor());
menu.add(new MaterialItemCustom(this, R.layout.custom_section));
menu.add(new MaterialItemLabel(this, "Label"));
menu.add(new MaterialItemSectionFragment(this, "Fragment Section", new FragmentDummy(), "Fragment Section"));
MaterialItemSectionFragment secNoti = new MaterialItemSectionFragment(this, "Fragment Section Notification", new FragmentDummy(), "Fragment Section Notification");
secNoti.setNotifications(20);
menu.add(secNoti);
menu.add(new MaterialItemSectionFragment(this, "Fragment Section Icon", this.getResources().getDrawable(R.drawable.ic_favorite_black_36dp), new FragmentDummy(), "Fragment Section Icon"));
MaterialItemSectionFragment iconBanner = new MaterialItemSectionFragment(this, this.getResources().getDrawable(R.drawable.ic_favorite_black_36dp), true, new FragmentDummy(), "Fragment Section Icon Banner");
// iconBanner.getIconView().setScaleType(ImageView.ScaleType.CENTER); edit the iconView to your needs
menu.add(iconBanner);
menu.add(new MaterialItemSectionFragment(this, "Fragment Section Color Red", this.getResources().getDrawable(R.drawable.ic_favorite_black_36dp), new FragmentDummy(), "Fragment Section Color Red").setSectionColor(Color.parseColor("#ff0858")));
menu.add(new MaterialItemDevisor());
menu.add(new MaterialItemSectionActivity(this, "Activity Section", new Intent(this, DummyActivity.class)));
MaterialItemSectionOnClick onClickSection = new MaterialItemSectionOnClick(this, "OnClick Section");
onClickSection.setOnSectionClickListener(new MaterialSectionOnClickListener() {
@Override
public void onClick(MaterialItemSection section, View v) {
Toast.makeText(drawer, "OnClickSection", Toast.LENGTH_SHORT).show();
}
});
menu.add(onClickSection);
MaterialItemSectionFragment bottom = new MaterialItemSectionFragment(this, "Fragment Bottom Section", new FragmentDummy(), "Fragment Bottom Section");
bottom.setBottom(true);
menu.add(bottom);
// load menu
this.loadMenu(menu);
// load the MaterialItemSectionFragment, from the given startIndex
this.loadStartFragmentFromMenu(menu);
}
use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class OwnDrawerWidthActivity 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 menu and you see, the width is smaller.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Own Drawer Width"));
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);
}
use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu in project AdvancedMaterialDrawer by madcyph3r.
the class UniqueToolbarColorActivity method init.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "This example shows only the defined toolbar color." + " The toolbar color doesn't change, even if a section has a section color, like 'section 1'. " + "Press on 'Section 1', and you will see, the toolbar color doesn't change. " + " See 'android:theme=\"@style/UniqueToolbarColorTheme\"' in the AndroidManifest.xml and the" + " part for this activity." + " The style is defined int the styles.xml with the name UniqueToolbarColorTheme.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Unique Toolbar Color"));
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);
}
use of de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu 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;
}
Aggregations