All Projects → shrikanth7698 → Custom Navigation Drawer

shrikanth7698 / Custom Navigation Drawer

Licence: mit
Custom Navigation Drawer Library for Android

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Custom Navigation Drawer

Duo Navigation Drawer
A flexible, easy to use, unique drawer library for your Android project.
Stars: ✭ 986 (+170.88%)
Mutual labels:  library, navigation-drawer, drawerlayout
Drawer Behavior Flutter
Drawer behavior is a library that provide an extra behavior on drawer, such as, move view or scaling view's height while drawer on slide.
Stars: ✭ 110 (-69.78%)
Mutual labels:  navigation-drawer, drawerlayout
Drawer Behavior
Drawer behavior is a library that provide an extra behavior on drawer, such as, move view or scaling view's height while drawer on slide.
Stars: ✭ 394 (+8.24%)
Mutual labels:  navigation-drawer, drawerlayout
minavdrawer
Easy to add different animations into standard NavigationDrawer.
Stars: ✭ 93 (-74.45%)
Mutual labels:  navigation-drawer, drawerlayout
Materialdrawer
The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.
Stars: ✭ 11,498 (+3058.79%)
Mutual labels:  navigation-drawer, drawerlayout
Slidingrootnav
DrawerLayout-like ViewGroup, where a "drawer" is hidden under the content view, which can be shifted to make the drawer visible.
Stars: ✭ 2,939 (+707.42%)
Mutual labels:  navigation-drawer, drawerlayout
Ceres
Distributable time-series database (not actively maintained)
Stars: ✭ 351 (-3.57%)
Mutual labels:  library
React Canvas
A pluggable layout and graphics system aimed at powering desktop publishing as well as storm-react-diagrams
Stars: ✭ 357 (-1.92%)
Mutual labels:  library
Kissme
Kissme: Kotlin Secure Storage Multiplatform
Stars: ✭ 351 (-3.57%)
Mutual labels:  library
Pytorch Tutorials Examples And Books
PyTorch1.x tutorials, examples and some books I found 【不定期更新】整理的PyTorch 1.x 最新版教程、例子和书籍
Stars: ✭ 346 (-4.95%)
Mutual labels:  library
Libevhtp
Create extremely-fast and secure embedded HTTP servers with ease.
Stars: ✭ 363 (-0.27%)
Mutual labels:  library
Tinyconstraints
Nothing but sugar.
Stars: ✭ 3,721 (+922.25%)
Mutual labels:  library
Python
Official Python client library for kubernetes
Stars: ✭ 4,352 (+1095.6%)
Mutual labels:  library
Aestheticdialogs
📱 An Android Library for 💫fluid, 😍beautiful, 🎨custom Dialogs.
Stars: ✭ 352 (-3.3%)
Mutual labels:  library
Material Calendar View
📅 Material Design Calendar compatible with API 11+
Stars: ✭ 360 (-1.1%)
Mutual labels:  library
Fbg
Lightweight C 2D graphics API agnostic library with parallelism support
Stars: ✭ 349 (-4.12%)
Mutual labels:  library
Time.dart
⏰ Type-safe DateTime and Duration calculations, powered by extensions.
Stars: ✭ 363 (-0.27%)
Mutual labels:  library
Drawroutemaps
Library for draw route maps between two point LatLng
Stars: ✭ 348 (-4.4%)
Mutual labels:  library
Firestoregoogleappsscript
A Google Apps Script library for accessing Google Cloud Firestore.
Stars: ✭ 352 (-3.3%)
Mutual labels:  library
Pmjson
Pure Swift JSON encoding/decoding library
Stars: ✭ 362 (-0.55%)
Mutual labels:  library

alt text forthebadge

forthebadge

forthebadge

Buy Me a Coffee at ko-fi.com

It has smooth zoom-in, zoom-out animation when switched from one fragment to another.

Still in Active Development.

Android Arsenal

Version

Installation

  • Gradle

    Add it in your root build.gradle at the end of repositories:

    allprojects {
     	repositories {
     		...
     		maven { url 'https://jitpack.io' }
     	}
     }
    

    Add the dependency in your app build.gradle

    dependencies {
             compile 'com.github.shrikanth7698:Custom-Navigation-Drawer:v0.0.1'
     }
    
  • Maven

    Add the JitPack repository to your build file

     <repositories>
     	<repository>
     	    <id>jitpack.io</id>
     	    <url>https://jitpack.io</url>
     	</repository>
     </repositories>
    

    Add the dependency

    <dependency>
         <groupId>com.github.shrikanth7698</groupId>
         <artifactId>Custom-Navigation-Drawer</artifactId>
         <version>v0.0.1</version>
     </dependency>
    

Usage

Drop the Custom Navigation Drawer in your XML layout as is shown below:

    <com.shrikanthravi.customnavigationdrawer2.widget.SNavigationDrawer
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/navigationDrawer">
        <FrameLayout
            android:id="@+id/frameLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

    </com.shrikanthravi.customnavigationdrawer2.widget.SNavigationDrawer>

And then in your Activity or fragment

        //Global Declaration
        SNavigationDrawer sNavigationDrawer;
        Class fragmentClass;
        public static Fragment fragment;
        
        //Inside onCreate()
        
        sNavigationDrawer = findViewById(R.id.navigationDrawer);
        
        //Creating a list of menu Items
        
        List<MenuItem> menuItems = new ArrayList<>();
        
        //Use the MenuItem given by this library and not the default one.
        //First parameter is the title of the menu item and then the second parameter is the image which will be the background of the menu item.
        
        menuItems.add(new MenuItem("News",R.drawable.news_bg));
        menuItems.add(new MenuItem("Feed",R.drawable.feed_bg));
        menuItems.add(new MenuItem("Messages",R.drawable.message_bg));
        menuItems.add(new MenuItem("Music",R.drawable.music_bg));
        
        //then add them to navigation drawer
        
        sNavigationDrawer.setMenuItemList(menuItems);
        fragmentClass =  NewsFragment.class;
        try {
            fragment = (Fragment) fragmentClass.newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (fragment != null) {
            FragmentManager fragmentManager = getSupportFragmentManager();
            fragmentManager.beginTransaction().setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out).replace(R.id.frameLayout, fragment).commit();
        }
        
        

        //Listener to handle the menu item click. It returns the position of the menu item clicked. Based on that you can switch between the fragments.
        
        sNavigationDrawer.setOnMenuItemClickListener(new SNavigationDrawer.OnMenuItemClickListener() {
            @Override
            public void onMenuItemClicked(int position) {
                System.out.println("Position "+position);

                switch (position){
                    case 0:{
                        fragmentClass = NewsFragment.class;
                        break;
                    }
                    case 1:{
                        fragmentClass = FeedFragment.class;
                        break;
                    }
                    case 2:{
                        fragmentClass = MessagesFragment.class;
                        break;
                    }
                    case 3:{
                        fragmentClass = MusicFragment.class;
                        break;
                    }

                }
                
                //Listener for drawer events such as opening and closing.
                sNavigationDrawer.setDrawerListener(new SNavigationDrawer.DrawerListener() {

                    @Override
                    public void onDrawerOpened() {

                    }

                    @Override
                    public void onDrawerOpening(){

                    }

                    @Override
                    public void onDrawerClosing(){
                        System.out.println("Drawer closed");

                        try {
                            fragment = (Fragment) fragmentClass.newInstance();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }

                        if (fragment != null) {
                            FragmentManager fragmentManager = getSupportFragmentManager();
                            fragmentManager.beginTransaction().setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out).replace(R.id.frameLayout, fragment).commit();

                        }
                    }

                    @Override
                    public void onDrawerClosed() {

                    }

                    @Override
                    public void onDrawerStateChanged(int newState) {
                        System.out.println("State "+newState);
                    }
                });
            }
        });

Customization

    <com.shrikanthravi.customnavigationdrawer2.widget.SNavigationDrawer
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:navigationDrawerBackgroundColor="#151515"
        app:appbarTitleTextColor="@android:color/white"
        app:HamMenuIconTintColor="@android:color/white"
        app:appbarColor="@android:color/black"
        app:primaryMenuItemTextColor="@android:color/white"
        app:secondaryMenuItemTextColor="@android:color/white"
        app:appbarTitleTextSize="7sp"
        app:primaryMenuItemTextSize="7sp"
        app:secondaryMenuItemTextSize="7sp"
        android:id="@+id/navigationDrawer">
        <FrameLayout
            android:id="@+id/frameLayout"
            android:background="@android:color/black"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

    </com.shrikanthravi.customnavigationdrawer2.widget.SNavigationDrawer>
      

Developed by

License

MIT License

Copyright (c) 2018 Shrikanth Ravi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].