Giter Club home page Giter Club logo

android-navigation-bar's Introduction

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

flarebar-gif

Design#2

flarebar-2

Design#3

flarebar-3

Tab Badges

screenshot_20190625-180617After Select Webp net-resizeimage

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.

android-navigation-bar's People

Contributors

vaibhav1929 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.