Giter Club home page Giter Club logo

awesomenavigation's Introduction

AwesomeNavigation Download API

AwesomeNavigation is a collection of navigation components(styles) that can be used as bottom navigations as well as top navigation(Tab bar). Not all components in this are suitable for tab bar. As of now there is only two components, but more components will be added soon and option to choose the type you wanted to use will be added soon Each navigation component is referred as a style(style1, style2 etc). Which style to be used can be selected via the navStyle attribute in layout xml. Its takes values like style1, style2 etc.

style1

gif of AwesomeNavigation style1

style2

gif of AwesomeNavigation style2

Adding to project

Gradle

Add below code to your root build.gradle file (if you have multiple modules and only one of them require AwesomeNavigation, add the jcenter() repository only in that module's build.gradle).

allprojects {
    repositories {
        jcenter()
    }
}

And add the following dependency code to your module's build.gradle file.

dependencies {
    implementation "ss.anoop:awesome-navigation:${latest-version}"
}

AwesomeNavigation can be included in your layout xml like any other view. Below is a simple example

Usage

<ss.anoop.awesomenavigation.AwesomeNavigation
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_alignParentBottom="true"
        android:background="#fff"
        app:navItems="@menu/bottom_navigation_items"
        app:textSize="14sp"
        app:iconSize="24dp"
        app:textColor="#000"
        app:spacing="4dp"
        app:itemChangeDuration="500"
        app:navStyle="style1"/>

Customization

Table below describes the properties available to customize the AwesomeNavigation. Some options are applicable to only certain styles

Property Name Format Description Styles applicable
navItems reference It refers to a menu xml which contains list of items to be added in the navigation. Currently it reads title, icon, selectedIcon and id from a single item in the menu. selectedIcon may not be used by all navigation components. all styles
textColor color defines the color of the text shown on each navigation item all styles
textSize dimension defines the size of the text shown on each navigation item. As any other text size mention it in sp all styles
iconSize dimension defines the size of icon in every navigation item all styles
spacing dimension defines the space between text and icon all styles
itemChangeDuration integer defines the duration of animation all styles
selectedColor color defines the color of selected tab background style 2
cornerRadius dimension defines corner radius of selection background style 2

Change Listener

AwesomeNavigation offers an OnNavigationSelectedListener that informs when selected tab is changed or same item is re-selected. The callback has two parameters, id and position.

bottomNavigation.setOnNavigationSelectedListener(object : OnNavigationSelectedListener {
            override fun onSelectNavigation(id: Int, position: Int) {
                changeContent(id, position)
            }

            override fun onReselectNavigation(id: Int, position: Int) {
                scrollToTop()
            }
        })

Find this library useful? ❤️

Support it by joining stargazers for this repository. ⭐

License

Copyright 2020 anoop44 (Anoop)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

awesomenavigation's People

Contributors

anoop44 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

saytoonz

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.