karthyks / BottomBarNavigation

Android material design specific Bottom Navigation Bar library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BottomBarNavigation

Android design pattern based BottomBarNavigation

Android specific bottom bar navigation should be based on some specification, which is described in Google's site (mentioned below)
https://www.google.com/design/spec/components/bottom-navigation.html

Objective

To create a library for android projects, to easily implement the bottom bar navigation

Current Version:

  • Can add upto 3 buttons in the bottom bar
  • Can change colors of the bottom bar and bottom bar button texts

Future versions:

  • Add a class to create a button drawable, requires only a drawable_icon and color of the normal and pressed state
  • Configure to add more than 3 buttons in the bottom bar
  • Make the integration of the library much simpler and generic

Gradle

  
    compile 'com.github.karthyks:bottombarnavigation:0.1'
  

or

Integration:

Import as a module into your android project.

Add dependency in your gradle

build.gradle :
  
  compile project(':bottomBarNavigation')
  
check in settings.gradle :
  
  include ':yourprojectname', ':bottomBarNavigation'
  
Add BottomBar in your preferred layout :
```xml ```
In your activity class :
  
    bottomBarView = (BottomBarView) view.findViewById(R.id.bottom_bar);
    bottomBarView.setBgColor(Color.GRAY);
  
create a layout xml and add buttons in it

include_bottom_bar_buttons.xml

```xml
<com.github.karthyks.bottombarnavigation.views.BottomBarButton
    android:id="@+id/btn_2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

<com.github.karthyks.bottombarnavigation.views.BottomBarButton
    android:id="@+id/btn_3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>
```
Then add the buttons to your bottomBarView in your activity :
  
    bottomBarView.addAsChild(R.layout.include_bottom_bar_buttons);
  
Finally build your custom buttons
  
  private void buildBottomBarButtons() {
    btn1.setButtonDrawables(int DrawableNormal, int DrawablePressed)
        .setButtonText("BUTTON_TEXT")
        .setTextColors(int colorNormal, int colorPressed)
        .setBgColor(Color.GRAY)
        .build();
    btn2.setButtonDrawables(int DrawableNormal, int DrawablePressed)
        .setButtonText("BUTTON_TEXT")
        .setTextColors(int colorNormal, int colorPressed)
        .setBgColor(Color.GRAY)
        .build();
    btn3.setButtonDrawables(int DrawableNormal, int DrawablePressed)
        .setButtonText("BUTTON_TEXT")
        .setTextColors(int colorNormal, int colorPressed)
        .setBgColor(Color.GRAY)
        .build();
    btn1.setOnClickListener(this);
    btn2.setOnClickListener(this);
    btn3.setOnClickListener(this);
  }
  



*** Note ***

Changes are appreciated

Feel free to fork your changes in the library.Since this is my first library project, I am sure there will be a lot of suggestions from Geekies.

About

Android material design specific Bottom Navigation Bar library


Languages

Language:Java 100.0%