nirwannursabda/expandable-navigation


Menu in navigation drawer using expandable list view

Download


Step 1. Add the JitPack repository to your build file

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

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

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

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.nirwannursabda:expandable-navigation:0.1.2'
	}
	dependencies {
		implementation("com.github.nirwannursabda:expandable-navigation:0.1.2")
	}
	<dependency>
	    <groupId>com.github.nirwannursabda</groupId>
	    <artifactId>expandable-navigation</artifactId>
	    <version>0.1.2</version>
	</dependency>

                            
    libraryDependencies += "com.github.nirwannursabda" % "expandable-navigation" % "0.1.2"
        
        

                            
    :dependencies [[com.github.nirwannursabda/expandable-navigation "0.1.2"]]
        
        

Readme


Release

https://jitpack.io/#nirwannursabda/expandable-navigation

Expandable Navigation

Menu in navigation drawer using expandable list view

Inspired by Navigation Menu TokoPedia :)

<p align="left"> <img src="https://raw.githubusercontent.com/nirwannursabda/expandable-navigation/master/image/expandable-navigation.png" width="350"/> </p>

Use ExpandableNavigationListView inside layout

<com.techatmosphere.expandablenavigation.view.ExpandableNavigationListView
    android:id="@+id/expandable_navigation"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="none"
    android:nestedScrollingEnabled="true"
    android:groupIndicator="@null"
    android:divider="@null"
    />

Bind it inside activity

navigationExpandableListView
    .init(this)
    .addHeaderModel(new HeaderModel("Beranda", R.drawable.ic_home))
    .addHeaderModel(
        new HeaderModel("Kotak Masuk", R.drawable.ic_mail_outline, true)
            .addChildModel(new ChildModel("Chat"))
            .addChildModel(new ChildModel("Diskusi Produk"))
    )
    .addHeaderModel(new HeaderModel("Keluar", R.drawable.ic_assignment_return))
    .build()
    .addOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
        @Override
        public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
            navigationExpandableListView.setSelected(groupPosition);

            drawerLayout.closeDrawer(GravityCompat.START);
            return false;
        }
    })
    .addOnChildClickListener(new ExpandableListView.OnChildClickListener() {
        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            navigationExpandableListView.setSelected(groupPosition, childPosition);

            drawerLayout.closeDrawer(GravityCompat.START);
            return false;
        }
    });

navigationExpandableListView.setSelected(0);

Download

buildscript {
  repositories {
    jcenter()

    maven { url "https://jitpack.io" }
   }
}
dependencies {
  compile 'com.github.nirwannursabda:expandable-navigation:0.1.2'
}

License

Copyright 2018 Tech Atmosphere

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.