use of de.madcyph3r.example.example.FragmentDummy in project AdvancedMaterialDrawer by madcyph3r.
the class MyThemeActivity 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 a own theme definition with a head item. The theme is defined in the styles.xml with the " + "name MyOwnTheme. Then it's set to this activity " + "in the AndroidManifest.xml . See android:theme=\"@style/MyOwnTheme\" in the " + "activity tag for this activity. It can set to the application tag, too.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "My Theme"));
menu.add(new MaterialItemSectionFragment(this, "Section 1", new FragmentDummy(), "Section 1").setSectionColor(Color.parseColor("#ff0000")));
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);
this.addHeadItem(headItem);
// load menu
this.loadMenu(menu);
// load the MaterialItemSectionFragment, from the given startIndex
this.loadStartFragmentFromMenu(menu);
}
use of de.madcyph3r.example.example.FragmentDummy in project AdvancedMaterialDrawer by madcyph3r.
the class BackPatternCustomActivity 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 a custom back pattern. " + "Go to 'Section 2' and then press back. It will open section 1 and then instruction and then" + " it goes back to the latest activity.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Custom Back Pattern"));
menu.add(new MaterialItemSectionFragment(this, "Section 1", new FragmentDummy(), "Section 1"));
menu.add(new MaterialItemSectionFragment(this, "Section 2", new FragmentDummy(), "Section 2"));
// load menu
this.loadMenu(menu);
// load first MaterialItemSectionFragment in the menu, because there is no start position
this.loadStartFragmentFromMenu(menu);
// set back pattern
this.setBackPattern(MaterialNavigationDrawer.BACKPATTERN_CUSTOM);
}
use of de.madcyph3r.example.example.FragmentDummy in project AdvancedMaterialDrawer by madcyph3r.
the class BackPatternStartIndexActivity method init.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "On the back button the start section will be selected and opened.\" +\n" + " \" If the start section open, it will call super.onBackPressed() method.");
Fragment fragmentInstruction = new FragmentInstruction();
fragmentInstruction.setArguments(bundle);
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "StartIndex Back Pattern"));
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"));
menu.setStartIndex(3);
// load menu
this.loadMenu(menu);
// load the MaterialItemSectionFragment, from the given startIndex
this.loadStartFragmentFromMenu(menu);
// set back pattern
this.setBackPattern(MaterialNavigationDrawer.BACKPATTERN_BACK_TO_START_INDEX);
}
use of de.madcyph3r.example.example.FragmentDummy in project AdvancedMaterialDrawer by madcyph3r.
the class AddRemoveHeadItemRuntimeActivity method getHeadItem2.
private MaterialHeadItem getHeadItem2() {
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Section 1", this.getResources().getDrawable(R.drawable.ic_favorite_black_36dp), new FragmentDummy(), "Section 1"));
menu.add(new MaterialItemSectionFragment(this, "Section 2", new FragmentDummy(), "Section 2"));
// create headItem
TextDrawable headPhoto = TextDrawable.builder().buildRound("B", Color.BLUE);
MaterialHeadItem headItem = new MaterialHeadItem(this, "B HeadItem No Menu", "B Subtitle", headPhoto, R.drawable.mat6, menu);
return headItem;
}
use of de.madcyph3r.example.example.FragmentDummy in project AdvancedMaterialDrawer by madcyph3r.
the class AddRemoveHeadItemRuntimeActivity method getHeadItem3.
private MaterialHeadItem getHeadItem3() {
// create menu
MaterialMenu menu = new MaterialMenu();
menu.add(new MaterialItemSectionFragment(this, "Section 1 (Head " + headCount + ")", this.getResources().getDrawable(R.drawable.ic_favorite_black_36dp), new FragmentDummy(), "Section 1 (Head " + headCount + ")"));
menu.add(new MaterialItemSectionFragment(this, "Section 2 (Head " + headCount + ")", new FragmentDummy(), "Section 2 (Head " + headCount + ")"));
// create headItem
TextDrawable headPhoto = TextDrawable.builder().buildRound(headCount + "", Color.BLUE);
MaterialHeadItem headItem = new MaterialHeadItem(this, headCount + " HeadItem No Menu", headCount + " Subtitle", headPhoto, R.drawable.mat6, menu);
// counter for the new headItem
headCount++;
return headItem;
}
Aggregations