A Gmail-like Material Drawer implementation
Based on neokree's MaterialDrawer library, but they are not the same. I have made many improvments, changes and added a lot of new features. Big thanks to neokree, without him this library would not exist.
Different Drawer types
Head Item (Account):
Menu:
Fully themeable (screenshot 11)
Other:
Write your own header Class
Many Many more
You can test the example application in your web browser. https://appetize.io/app/dqmyynvjanx9hydtq4a4vjbkzw
https://github.com/madcyph3r/AdvancedMaterialDrawer/raw/master/example-release.apk
or on the play store (Lib-Version 2.0.0 (17.07.15))
repositories {
maven { url 'http://dl.bintray.com/madcyph3r/maven/' }
}
dependencies {
compile 'de.madcyph3r:materialDrawer:[email protected]'
}
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.nineoldandroids:library:2.4.0'
There are a lot of examples with explanations, how to use the library, here is a small example with one Head-Item. You will get the result from screenshot 1. You see, it's easy :)
public class HeadItemOneActivity extends MaterialNavHeadItemActivity {
MaterialNavigationDrawer drawer = null;
@Override
protected boolean finishActivityOnNewIntent() {
return false;
}
@Override
protected int getNewIntentRequestCode(Class clazz) {
return 0;
}
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// information text for the fragment
Bundle bundle = new Bundle();
bundle.putString("instruction", "This example shows the head item style.");
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)"));
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.yourAvatar);
final RoundedCornersDrawable drawableAppIcon = new RoundedCornersDrawable(getResources(), bitmap);
MaterialHeadItem headItem = new MaterialHeadItem(this, "My HeadItem", "My Subtitle", drawableAppIcon, R.drawable.yourBackground, menu);
this.addHeadItem(headItem);
// load menu
this.loadMenu(getCurrentHeadItem().getMenu());
// load the first MaterialItemSectionFragment from the menu
this.loadStartFragmentFromMenu(getCurrentHeadItem().getMenu());
}
@Override
public void afterInit(Bundle savedInstanceState) {
}
}
I have changed a lot of names and methods. Sorry for that. But now its a lot easier to use this library. The methods name and parameters make more sense. Better abstraction level for the menu items and drawer types. A really better code understanding. Please look in the examples, for the code changes. Then edit your code to the new code base.