android-navigation-bar
android-navigation-bar copied to clipboard
Flarebar is an android library, used to add modern navigation bar in your android application.
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:
<com.flarebit.flarebarlib.FlareBar
android:id="@+id/bottomBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"/>
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.
final FlareBar bottomBar = findViewById(R.id.bottomBar);
bottomBar.setBarBackgroundColor(Color.parseColor("#FFFFFF"));
ArrayList<Flaretab> 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:
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.
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:
public Flaretab(Drawable tabImage, String tabText, String tabColorString,String badge);
Send badge string as last argument.
Other available methods of FlareTab object are:
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:
setTabList(ArrayList<Flaretab> tabs)
ArrayList<Flaretab> 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.