Search in sources :

Example 11 with FragmentInstruction

use of de.madcyph3r.example.example.FragmentInstruction in project AdvancedMaterialDrawer by madcyph3r.

the class MultiPaneSupportActivity method init.

@Override
public void init(Bundle savedInstanceState) {
    drawer = this;
    // information text for the fragment
    Bundle bundle = new Bundle();
    bundle.putString("instruction", "If you have a tablet, the drawer will be always shown. See " + "the styles.xml for the tablet support.");
    Fragment fragmentInstruction = new FragmentInstruction();
    fragmentInstruction.setArguments(bundle);
    // create menu
    MaterialMenu menu = new MaterialMenu();
    menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "MultiPane (Tablet) Support"));
    menu.add(new MaterialItemDevisor());
    menu.add(new MaterialItemLabel(this, "Sections"));
    menu.add(new MaterialItemSectionFragment(this, "Section 1", new FragmentDummy(), "Section 1"));
    //load menu
    this.loadMenu(menu);
    // load first MaterialItemSectionFragment in the menu, because there is no start position
    this.loadStartFragmentFromMenu(menu);
}
Also used : MaterialItemSectionFragment(de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment) Bundle(android.os.Bundle) MaterialItemDevisor(de.madcyph3r.materialnavigationdrawer.menu.item.style.MaterialItemDevisor) MaterialMenu(de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu) MaterialItemLabel(de.madcyph3r.materialnavigationdrawer.menu.item.style.MaterialItemLabel) FragmentDummy(de.madcyph3r.example.example.FragmentDummy) FragmentInstruction(de.madcyph3r.example.example.FragmentInstruction) Fragment(android.support.v4.app.Fragment) MaterialItemSectionFragment(de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment)

Example 12 with FragmentInstruction

use of de.madcyph3r.example.example.FragmentInstruction in project AdvancedMaterialDrawer by madcyph3r.

the class MultiPaneSupportBelowToolbarActivity method init.

@Override
public void init(Bundle savedInstanceState) {
    drawer = this;
    // information text for the fragment
    Bundle bundle = new Bundle();
    bundle.putString("instruction", "If you have a tablet, the drawer will be always shown under the toolbar.\" +\n" + "                \" See the styles.xml for the tablet and below toolbar support.");
    Fragment fragmentInstruction = new FragmentInstruction();
    fragmentInstruction.setArguments(bundle);
    // create menu
    MaterialMenu menu = new MaterialMenu();
    menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "MultiPane (Tablet) And Below ToolBar Support"));
    menu.add(new MaterialItemDevisor());
    menu.add(new MaterialItemLabel(this, "Sections"));
    menu.add(new MaterialItemSectionFragment(this, "Section 1", new FragmentDummy(), "Section 1"));
    //load menu
    this.loadMenu(menu);
    // load first MaterialItemSectionFragment in the menu, because there is no start position
    this.loadStartFragmentFromMenu(menu);
}
Also used : MaterialItemSectionFragment(de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment) Bundle(android.os.Bundle) MaterialItemDevisor(de.madcyph3r.materialnavigationdrawer.menu.item.style.MaterialItemDevisor) MaterialMenu(de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu) MaterialItemLabel(de.madcyph3r.materialnavigationdrawer.menu.item.style.MaterialItemLabel) FragmentDummy(de.madcyph3r.example.example.FragmentDummy) FragmentInstruction(de.madcyph3r.example.example.FragmentInstruction) Fragment(android.support.v4.app.Fragment) MaterialItemSectionFragment(de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment)

Example 13 with FragmentInstruction

use of de.madcyph3r.example.example.FragmentInstruction 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);
}
Also used : MaterialItemSectionFragment(de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment) Bundle(android.os.Bundle) MaterialItemDevisor(de.madcyph3r.materialnavigationdrawer.menu.item.style.MaterialItemDevisor) MaterialMenu(de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu) FragmentActionBarButtons(de.madcyph3r.example.example.functionally.actionBarButtonsActivity.FragmentActionBarButtons) FragmentInstruction(de.madcyph3r.example.example.FragmentInstruction) Fragment(android.support.v4.app.Fragment) MaterialItemSectionFragment(de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment)

Example 14 with FragmentInstruction

use of de.madcyph3r.example.example.FragmentInstruction 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;
}
Also used : Bitmap(android.graphics.Bitmap) MaterialItemSectionFragment(de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment) Bundle(android.os.Bundle) RoundedCornersDrawable(de.madcyph3r.materialnavigationdrawer.tools.RoundedCornersDrawable) MaterialMenu(de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu) MaterialHeadItem(de.madcyph3r.materialnavigationdrawer.head.MaterialHeadItem) FragmentDummy(de.madcyph3r.example.example.FragmentDummy) FragmentInstruction(de.madcyph3r.example.example.FragmentInstruction) Fragment(android.support.v4.app.Fragment) MaterialItemSectionFragment(de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment)

Example 15 with FragmentInstruction

use of de.madcyph3r.example.example.FragmentInstruction in project AdvancedMaterialDrawer by madcyph3r.

the class AddRemoveMenuItemsActivity method init.

@Override
public void init(Bundle savedInstanceState) {
    drawer = this;
    // information text for the fragment
    Bundle bundle = new Bundle();
    bundle.putString("instruction", "Remove and add menu items at runtime. Open the menu and then " + "you can choose your action.");
    Fragment fragmentInstruction = new FragmentInstruction();
    fragmentInstruction.setArguments(bundle);
    // create menu
    final MaterialMenu menu = new MaterialMenu();
    menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Add And Remove Menu Items"));
    menu.add(new MaterialItemSectionFragment(this, "Section 1", new FragmentDummy(), "Section 1"));
    menu.add(new MaterialItemSectionFragment(this, "Section 2", new FragmentDummy(), "Section 2"));
    MaterialItemSectionOnClick section3 = new MaterialItemSectionOnClick(this, "add two sections and one devisor");
    menu.add(section3);
    section3.setOnSectionClickListener(new MaterialSectionOnClickListener() {

        @Override
        public void onClick(MaterialItemSection section, View v) {
            Toast.makeText(drawer, "added two section", Toast.LENGTH_SHORT).show();
            // add two items on the first position
            menu.add(new MaterialItemDevisor());
            menu.add(0, new MaterialItemSectionFragment(drawer, "added two", new FragmentDummy(), "added two"));
            menu.add(0, new MaterialItemSectionFragment(drawer, "added one", new FragmentDummy(), "added one"));
            // reloads the current menu, this is "menu"
            reloadMenu();
        }
    });
    MaterialItemSectionOnClick section4 = new MaterialItemSectionOnClick(this, "add one section at the end");
    menu.add(section4);
    section4.setOnSectionClickListener(new MaterialSectionOnClickListener() {

        @Override
        public void onClick(MaterialItemSection section, View v) {
            Toast.makeText(drawer, "added one section", Toast.LENGTH_SHORT).show();
            // add one item on the last position
            menu.add(new MaterialItemDevisor());
            menu.add(new MaterialItemSectionFragment(drawer, "added one", new FragmentDummy(), "added one"));
            // reloads the current menu, this is "menu"
            reloadMenu();
        }
    });
    MaterialItemSectionOnClick section5 = new MaterialItemSectionOnClick(this, "remove first menu item");
    menu.add(section5);
    section5.setOnSectionClickListener(new MaterialSectionOnClickListener() {

        @Override
        public void onClick(MaterialItemSection section, View v) {
            if (getCurrentMenu().getItems().size() > 1) {
                Toast.makeText(drawer, "removed first menu item", Toast.LENGTH_SHORT).show();
                // remove first menu item
                getCurrentMenu().getItems().remove(0);
                // reloads the current menu, this is "menu"
                reloadMenu();
            }
        }
    });
    // load menu
    this.loadMenu(menu);
    // load the MaterialItemSectionFragment, from the given startIndex
    this.loadStartFragmentFromMenu(menu);
}
Also used : MaterialSectionOnClickListener(de.madcyph3r.materialnavigationdrawer.listener.MaterialSectionOnClickListener) MaterialItemSectionFragment(de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment) Bundle(android.os.Bundle) MaterialItemSectionOnClick(de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionOnClick) MaterialItemDevisor(de.madcyph3r.materialnavigationdrawer.menu.item.style.MaterialItemDevisor) MaterialMenu(de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu) FragmentDummy(de.madcyph3r.example.example.FragmentDummy) FragmentInstruction(de.madcyph3r.example.example.FragmentInstruction) Fragment(android.support.v4.app.Fragment) MaterialItemSectionFragment(de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment) View(android.view.View) MaterialItemSection(de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSection)

Aggregations

FragmentInstruction (de.madcyph3r.example.example.FragmentInstruction)49 MaterialMenu (de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu)49 MaterialItemSectionFragment (de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment)49 Bundle (android.os.Bundle)48 Fragment (android.support.v4.app.Fragment)48 FragmentDummy (de.madcyph3r.example.example.FragmentDummy)43 Bitmap (android.graphics.Bitmap)17 MaterialHeadItem (de.madcyph3r.materialnavigationdrawer.head.MaterialHeadItem)17 RoundedCornersDrawable (de.madcyph3r.materialnavigationdrawer.tools.RoundedCornersDrawable)17 MaterialItemDevisor (de.madcyph3r.materialnavigationdrawer.menu.item.style.MaterialItemDevisor)11 View (android.view.View)6 MaterialItemSection (de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSection)5 MaterialItemLabel (de.madcyph3r.materialnavigationdrawer.menu.item.style.MaterialItemLabel)5 Intent (android.content.Intent)3 MaterialSectionOnClickListener (de.madcyph3r.materialnavigationdrawer.listener.MaterialSectionOnClickListener)3 MaterialItemSectionActivity (de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionActivity)3 MaterialItemSectionOnClick (de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionOnClick)3 MaterialSectionChangeListener (de.madcyph3r.materialnavigationdrawer.listener.MaterialSectionChangeListener)2 DrawerLayout (android.support.v4.widget.DrawerLayout)1 ImageView (android.widget.ImageView)1