├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── drawable
│ │ │ │ ├── ic_home_black_24dp.xml
│ │ │ │ ├── ic_person_black_24dp.xml
│ │ │ │ ├── ic_mail_black_24dp.xml
│ │ │ │ └── ic_assessment_black_24dp.xml
│ │ │ └── layout
│ │ │ │ ├── fragment_first.xml
│ │ │ │ ├── fragment_fourth.xml
│ │ │ │ ├── fragment_third.xml
│ │ │ │ └── fragment_second.xml
│ │ ├── java
│ │ │ └── me
│ │ │ │ └── riddhimanadib
│ │ │ │ └── bottomnavbar
│ │ │ │ ├── ThirdFragment.java
│ │ │ │ ├── FourthFragment.java
│ │ │ │ ├── FirstFragment.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── SecondFragment.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── me
│ │ │ └── riddhimanadib
│ │ │ └── bottomnavbar
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── me
│ │ └── riddhimanadib
│ │ └── bottomnavbar
│ │ └── ExampleInstrumentedTest.java
├── build.gradle
└── proguard-rules.pro
├── bottom-nav-bar
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ └── colors.xml
│ │ │ └── layout
│ │ │ │ ├── activity_bottom_bar_holder.xml
│ │ │ │ └── bottom_nav_bar.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── me
│ │ │ └── riddhimanadib
│ │ │ └── library
│ │ │ ├── NavigationPage.java
│ │ │ ├── BottomBarHolderActivity.java
│ │ │ └── BottomNavigationBar.java
│ ├── test
│ │ └── java
│ │ │ └── me
│ │ │ └── riddhimanadib
│ │ │ └── library
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── me
│ │ └── riddhimanadib
│ │ └── library
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
├── install.gradle
├── bintray.gradle
└── build.gradle
├── settings.gradle
├── screenshot
├── quora.jpg
├── screenshot.gif
└── official_bottom_nav_bar.jpg
├── .idea
├── copyright
│ └── profiles_settings.xml
├── vcs.xml
├── modules.xml
├── runConfigurations.xml
├── gradle.xml
├── compiler.xml
└── misc.xml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── gradle.properties
├── gradlew.bat
├── README.md
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/bottom-nav-bar/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':bottom-nav-bar'
2 |
--------------------------------------------------------------------------------
/screenshot/quora.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riddhimanadib/BottomNavBar/HEAD/screenshot/quora.jpg
--------------------------------------------------------------------------------
/screenshot/screenshot.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riddhimanadib/BottomNavBar/HEAD/screenshot/screenshot.gif
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | BottomNavBar
3 |
4 |
--------------------------------------------------------------------------------
/bottom-nav-bar/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Library
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riddhimanadib/BottomNavBar/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/screenshot/official_bottom_nav_bar.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riddhimanadib/BottomNavBar/HEAD/screenshot/official_bottom_nav_bar.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riddhimanadib/BottomNavBar/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riddhimanadib/BottomNavBar/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riddhimanadib/BottomNavBar/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riddhimanadib/BottomNavBar/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riddhimanadib/BottomNavBar/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riddhimanadib/BottomNavBar/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riddhimanadib/BottomNavBar/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riddhimanadib/BottomNavBar/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riddhimanadib/BottomNavBar/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riddhimanadib/BottomNavBar/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Apr 13 12:14:23 BDT 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/bottom-nav-bar/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #F8F8F8
4 | #9D0E15
5 | #727272
6 |
7 |
--------------------------------------------------------------------------------
/bottom-nav-bar/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_home_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_person_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_first.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_fourth.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_third.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_mail_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_assessment_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/test/java/me/riddhimanadib/bottomnavbar/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package me.riddhimanadib.bottomnavbar;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/bottom-nav-bar/src/test/java/me/riddhimanadib/library/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package me.riddhimanadib.library;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_second.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/java/me/riddhimanadib/bottomnavbar/ThirdFragment.java:
--------------------------------------------------------------------------------
1 | package me.riddhimanadib.bottomnavbar;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | /**
10 | * Created by Adib on 13-Apr-17.
11 | */
12 |
13 | public class ThirdFragment extends Fragment {
14 |
15 | public static ThirdFragment newInstance() {
16 | return new ThirdFragment();
17 | }
18 |
19 | @Override
20 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
21 | return inflater.inflate(R.layout.fragment_third, container, false);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/me/riddhimanadib/bottomnavbar/FourthFragment.java:
--------------------------------------------------------------------------------
1 | package me.riddhimanadib.bottomnavbar;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | /**
10 | * Created by Adib on 13-Apr-17.
11 | */
12 |
13 | public class FourthFragment extends Fragment{
14 |
15 | public static FourthFragment newInstance() {
16 | return new FourthFragment();
17 | }
18 |
19 | @Override
20 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
21 | return inflater.inflate(R.layout.fragment_fourth, container, false);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.2"
6 | defaultConfig {
7 | applicationId "me.riddhimanadib.bottomnavbar"
8 | minSdkVersion 16
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile 'com.android.support:appcompat-v7:25.3.0'
24 | compile project(path: ':bottom-nav-bar')
25 | }
26 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | lt application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the ART/Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 | out/
15 |
16 | # Gradle files
17 | .gradle/
18 | build/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Log Files
27 | *.log
28 |
29 | # Android Studio Navigation editor temp files
30 | .navigation/
31 |
32 | # Android Studio captures folder
33 | captures/
34 |
35 | # Intellij
36 | *.iml
37 | .idea/workspace.xml
38 | .idea/tasks.xml
39 | .idea/libraries
40 |
41 | # Keystore files
42 | *.jks
43 |
44 | # External native build folder generated in Android Studio 2.2 and later
45 | .externalNativeBuild
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/bottom-nav-bar/src/main/res/layout/activity_bottom_bar_holder.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/me/riddhimanadib/bottomnavbar/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package me.riddhimanadib.bottomnavbar;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("me.riddhimanadib.bottomnavbar", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/bottom-nav-bar/src/androidTest/java/me/riddhimanadib/library/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package me.riddhimanadib.library;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("me.riddhimanadib.library.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/bottom-nav-bar/src/main/java/me/riddhimanadib/library/NavigationPage.java:
--------------------------------------------------------------------------------
1 | package me.riddhimanadib.library;
2 |
3 | import android.graphics.drawable.Drawable;
4 | import android.support.v4.app.Fragment;
5 |
6 | /**
7 | * A base class that holds the title, icon and an instance of the fragment to be shown as each
8 | * Navigation page
9 | *
10 | * Created by Adib on 15-Apr-17.
11 | */
12 |
13 | public class NavigationPage {
14 |
15 | private String title;
16 | private Drawable icon;
17 | private Fragment fragment;
18 |
19 | public NavigationPage(String title, Drawable icon, Fragment fragment) {
20 | this.title = title;
21 | this.icon = icon;
22 | this.fragment = fragment;
23 | }
24 |
25 | public String getTitle() {
26 | return title;
27 | }
28 |
29 | public Drawable getIcon() {
30 | return icon;
31 | }
32 |
33 | public Fragment getFragment() {
34 | return fragment;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Resources-Android\SDK\androidSdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/bottom-nav-bar/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Resources-Android\SDK\androidSdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/bottom-nav-bar/install.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.github.dcendents.android-maven'
2 |
3 | group = publishedGroupId
4 |
5 | install {
6 | repositories.mavenInstaller {
7 | // This generates POM.xml with proper parameters
8 | pom {
9 | project {
10 | packaging 'aar'
11 | groupId publishedGroupId
12 | artifactId artifact
13 |
14 | // Add your description here
15 | name libraryName
16 | description libraryDescription
17 | url siteUrl
18 |
19 | // Set your license
20 | licenses {
21 | license {
22 | name licenseName
23 | url licenseUrl
24 | }
25 | }
26 | developers {
27 | developer {
28 | id developerId
29 | name developerName
30 | email developerEmail
31 | }
32 | }
33 | scm {
34 | connection gitUrl
35 | developerConnection gitUrl
36 | url siteUrl
37 |
38 | }
39 | }
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/bottom-nav-bar/bintray.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.jfrog.bintray'
2 |
3 | version = libraryVersion
4 |
5 | if (project.hasProperty("android")) {
6 | task sourcesJar(type: Jar) {
7 | classifier = 'sources'
8 | from android.sourceSets.main.java.srcDirs
9 | }
10 |
11 | task javadoc(type: Javadoc) {
12 | source = android.sourceSets.main.java.srcDirs
13 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
14 | }
15 | } else {
16 | task sourcesJar(type: Jar, dependsOn: classes) {
17 | classifier = 'sources'
18 | from sourceSets.main.allSource
19 | }
20 | }
21 |
22 | task javadocJar(type: Jar, dependsOn: javadoc) {
23 | classifier = 'javadoc'
24 | from javadoc.destinationDir
25 | }
26 |
27 | artifacts {
28 | archives javadocJar
29 | archives sourcesJar
30 | }
31 |
32 | Properties properties = new Properties()
33 | properties.load(project.rootProject.file('local.properties').newDataInputStream())
34 |
35 | bintray {
36 | user = properties.getProperty("bintray.user")
37 | key = properties.getProperty("bintray.apikey")
38 |
39 | configurations = ['archives']
40 | pkg {
41 | repo = bintrayRepo
42 | name = bintrayName
43 | desc = libraryDescription
44 | websiteUrl = siteUrl
45 | vcsUrl = gitUrl
46 | licenses = allLicenses
47 | publish = true
48 | publicDownloadNumbers = true
49 | version {
50 | desc = libraryDescription
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/app/src/main/java/me/riddhimanadib/bottomnavbar/FirstFragment.java:
--------------------------------------------------------------------------------
1 | package me.riddhimanadib.bottomnavbar;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | /**
11 | * Created by Adib on 13-Apr-17.
12 | */
13 |
14 | public class FirstFragment extends Fragment {
15 |
16 | private OnFragmentInteractionListener listener;
17 |
18 | public static FirstFragment newInstance() {
19 | return new FirstFragment();
20 | }
21 |
22 | @Override
23 | public void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | }
26 |
27 | @Override
28 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
29 | return inflater.inflate(R.layout.fragment_first, container, false);
30 | }
31 |
32 | @Override
33 | public void onAttach(Context context) {
34 | super.onAttach(context);
35 | if (context instanceof OnFragmentInteractionListener) {
36 | listener = (OnFragmentInteractionListener) context;
37 | } else {
38 | throw new RuntimeException(context.toString() + " must implement OnFragmentInteractionListener");
39 | }
40 | }
41 |
42 | @Override
43 | public void onDetach() {
44 | super.onDetach();
45 | listener = null;
46 | }
47 |
48 | public interface OnFragmentInteractionListener {
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/bottom-nav-bar/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.github.dcendents.android-maven'
3 |
4 | ext {
5 | bintrayRepo = 'maven'
6 | bintrayName = 'bottom-nav-bar'
7 |
8 | publishedGroupId = 'me.riddhimanadib.bottom-nav-bar'
9 | libraryName = 'bottom-nav-bar'
10 | artifact = 'bottom-nav-bar'
11 |
12 | libraryDescription = 'Easily add four tabbed bottom navigation bar in your activity.'
13 |
14 | siteUrl = 'https://github.com/adib2149/BottomNavBar'
15 | gitUrl = 'https://github.com/adib2149/BottomNavBar.git'
16 |
17 | libraryVersion = '1.0.1'
18 |
19 | developerId = 'adib2149'
20 | developerName = 'Riddhiman Adib'
21 | developerEmail = 'adib2149@gmail.com'
22 |
23 | licenseName = 'The Apache Software License, Version 2.0'
24 | licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
25 | allLicenses = ["Apache-2.0"]
26 | }
27 |
28 | android {
29 | compileSdkVersion 25
30 | buildToolsVersion "25.0.2"
31 |
32 | defaultConfig {
33 | minSdkVersion 16
34 | targetSdkVersion 25
35 | versionCode 1
36 | versionName "1.0"
37 |
38 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
39 |
40 | }
41 | buildTypes {
42 | release {
43 | minifyEnabled false
44 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
45 | }
46 | }
47 | }
48 |
49 | dependencies {
50 | compile 'com.android.support:appcompat-v7:25.3.0'
51 | compile 'com.android.support:support-v4:25.3.0'
52 | compile 'com.android.support:design:25.3.0'
53 | compile 'com.android.support:cardview-v7:25.3.0'
54 | }
55 |
56 | apply from: 'install.gradle'
57 | apply from: 'bintray.gradle'
--------------------------------------------------------------------------------
/app/src/main/java/me/riddhimanadib/bottomnavbar/MainActivity.java:
--------------------------------------------------------------------------------
1 | package me.riddhimanadib.bottomnavbar;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.content.ContextCompat;
5 | import android.widget.Toast;
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | import me.riddhimanadib.library.BottomBarHolderActivity;
11 | import me.riddhimanadib.library.NavigationPage;
12 |
13 | public class MainActivity extends BottomBarHolderActivity implements FirstFragment.OnFragmentInteractionListener, SecondFragment.OnFragmentInteractionListener {
14 |
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 |
19 | NavigationPage page1 = new NavigationPage("Home", ContextCompat.getDrawable(this, R.drawable.ic_home_black_24dp), FirstFragment.newInstance());
20 | NavigationPage page2 = new NavigationPage("Support", ContextCompat.getDrawable(this, R.drawable.ic_mail_black_24dp), SecondFragment.newInstance());
21 | NavigationPage page3 = new NavigationPage("Billing", ContextCompat.getDrawable(this, R.drawable.ic_assessment_black_24dp), ThirdFragment.newInstance());
22 | NavigationPage page4 = new NavigationPage("Profile", ContextCompat.getDrawable(this, R.drawable.ic_person_black_24dp), FourthFragment.newInstance());
23 |
24 | List navigationPages = new ArrayList<>();
25 | navigationPages.add(page1);
26 | navigationPages.add(page2);
27 | navigationPages.add(page3);
28 | navigationPages.add(page4);
29 |
30 | super.setupBottomBarHolderActivity(navigationPages);
31 | }
32 |
33 | @Override
34 | public void onClicked() {
35 | Toast.makeText(this, "Clicked!", Toast.LENGTH_SHORT).show();
36 | }
37 | }
--------------------------------------------------------------------------------
/app/src/main/java/me/riddhimanadib/bottomnavbar/SecondFragment.java:
--------------------------------------------------------------------------------
1 | package me.riddhimanadib.bottomnavbar;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.v4.app.Fragment;
6 | import android.support.v7.widget.AppCompatButton;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 |
11 | /**
12 | * Created by Adib on 13-Apr-17.
13 | */
14 |
15 | public class SecondFragment extends Fragment{
16 |
17 | private OnFragmentInteractionListener listener;
18 |
19 | public static SecondFragment newInstance() {
20 | return new SecondFragment();
21 | }
22 |
23 | @Override
24 | public void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | }
27 |
28 | @Override
29 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
30 | View view = inflater.inflate(R.layout.fragment_second, container, false);
31 |
32 | ((AppCompatButton) view.findViewById(R.id.button)).setOnClickListener(new View.OnClickListener() {
33 | @Override
34 | public void onClick(View view) {
35 | listener.onClicked();
36 | }
37 | });
38 |
39 | return view;
40 | }
41 |
42 | @Override
43 | public void onAttach(Context context) {
44 | super.onAttach(context);
45 | if (context instanceof FirstFragment.OnFragmentInteractionListener) {
46 | listener = (OnFragmentInteractionListener) context;
47 | } else {
48 | throw new RuntimeException(context.toString() + " must implement OnFragmentInteractionListener");
49 | }
50 | }
51 |
52 | @Override
53 | public void onDetach() {
54 | super.onDetach();
55 | listener = null;
56 | }
57 |
58 | public interface OnFragmentInteractionListener {
59 |
60 | void onClicked();
61 |
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/bottom-nav-bar/src/main/java/me/riddhimanadib/library/BottomBarHolderActivity.java:
--------------------------------------------------------------------------------
1 | package me.riddhimanadib.library;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.support.v4.app.FragmentTransaction;
6 | import android.support.v7.app.AppCompatActivity;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | public class BottomBarHolderActivity extends AppCompatActivity implements BottomNavigationBar.BottomNavigationMenuClickListener {
12 |
13 | // helper class for handling UI and click events of bottom-nav-bar
14 | private BottomNavigationBar mBottomNav;
15 |
16 | // list of Navigation pages to be shown
17 | private List mNavigationPageList = new ArrayList<>();
18 |
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.activity_bottom_bar_holder);
23 | }
24 |
25 | /**
26 | * initializes the BottomBarHolderActivity with sent list of Navigation pages
27 | * @param pages
28 | */
29 | public void setupBottomBarHolderActivity(List pages) {
30 |
31 | // throw error if pages does not have 4 elements
32 | if (pages.size() != 4) {
33 | throw new RuntimeException("List of NavigationPage must contain 4 members.");
34 | } else {
35 | mNavigationPageList = pages;
36 | mBottomNav = new BottomNavigationBar(this, pages, this);
37 | setupFragments();
38 | }
39 |
40 | }
41 |
42 | /**
43 | * sets up the fragments with initial view
44 | */
45 | private void setupFragments() {
46 | FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
47 | fragmentTransaction.replace(R.id.frameLayout, mNavigationPageList.get(0).getFragment());
48 | fragmentTransaction.commit();
49 | }
50 |
51 | /**
52 | * handling onclick events of bar items
53 | * @param menuType
54 | */
55 | @Override
56 | public void onClickedOnBottomNavigationMenu(int menuType) {
57 |
58 | // finding the selected fragment
59 | Fragment fragment = null;
60 | switch (menuType) {
61 | case BottomNavigationBar.MENU_BAR_1:
62 | fragment = mNavigationPageList.get(0).getFragment();
63 | break;
64 | case BottomNavigationBar.MENU_BAR_2:
65 | fragment = mNavigationPageList.get(1).getFragment();
66 | break;
67 | case BottomNavigationBar.MENU_BAR_3:
68 | fragment = mNavigationPageList.get(2).getFragment();
69 | break;
70 | case BottomNavigationBar.MENU_BAR_4:
71 | fragment = mNavigationPageList.get(3).getFragment();
72 | break;
73 | }
74 |
75 | // replacing fragment with the current one
76 | if (fragment != null) {
77 | FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
78 | fragmentTransaction.replace(R.id.frameLayout, fragment);
79 | fragmentTransaction.commit();
80 | }
81 |
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Bottom-Nav-Bar
2 | ==================
3 |
4 | > Easily add four tabbed bottom navigation bar in your app.
5 |
6 | 
7 |
8 | This library aids in adding four tabs in Bottom Navigation Bar, as easily and fast as possible. Th result looks like as it is commonly found in most of the apps, like Quora and others.
9 |
10 |
11 | Difference from Official [Bottom Navigation View](https://material.io/guidelines/components/bottom-navigation.html)
12 | -----------------
13 | - This library is significantly different from what Google has provided for Android Developers. The official Bottom Navigation View from Google doesn't show text when it has 4 tabs.
14 |
15 | 
16 |
17 | - this library helps you add icons and texts with four bottom bars very easily and efficiently, where all stays visisble all the time, just like this one here:
18 |
19 | 
20 |
21 | Features
22 | -----------------
23 | - Easily add four tabbed bottom navigation bar with minimal code
24 | - changes color based on accent
25 |
26 |
27 | Installation
28 | -----------------
29 | Add this in your app's **build.gradle** file:
30 | ```
31 | compile 'me.riddhimanadib.bottom-nav-bar:bottom-nav-bar:1.0.1'
32 | ```
33 |
34 |
35 | How to use
36 | -----------------
37 | 1. Create four fragments (fragment with appcompat v4) with layouts and method to create new instance.
38 |
39 | ``` 'java'
40 | public class SampleFragment extends Fragment{
41 |
42 | public static FourthFragment newInstance() {
43 | return new FourthFragment();
44 | }
45 |
46 | @Override
47 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
48 | return inflater.inflate(R.layout.fragment_sample, container, false);
49 | }
50 |
51 | }
52 | ```
53 | 2. Make your activity extend **BottomBarHolderActivity**
54 | ``` 'java'
55 | public class MainActivity extends BottomBarHolderActivity
56 | ```
57 | 3. Clear out setContentView() method and add the following:
58 | ``` 'java'
59 | @Override
60 | protected void onCreate(Bundle savedInstanceState) {
61 | super.onCreate(savedInstanceState);
62 | // remove this: setContentView(R.layout.activity_main);
63 |
64 | // four navigation pages that would be displayed as four tabs
65 | // contains title, icon and fragment instance
66 | NavigationPage page1 = new NavigationPage("Home", ContextCompat.getDrawable(this, R.drawable.ic_home_black_24dp), FirstFragment.newInstance());
67 | NavigationPage page2 = new NavigationPage("Support", ContextCompat.getDrawable(this, R.drawable.ic_mail_black_24dp), SecondFragment.newInstance());
68 | NavigationPage page3 = new NavigationPage("Billing", ContextCompat.getDrawable(this, R.drawable.ic_assessment_black_24dp), ThirdFragment.newInstance());
69 | NavigationPage page4 = new NavigationPage("Profile", ContextCompat.getDrawable(this, R.drawable.ic_person_black_24dp), FourthFragment.newInstance());
70 |
71 | // add them in a list
72 | List navigationPages = new ArrayList<>();
73 | navigationPages.add(page1);
74 | navigationPages.add(page2);
75 | navigationPages.add(page3);
76 | navigationPages.add(page4);
77 |
78 | // pass them to super method
79 | super.setupBottomBarHolderActivity(navigationPages);
80 | }
81 | ```
82 | 4. Now build and run!!
83 |
84 | Change accent color
85 | -----------------
86 | If you want to change the colors, just override the colors in your **colors.xml** file:
87 | ```'xml'
88 | #F8F8F8
89 | #9D0E15
90 | #727272
91 | ```
92 |
93 |
94 | License
95 | -----------------
96 | This Library is released under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
97 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/bottom-nav-bar/src/main/res/layout/bottom_nav_bar.xml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
19 |
20 |
28 |
29 |
34 |
35 |
41 |
42 |
49 |
50 |
51 |
52 |
60 |
61 |
67 |
68 |
74 |
75 |
82 |
83 |
84 |
85 |
93 |
94 |
100 |
101 |
107 |
108 |
115 |
116 |
117 |
118 |
126 |
127 |
133 |
134 |
140 |
141 |
148 |
149 |
150 |
151 |
152 |
153 |
--------------------------------------------------------------------------------
/bottom-nav-bar/src/main/java/me/riddhimanadib/library/BottomNavigationBar.java:
--------------------------------------------------------------------------------
1 | package me.riddhimanadib.library;
2 |
3 | import android.content.Context;
4 | import android.support.v4.content.ContextCompat;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.support.v7.widget.AppCompatImageView;
7 | import android.support.v7.widget.AppCompatTextView;
8 | import android.view.View;
9 | import android.widget.LinearLayout;
10 |
11 | import java.util.ArrayList;
12 | import java.util.List;
13 |
14 | /**
15 | * Helper class to handle bottom navigation UI and click events
16 | *
17 | * Created by Adib on 13-Apr-17.
18 | */
19 |
20 | public class BottomNavigationBar implements View.OnClickListener {
21 |
22 | public static final int MENU_BAR_1 = 0;
23 | public static final int MENU_BAR_2 = 1;
24 | public static final int MENU_BAR_3 = 2;
25 | public static final int MENU_BAR_4 = 3;
26 |
27 | private List mNavigationPageList = new ArrayList<>();
28 |
29 | private Context mContext;
30 | private AppCompatActivity mActivity;
31 | private BottomNavigationMenuClickListener mListener;
32 |
33 | private LinearLayout mLLBar1, mLLBar2, mLLBar3, mLLBar4;
34 | private View mViewBar1, mViewBar2, mViewBar3, mViewBar4;
35 | private AppCompatImageView mImageViewBar1, mImageViewBar2, mImageViewBar3, mImageViewBar4;
36 | private AppCompatTextView mTextViewBar1, mTextViewBar2, mTextViewBar3, mTextViewBar4;
37 |
38 | public BottomNavigationBar(Context mContext, List pages, BottomNavigationMenuClickListener listener) {
39 |
40 | // initialize variables
41 | this.mContext = mContext;
42 | this.mActivity = (AppCompatActivity) mContext;
43 | this.mListener = listener;
44 | this.mNavigationPageList = pages;
45 |
46 | // getting reference to bar linear layout viewgroups
47 | this.mLLBar1 = (LinearLayout) mActivity.findViewById(R.id.linearLayoutBar1);
48 | this.mLLBar2 = (LinearLayout) mActivity.findViewById(R.id.linearLayoutBar2);
49 | this.mLLBar3 = (LinearLayout) mActivity.findViewById(R.id.linearLayoutBar3);
50 | this.mLLBar4 = (LinearLayout) mActivity.findViewById(R.id.linearLayoutBar4);
51 |
52 | // getting reference to bar upper highlight
53 | this.mViewBar1 = (View) mActivity.findViewById(R.id.viewBar1);
54 | this.mViewBar2 = (View) mActivity.findViewById(R.id.viewBar2);
55 | this.mViewBar3 = (View) mActivity.findViewById(R.id.viewBar3);
56 | this.mViewBar4 = (View) mActivity.findViewById(R.id.viewBar4);
57 |
58 | // getting reference to bar icons
59 | this.mImageViewBar1 = (AppCompatImageView) mActivity.findViewById(R.id.imageViewBar1);
60 | this.mImageViewBar2 = (AppCompatImageView) mActivity.findViewById(R.id.imageViewBar2);
61 | this.mImageViewBar3 = (AppCompatImageView) mActivity.findViewById(R.id.imageViewBar3);
62 | this.mImageViewBar4 = (AppCompatImageView) mActivity.findViewById(R.id.imageViewBar4);
63 |
64 | // setting the icons
65 | this.mImageViewBar1.setImageDrawable(mNavigationPageList.get(0).getIcon());
66 | this.mImageViewBar2.setImageDrawable(mNavigationPageList.get(1).getIcon());
67 | this.mImageViewBar3.setImageDrawable(mNavigationPageList.get(2).getIcon());
68 | this.mImageViewBar4.setImageDrawable(mNavigationPageList.get(3).getIcon());
69 |
70 | // getting reference to bar titles
71 | this.mTextViewBar1 = (AppCompatTextView) mActivity.findViewById(R.id.textViewBar1);
72 | this.mTextViewBar2 = (AppCompatTextView) mActivity.findViewById(R.id.textViewBar2);
73 | this.mTextViewBar3 = (AppCompatTextView) mActivity.findViewById(R.id.textViewBar3);
74 | this.mTextViewBar4 = (AppCompatTextView) mActivity.findViewById(R.id.textViewBar4);
75 |
76 | // 2etting the titles
77 | this.mTextViewBar1.setText(mNavigationPageList.get(0).getTitle());
78 | this.mTextViewBar2.setText(mNavigationPageList.get(1).getTitle());
79 | this.mTextViewBar3.setText(mNavigationPageList.get(2).getTitle());
80 | this.mTextViewBar4.setText(mNavigationPageList.get(3).getTitle());
81 |
82 | // setting click listeners
83 | this.mLLBar1.setOnClickListener(this);
84 | this.mLLBar2.setOnClickListener(this);
85 | this.mLLBar3.setOnClickListener(this);
86 | this.mLLBar4.setOnClickListener(this);
87 | }
88 |
89 | @Override
90 | public void onClick(View view) {
91 |
92 | // setting clicked bar as highlighted view
93 | setView(view);
94 |
95 | // triggering click listeners
96 | if (view.getId() == R.id.linearLayoutBar1) {
97 | mListener.onClickedOnBottomNavigationMenu(MENU_BAR_1);
98 | return;
99 | } else if (view.getId() == R.id.linearLayoutBar2) {
100 | mListener.onClickedOnBottomNavigationMenu(MENU_BAR_2);
101 | return;
102 | } else if (view.getId() == R.id.linearLayoutBar3) {
103 | mListener.onClickedOnBottomNavigationMenu(MENU_BAR_3);
104 | return;
105 | } else if (view.getId() == R.id.linearLayoutBar4) {
106 | mListener.onClickedOnBottomNavigationMenu(MENU_BAR_4);
107 | return;
108 | } else {
109 | return;
110 | }
111 |
112 | }
113 |
114 | /**
115 | * sets the clicked view as selected, resets other views
116 | * @param view clicked view
117 | */
118 | private void setView(View view) {
119 |
120 | // seting all highlight bar as invisible
121 | this.mViewBar1.setVisibility(View.INVISIBLE);
122 | this.mViewBar2.setVisibility(View.INVISIBLE);
123 | this.mViewBar3.setVisibility(View.INVISIBLE);
124 | this.mViewBar4.setVisibility(View.INVISIBLE);
125 |
126 | // resetting colors of all icons
127 | this.mImageViewBar1.setColorFilter(ContextCompat.getColor(mContext, R.color.colorNavAccentUnselected));
128 | this.mImageViewBar2.setColorFilter(ContextCompat.getColor(mContext, R.color.colorNavAccentUnselected));
129 | this.mImageViewBar3.setColorFilter(ContextCompat.getColor(mContext, R.color.colorNavAccentUnselected));
130 | this.mImageViewBar4.setColorFilter(ContextCompat.getColor(mContext, R.color.colorNavAccentUnselected));
131 |
132 | // resetting colors of all titles
133 | this.mTextViewBar1.setTextColor(ContextCompat.getColor(mContext, R.color.colorNavAccentUnselected));
134 | this.mTextViewBar2.setTextColor(ContextCompat.getColor(mContext, R.color.colorNavAccentUnselected));
135 | this.mTextViewBar3.setTextColor(ContextCompat.getColor(mContext, R.color.colorNavAccentUnselected));
136 | this.mTextViewBar4.setTextColor(ContextCompat.getColor(mContext, R.color.colorNavAccentUnselected));
137 |
138 | // selectively colorizing the marked view
139 | if (view.getId() == R.id.linearLayoutBar1) {
140 | this.mViewBar1.setVisibility(View.VISIBLE);
141 | this.mImageViewBar1.setColorFilter(ContextCompat.getColor(mContext, R.color.colorNavAccentSelected));
142 | this.mTextViewBar1.setTextColor(ContextCompat.getColor(mContext, R.color.colorNavAccentSelected));
143 | return;
144 | } else if (view.getId() == R.id.linearLayoutBar2) {
145 | this.mViewBar2.setVisibility(View.VISIBLE);
146 | this.mImageViewBar2.setColorFilter(ContextCompat.getColor(mContext, R.color.colorNavAccentSelected));
147 | this.mTextViewBar2.setTextColor(ContextCompat.getColor(mContext, R.color.colorNavAccentSelected));
148 | return;
149 | } else if (view.getId() == R.id.linearLayoutBar3) {
150 | this.mViewBar3.setVisibility(View.VISIBLE);
151 | this.mImageViewBar3.setColorFilter(ContextCompat.getColor(mContext, R.color.colorNavAccentSelected));
152 | this.mTextViewBar3.setTextColor(ContextCompat.getColor(mContext, R.color.colorNavAccentSelected));
153 | return;
154 | } else if (view.getId() == R.id.linearLayoutBar4) {
155 | this.mViewBar4.setVisibility(View.VISIBLE);
156 | this.mImageViewBar4.setColorFilter(ContextCompat.getColor(mContext, R.color.colorNavAccentSelected));
157 | this.mTextViewBar4.setTextColor(ContextCompat.getColor(mContext, R.color.colorNavAccentSelected));
158 | return;
159 | } else {
160 | return;
161 | }
162 |
163 | }
164 |
165 | public interface BottomNavigationMenuClickListener {
166 | void onClickedOnBottomNavigationMenu(int menuType);
167 | }
168 |
169 | }
170 |
--------------------------------------------------------------------------------