Git Product home page Git Product logo

meowbottomnavigation's Introduction

Meow Bottom Navigation

A simple & curved & material bottom navigation for Android written in Kotlin with ♥ .

CAUTION : if you are Java developer and have problems with Kotlin, so check this link: https://github.com/oneHamidreza/MeowBottomNavigationJava

Download

build.gradle (project path)

buildscript {
    repositories {
        jcenter()
    }
}

build.gradle (module path)

dependencies {
  implementation 'com.etebarian:meow-bottom-navigation:1.2.0'
}

Use androidx by adding this lines to gradle.properties. if you want more info, just google AndroidX.

android.useAndroidX=true
android.enableJetifier=true

If you want to add this library to a JAVA Project, you must add kotlin library to build.gradle.

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61"
}

Usage

Add Meow Bottom Navigation in xml

<com.etebarian.meowbottomnavigation.MeowBottomNavigation
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

Add menu items in code.

val bottomNavigation = findView(R.id.bottomNavigation)
bottomNavigation.add(MeowBottomNavigation.Model(1, R.drawable.ic_home))
bottomNavigation.add(MeowBottomNavigation.Model(2, R.drawable.ic_explore))
bottomNavigation.add(MeowBottomNavigation.Model(3, R.drawable.ic_message))

Remember that icons must be vector drawable. Add vectorDrawables.useSupportLibrary = true to your build.gradle inside defaultConfig{ ... }

Customization

<com.etebarian.meowbottomnavigation.MeowBottomNavigation
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:mbn_circleColor="#ffffff"
        app:mbn_backgroundBottomColor="#ffffff"
        app:mbn_countBackgroundColor="#ff6f00"
        app:mbn_countTextColor="#ffffff"
        app:mbn_countTypeface="fonts/SourceSansPro-Regular.ttf"
        app:mbn_defaultIconColor="#90a4ae"
        app:mbn_rippleColor="#2f424242"
        app:mbn_selectedIconColor="#3c415e"
        app:mbn_shadowColor="#1f212121"/>
  • You can change this properties in Kotlin/Java Realtime⌚.

Listeners

kotlin

bottomNavigation.setOnShowListener {
    // YOUR CODES
}
       
bottomNavigation.setOnClickMenuListener {
    // YOUR CODES
}

java

bottomNavigation.setOnClickMenuListener(new Function1<MeowBottomNavigation.Model, Unit>() {
            @Override
            public Unit invoke(MeowBottomNavigation.Model model) {
                // YOUR CODES
                return null;
            }
        });

bottomNavigation.setOnShowListener(new Function1<MeowBottomNavigation.Model, Unit>() {
            @Override
            public Unit invoke(MeowBottomNavigation.Model model) {
                // YOUR CODES
                return null;
            }
        });

Counter Badge

Setting One Tab

bottomNavigation.setCount(TAB_ID, STRING)

Clearing One Tab

bottomNavigation.clearCount(TAB_ID)

Clearing All Tabs

bottomNavigation.clearAllCounts(TAB_ID)

Set Default Tab

Use this function

bottomNavigation.show(TAB_ID)

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.