Giter VIP home page Giter VIP logo

advancedmaterialdrawer's Introduction

AdvancedMaterialDrawer

Android Arsenal API

Donate

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.

Main Features:

Different Drawer types

  • HeadItem (f.e. screenshot 1)
  • No header (f.e. screenshot 6)
  • Only Image in header (see example tool)
  • Create your own header style (screenshot 7)

Head Item (Account):

  • Unlimited Head-Items (Accounts), tested with 100 Head-Items
  • Head-Item listeners for Avatar or Background taps
  • Adding and removing Head-Items at runtime
  • Every Head-Item can have its own menu
  • Create your own Head-Item style (Custom Head-Item)
  • Or no Head-Item, if you need only the menu

Menu:

  • Menu with unlimit Menu-Items
  • Adding and removing Menu-Items at runtime
  • Only icon menu (screenshot 8)
  • Available Menu-items:
    • Labels
    • Divider
    • Normal Sections
      • can call new fragment, activity or implements own onClick
      • with and without icon
      • with notification number
    • Only Icon
      • can call new fragment, activity or implements own onClick
    • Bottom-Sections
      • same as normal section
    • Custom Sections ! (add your own section implementation, like a checkbox etc.) see screenshot 5

Fully themeable (screenshot 11)

Other:

  • Drawer can be over and below the toolbar
  • Tablet support
  • Toolbar overflow support, so a image can be your background. (screenshot 9)
  • Many many more: Setting your own Fragment on Start, etc. Play with the example app ;).
  • The screenshots doesn't show all functions, you can do many more with the lib.

Write your own header Class

Many Many more

Live Demo (Lib-Version 2.0.0 (17.07.15))

You can test the example application in your web browser. https://appetize.io/app/dqmyynvjanx9hydtq4a4vjbkzw

Example APK (Lib-Version 2.0.0 (17.07.15))

https://github.com/madcyph3r/AdvancedMaterialDrawer/raw/master/example-release.apk

or on the play store (Lib-Version 2.0.0 (17.07.15))

Android app on Google Play

Download

repositories {
    maven { url 'http://dl.bintray.com/madcyph3r/maven/' }
}

dependencies {
    compile 'de.madcyph3r:materialDrawer:2.0.0@aar'
}

Dependencies

compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.nineoldandroids:library:2.4.0'

Usage

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) {

    }
}

From <= 1.1.4 to 2.0.0

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.

Others

  • If you've found an issue, look up the open issues and submit a new one if it isn't yet reported.
  • If you like the library press the star ;)
  • A Wiki with some Introduction will come soon.

Screenshots

screenshot

screenshot

screenshot

screenshot

screenshot

screenshot

screenshot

screenshot

screenshot

screenshot

screenshot

advancedmaterialdrawer's People

Contributors

jakubjerabek avatar jjhesk avatar madcyph3r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

advancedmaterialdrawer's Issues

Failed to resolve.

I add

repositories {
    maven { url 'http://dl.bintray.com/madcyph3r/maven/' }
}

dependencies {
    compile 'de.madcyph3r:materialDrawer:1.1.3@aar'
}

in build.gradle. But it return Failed to resolve: de.madcyph3r:materialDrawer:1.1.3

Any help will be appreciated.

Multi Drawer Option

Can we have two Drawers that are both Side i.e. On Left & Right Side as well ??
If so, then how can I achieve this ?

Head item don't show the title and subtitle

Hi madcyph3r!
I'm using your repositorie for an app but I have a problem with the head item: I have copied your head item example but in my app it doesn't show the "Head title" and "Head Subtitle", only the "Head Image"... and I don't know what can I do for fix this...
Have you any idea about fix this problem?

Drawer selected item

Hi
Thanks for the useful library.
I'm trying to achieve a two levels navigation.
I'm using a BaseActivity that creates the common navigation drawer.

MainActivity extends BaseActivity and shows the first fragment.
Every navigation drawer item replaces a fragment. These fragments contain lists.
If I click the second navigation drawer item, it correctly replaces the fragment and select the item in the navigation drawer.

Clicking a list item opens a DetailActivity. DetailActivity extends BaseActivity, so I have the common navigation drawer. Now, I have a few needs:

  • Setting the toolbar icon to something like a left-arrow, instead of the hamburger
  • Setting the proper "selected" item in the navigation drawer.
    Any help?

If you think I'm using the wrong approach, please, let me. I'd appreciate feedbacks.
Thanks

divider seems not working

i used the code like so:

        newDevisor(menu);
        newSection("Fashion", listpage.newInstance(fashion()), false, menu);
        newDevisor(menu);

it doesnt work as expected.

onbackpressed

why if i press back exit app??? please make it customizable

Master Child Navigation

How can I use Master Child Navigation up to multilevel ??
Bcoz of multi-level navigation does not work properly..

Use Same Menu for all Fragment

How can I have same Menu in all fragments ??
If i use OnCreateMenu in DrawerActivity then I cannot access the Drawer, so how can I achieve this ??

Set custom font in Toolbar

Hi, great work you put on improving this library!

I have a question though. Is there a way I can change the toolbar's typeface on fragment change?
I've tried adding a custom textview into Toolbar by getToolbar() method, but it still uses default font.

Is there a way I can set this globally so that all fragments are using this custom font on its Toolbar?

Master Child Navigation and AdvancedMaterialDrawer with SlidingTab

Hi,
Sorry for bugging you again.
But I want to clear few more things like:

  1. Can we show drawer toggle animation when going back to master fragment from child?
  2. As I said in issue #24 that section with activity opens again & again, but section with fragment already loaded doesn't closes the drawer. I mean that section1 loads B fragment then clicking section1 again should close the drawer (without loading fragment again, you may already have taken care of this reloading, I think). Please check if you can close the drawer if fragment is already loaded.

Thanks for your example with MasterChildNavigation, though you forgot to add that in your app I think.
To test I have added this in your FunctionallyFragment.java and added this activity to manifest.

content.add(new ExampleData("Master/Child Fragment Activity", MasterChildNavActivity.class));

Thanks again.

why so many repetitive functions?

    private void addLabel(MaterialLabel label) {
...
    }

    private void addBottomLabel(MaterialLabel label) {
...
    }

    private void addSection(MaterialSection section) {
...
    }

    private void addBottomSection(MaterialSection section) {
...
    }

I saw that they are the same. We need to make it more concise.

Examples

Kinda lost There are a lot of examples with explanations... where?

change this app on tablet crash

please change default case at line 830 in this way

            if(actionBarToggle != null) {
                getActionBarToggle().setDrawerIndicatorEnabled(true);
                getSupportActionBar().setHomeButtonEnabled(true);
            }
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            getSupportActionBar().invalidateOptionsMenu();
            break;

actionbar issue background customization

There is an action bar on V21 and V19 styling issue followed by the material drawer. There is a request that I want to make my own pattern or images for the background of the action bar but it doesnt seem to let me doing so. I would like to ask if there is a possible way to achieve this. I would really want to get this under control by a custom attribution declaration in the nagivationdrawer theme.

How to keep ActionBar when i start a new activity ?

Hi, first thanks for this very USEFUL library,

I have just one problem, when i want to start another activity, i don't know how to keep action bar.

// my home activity with navigation drawer
public class MainActivity extends MaterialNavigationDrawer
....
startActivity(intent);
....

// my second activity
public class GainActivity extends ActionBarActivity

I hope i was clear :)
Thank you.

jerky from selecting items in the drawer

since there is heavy loading from the layout and binding layout within the fragment. I want to ask for a better solution to transit different fragments in the layout. accordingly article. is there anyway to implement that into the code base?

Status bar (top bar) alweys is darken

Hi,
top bar alweys is dark (like have extra layer with #66000000"), even with :
< item name=" autoDarkStatusBar ">false< /item >

to be shure i also change:
autoDarkStatusbar = false;
in init, but effect stay, how to disable it?

change fragment toolbar and menu

how can i handle the change fragment and show back button? than if first fragment show again menu button? and how can i lock menu?

Latest Android updates causing problems?

I'm not entirely sure of the cause, but I'm quietly confident recent changes in Android have caused a conflict with your library:

~PathToMyProject\app\build\intermediates\exploded-aar\de.madcyph3r\materialDrawer\1.1.3\res\values\values.xml
Error:(2) Attribute "rippleColor" has already been defined

I'm pretty sure it's adding this new dependency which is causing the problem since it seems to compile without it:

compile 'com.android.support:design:22.2.0'

How to use with multiple activities

Hi,
First of all thanks for this useful library with ripple support on lower android version.

I am trying to include this library as 2 level navigation with using BaseActivity.

What I have done is:

  1. Created a BaseActivity to include all code that you have given in your sample code.
  2. MainActivity extends this base activity and I get the drawer as expected with first section fragment loaded(Wiki on neokree repo suggest that first section should should always be fragment, is there a alternative?)

What I have to do is:

  1. I have another section which is intent and starts a new SecondActivity. Is this possible to make this section as selected when SecondActivity is launched(Currently no section is selected when SecondActivity is launched).
  2. I also get a null pointer exception on DrawerToggle while setting a back arrow instead of hamburger in SecondActivity. I followed same step as you mentioned in issue #16, but didn't help.

How can I achieve this type of navigation drawer across all activity (like Gmail does, loading a particular email has Inbox section highlighted, maybe they are using fragment) . Is this possible with Activity or I have to use fragment everywhere to achieve this?

Please help.
By the way please add DummyActivity in your example's manifest.xml, as it causes exception.
Thanks.

window overlay

i cannot set windows overlay property. neither from manifest and neither dynamically

change photo on MaterialHeadItem

I want to change photo after creation of MaterialHeadItem. I'm using picasso and when i do setPhoto(drawable), nothing happens (no refresh).

Switcher menu item

Could you please add Switcher menu item like in google play music app? Or maybe there are some suggestions so I can do it easilly?

Thanks!

tablet multipane and configChanges orientation

Hi. I'm trying to edit the lib to handle the rotation for tablet without reload all activity and fragment. But i can't do it. The problem is:

Start app in landscape
Menu is opened fixed to left and content to right
Change fragment in content fragment
Rotate tablet and all is reload, so menu is with slide but first fragment is show and not second

if i put "configChanges orientation" in manifest, the content fragment show the latest fragment that i loaded, but menu still with slide both for landscape and portrait.

can you help me please?

DialogFragment on click section issue

I'm passing a DialogFragment into newSection in my drawer. In order for the dialog event to show, it needs to use .show() method. The problem with this is every time my drawer started, it will automatically trigger the event without having me to click on the section.

Here is the code for clarification:

        FragmentManager fm = getSupportFragmentManager();
        FragmentLogoutDialog fragmentLogoutDialog = new FragmentLogoutDialog();
        fragmentLogoutDialog.show(fm, "logout_dialog_fragment");
        this.newSection(getString(R.string.section_bottom_logout), fragmentLogoutDialog, true, menu);

Anything else besides DialogFragment is fine with this. How do I make DialogFragment trigger only when I click on the section? Or is there something I missed?

Thanks

How can I Replace Fragment ?

How can I Replace Fragment from Curr. Fragment but not like Master Child Navigation , want to replace as in the done in Section Selection in DrawerActivity..??

second menu

how do i make it to navigate from the first menu to the second menu list within the drawer?

listview menu

when i add more item in menu and appear scroll than bottom item disappear

if u fix this problem can u release ASAP the lib on maven? also as snapshot please

Using large amount (50+) of head items with listener and static background.

Hey madcyph3r,

First off great lib! its freaking awesome!!!

I'd like to use this lib in a project where i have an array of custom objects and am using this array to build the head items. Sometimes i may have up to 50+ custom objects in the array and need a head item for each one. I'd like to have a static background between them. Or a way to load the background initially for the first item then only on head item change. (I ran into memory issues when setting the same background (~12kb jpg) to 50+ header items).

I need to be able to load the custom object from the array based on the position of the head item that was clicked (either by avatar clicked or from extra menu).

I'd attempted to use bits and pieces from the header item types 5 item with extra menu and i can successfully build 50+ header items with a transparent xml background and a onheaditemchange listener. However this listener seems to only be being called when i click the avatars and not when clicking from the extra menu (not sure why).

Any advise or explanation on how to go about this would be greatly appreciated. Also do you have in the pipeline a demo with large amounts of head items or something similar to my query? thanks for your time.

Not Use this lib

hi, thanks you for develop for this lib
i want use this lib but i'm not. run of the project show me this errors :

03-31 12:42:54.427 2130-2130/com.example.tellfa.myapplication4 E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.tellfa.myapplication4, PID: 2130
java.lang.NoSuchFieldError: de.madcyph3r.materialnavigationdrawer.R$id.current_head_item_title
at de.madcyph3r.materialnavigationdrawer.MaterialNavigationDrawer.initViews(MaterialNavigationDrawer.java:300)
at de.madcyph3r.materialnavigationdrawer.MaterialNavigationDrawer.onCreate(MaterialNavigationDrawer.java:184)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)

please help me, this lib is important for me

Small glitch when opening new Fragment

I have 6 sections ( 6 fragments ) inside the Drawer and the problem is that when I press on a section there's a small glitch. I just don't like the fact that the drawer executes 2 operations in the same time ( it closes the drawer and it opens the new fragment in the same time ) --> which causes that glitch.
How can I avoid this?

I was thinking to implement a handler ( even if it's not a good practice ) but I can't get it done.

Or maybe someone can come up with a better solution, thanks!

reload menu

if i set custom fragment at startup app crash. please edit this method so:

// own methods
public void reloadMenu() {
    loadMenu(false, false);
    if (null != currentSection) currentSection.select();
}

if you have better solution good work :D

remove section fast

if i remove section in a for() the section are not removed correctly

for (int i = 0; i < categorySections.size() - 1; i++) {
        getCurrentMenu().removeItem(categorySections.get(i));
        categorySections.remove(i);
    }

for (QUICategory category : quiCategories) {
        if (QUICategoryUtils.isRealCategory(category)) {
            MaterialSection categorySection = newSection(category.getName(), DrawableController.getWalletIcon(PromotionsActivity.this), PromotionsListFragment.newInstance(category, address), false, drawer.getCurrentMenu());
            categorySection.getText().setTextColor(getResources().getColor(R.color.primary));
            categorySection.setIcon(new      ColorDrawable(getResources().getColor(android.R.color.transparent)));
            categorySections.add(categorySection);
        } else {
            newLabel(category.getName(), false, drawer.getCurrentMenu());
        }
    }

Start Fragment from Another Fragment

How can I Start Fragment from Another Fragment ?
And Current Fragment is in Material Drawer & New Fragment to be replaced is not in the Material Drawer..So how can I start New Fragment on Button Click that is in Current Fragment ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.