# android-navigation-bar
**Repository Path**: fzyme_admin/android-navigation-bar
## Basic Information
- **Project Name**: android-navigation-bar
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-05-27
- **Last Updated**: 2021-05-27
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# android-navigation-bar: Flarebar
Flarebar is fully customizable navigation bar, followed modern material design guidelines. it is newly designed bottom bar (can also use as top navigation bar).
## Demo with different designs
### Design#1

### Design#2

### Design#3

### Tab Badges
After Select

## Installation
Add it in your root build.gradle at the end of repositories:
```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```
Then add the dependency:
```
dependencies {
implementation 'com.github.vaibhav1929:android-navigation-bar:1.0'
}
```
## Documentation
### STEP 1: Add following code in XML file:
```xml
```
You can set gravity to BOTTOM or TOP as per your requirement.
### STEP 2: Add following code to your java file:
Create object of FlareTab class for each tab. create arraylist of your all flaretab objects. and call setTabList(ArrayList) method of Flarebar object.
```java
final FlareBar bottomBar = findViewById(R.id.bottomBar);
bottomBar.setBarBackgroundColor(Color.parseColor("#FFFFFF"));
ArrayList tabs = new ArrayList<>();
tabs.add(new Flaretab(getResources().getDrawable(R.drawable.inboxb),"Inbox","#FFECB3"));
tabs.add(new Flaretab(getResources().getDrawable(R.drawable.searchb),"Search","#80DEEA"));
tabs.add(new Flaretab(getResources().getDrawable(R.drawable.phoneb),"Call Log","#B39DDB"));
tabs.add(new Flaretab(getResources().getDrawable(R.drawable.avatarb),"Profile","#EF9A9A"));
tabs.add(new Flaretab(getResources().getDrawable(R.drawable.settingsb),"Settings","#B2DFDB"));
bottomBar.setTabList(tabs);
bottomBar.attachTabs(MainActivity.this);
```
### STEP 3: Attach Listener to get notified when tab is changed:
```java
bottomBar.setTabChangedListener(new TabEventObject.TabChangedListener() {
@Override
public void onTabChanged(LinearLayout selectedTab, int selectedIndex, int oldIndex) {
//tabIndex starts from 0 (zero). Example : 4 tabs = last Index - 3
Toast.makeText(MainActivity.this,"Tab "+ selectedIndex+" Selected.",Toast.LENGTH_SHORT).show();
}
});
```
Available constructor of FlareTab Object.
```java
public Flaretab(Drawable tabImage, String tabText, String tabColorString);
```
This constructor accepts three arguments:
(1)TabImage: represents drawable file to be displayed as icon of tab.
(2)tabText : represents string value shown as text on tab.
(3)tabColorString : represents color HEX code string, this color is displayed when tab is selected.
To set the badge on the tab use following constructor:
```java
public Flaretab(Drawable tabImage, String tabText, String tabColorString,String badge);
```
Send badge string as last argument.
Other available methods of FlareTab object are:
```java
Drawable getTabImage()
void setTabImage(Drawable tabImage)
String getTabText()
void setTabText(String tabText)
String getTabColorString()
void setTabColorString(String tabColorString)
String getBadge()
void setBadge(String badge)
boolean isBadgeGiven()
```
available methods of Flarebar object are:
```java
setTabList(ArrayList tabs)
ArrayList getTabList()
setSelectedIndex(int selectedIndex) // to set the inital selected tab. using tabIndex.
getSelectedIndex()
attachTabs(Context ctx)
removeBadge(int tabIndex) // Used to remove the badge from tab. send tabIndex as argument.
void selectTab(int index) // Used to select tab of specified index programmatically.
void setTabChangedListener(TabEventObject.TabChangedListener tabChangedListener) // To attach listener
void setBarBackgroundColor(int color)
int getBarBackgroundColor()
void hideBar()
void showBar()
boolean isBarVisible()
```
Note: for more details, checkout the sample project.
This is initial release of Flarebar, future updates will make it more efficient.and also feel free to contribute.