Skip to content
Android native Toolbar on steroids 💪
Kotlin
Branch: master
Clone or download

Latest commit

André Sousa
Latest commit 4ec0b5b Oct 14, 2019

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
demo
docs
gradle/wrapper
lib [REFACTOR] Format code Oct 14, 2019
raw
.gitignore
.travis.yml
LICENSE
README.md
build.gradle
facelift.json [REFACTOR] Migrate to AndroidX Oct 14, 2019
gradle.properties [REFACTOR] Migrate to AndroidX Oct 14, 2019
gradlew
gradlew.bat
settings.gradle Initial commit Oct 23, 2018

README.md

Super Toolbar

Android native toolbar on steroids 💪

Build Status jitpack api Android Arsenal

Summary

  • Animate the toolbar elevation when scrolling
  • Center horizontal the toolbar title
  • Use light title font

Also, it has been written 100% in Kotlin. ❤️

Download

This library is available in jitpack, so you need to add this repository to your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Add the dependency:

dependencies {
    implementation 'com.github.andrefrsousa:SuperToolbar:1.2.0'
}

Sample Project

We have a sample project in Kotlin that demonstrates the lib usages here.

Usage

It is recommended to check the sample project to get a complete understanding of all the features offered by the library.
In order to show the toolbar elevation you just need to call:

fun setElevationVisibility(show: Boolean)

If what to have the same effect found in Google Messages app for example, you to add a scroll listener to your RecyclerView or ScrollView. Like this:

myRecyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
    override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
        super.onScrolled(recyclerView, dx, dy)
        toolbar.setElevationVisibility(recyclerView.canScrollVertically(-1))
    }
})

Customization

You can costumize your toolber using the following attributes:

// The duration of the elevation animation. By default is 250 miliseconds.
<attr name="superToolbar_animationDuration" format="integer"/>

// If you want to show the toolbar elevation when created. By default is false.
<attr name="superToolbar_showElevationAtStart" format="boolean"/>

// Center the toolbar title. By default is false.
<attr name="superToolbar_centerTitle" format="boolean"/>

// Use a light font as the toolbar title. Default is false.
<attr name="superToolbar_useLightFont" format="boolean"/>

Project Maintained By

André Sousa

Design-focused Engineer | Front-end Developer | Open-Source Enthusiast | Android | Husband | Foodie

License

The MIT License (MIT)  
  
Copyright (c) 2018 André Sousa  
  
Permission is hereby granted, free of charge, to any person obtaining a copy  
of this software and associated documentation files (the "Software"), to deal  
in the Software without restriction, including without limitation the rights  
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
copies of the Software, and to permit persons to whom the Software is  
furnished to do so, subject to the following conditions:  
  
The above copyright notice and this permission notice shall be included in all  
copies or substantial portions of the Software.  
  
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE  
SOFTWARE.
You can’t perform that action at this time.