Android Open Source - MaterialNavigationDrawer Material Drawer Layout






From Project

Back to project page MaterialNavigationDrawer.

License

The source code is released under:

Apache License

If you think the Android project MaterialNavigationDrawer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package it.neokree.materialnavigationdrawer.util;
//from   w  ww . ja  v  a2 s. com
import android.content.Context;
import android.support.v4.widget.DrawerLayout;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.MotionEvent;

/**
 * An improved version of DrawerLayout that will ensure that a locked open DrawerLayout can be used without capturing all touches into the client
 * area.
 * <p>
 *     To activate, call {@link #requestDisallowInterceptTouchEvent(boolean)} on the layout. Note that this should only ever be done in case when
 *     the drawer is to be locked open.
 * </p>
 *
 * Created by neokree on 04/01/15.
 *
 * Original source code by Rainer Burgstaller
 */
public class MaterialDrawerLayout extends DrawerLayout {
    private boolean multipaneSupport = false;

    public MaterialDrawerLayout(Context context) {
        super(context);
    }

    public MaterialDrawerLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MaterialDrawerLayout(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public boolean onInterceptTouchEvent(final MotionEvent ev) {
        if (multipaneSupport) {
            return false;
        }
        return super.onInterceptTouchEvent(ev);
    }

    public void setMultipaneSupport(boolean support) {
        if(Utils.isTablet(this.getResources())) {
            // custom implementation only for tablets
            multipaneSupport = support;
        }
    }

    @Override
    public boolean onKeyUp(int keyCode, KeyEvent event) {

        if(multipaneSupport) {
            return false;
        }
        else {
            return super.onKeyUp(keyCode, event);
        }
    }
}




Java Source Code List

it.neokree.example.MainActivity.java
it.neokree.example.backpattern.BackAnywhere.java
it.neokree.example.backpattern.BackPatternCustom.java
it.neokree.example.backpattern.BackToFirst.java
it.neokree.example.dark.Accounts.java
it.neokree.example.dark.CustomDrawerHeader.java
it.neokree.example.dark.ImageDrawerHeader.java
it.neokree.example.dark.MockedAccount.java
it.neokree.example.dark.NoDrawerHeader.java
it.neokree.example.functionalities.CustomAccountSection.java
it.neokree.example.functionalities.KitkatStatusBar.java
it.neokree.example.functionalities.MultiPane.java
it.neokree.example.functionalities.RealColorSections.java
it.neokree.example.functionalities.RippleBackport.java
it.neokree.example.functionalities.UniqueToolbarColor.java
it.neokree.example.functionalities.master_child.ChildFragment.java
it.neokree.example.functionalities.master_child.MasterChildActivity.java
it.neokree.example.functionalities.master_child.MasterFragment.java
it.neokree.example.light.Accounts.java
it.neokree.example.light.CustomDrawerHeader.java
it.neokree.example.light.ImageDrawerHeader.java
it.neokree.example.light.MockedAccount.java
it.neokree.example.light.NoDrawerHeader.java
it.neokree.example.mockedActivity.Profile.java
it.neokree.example.mockedActivity.Settings.java
it.neokree.example.mockedFragments.FragmentButton.java
it.neokree.example.mockedFragments.FragmentIndex.java
it.neokree.example.mockedFragments.FragmentList.java
it.neokree.materialnavigationdrawer.MaterialNavigationDrawer.java
it.neokree.materialnavigationdrawer.elements.MaterialAccount.java
it.neokree.materialnavigationdrawer.elements.MaterialSection.java
it.neokree.materialnavigationdrawer.elements.MaterialSubheader.java
it.neokree.materialnavigationdrawer.elements.listeners.MaterialAccountListener.java
it.neokree.materialnavigationdrawer.elements.listeners.MaterialSectionListener.java
it.neokree.materialnavigationdrawer.util.MaterialActionBarDrawerToggle.java
it.neokree.materialnavigationdrawer.util.MaterialDrawerLayout.java
it.neokree.materialnavigationdrawer.util.TypefaceManager.java
it.neokree.materialnavigationdrawer.util.Utils.java