SuperBottomSheet

by andrefrsousa

andrefrsousa / SuperBottomSheet

Android native BottomSheet on steroids 💪

461 Stars 59 Forks Last release: about 1 year ago (1.5.0) MIT License 57 Commits 9 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Super Bottom Sheet

Android native bottom sheet on steroids 💪

Build Status jitpack api Android Arsenal

Summary

This library allows you to show bottom sheets in your app with the bonus of animating the status bar color and the top rounded corners as you scroll.

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:SuperBottomSheet:1.5.0'
}

Sample Project

We have a sample project in Kotlin that demonstrates the lib usage 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 create a bottom sheet in your project you just need to extend SuperBottomSheetFragment.

Example:

class MySheetFragment : SuperBottomSheetFragment() {

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
    super.onCreateView(inflater, container, savedInstanceState)
    return inflater.inflate(R.layout.fragment_demo_sheet, container, false)
}

}

Customization

The are a group of general properties that you can define. These properties will be applied to all the SuperBottomSheet in your project.

// The amount of DIM that will be applied to the background from 0 to 1.
  

// Sheet background color

// To corner radius to be applied. 0 if you want none.

// Enable or disable the status bar animation. Default is true.

// Enable or disable the radius animation. Default is true.

// Default if false. Enalbe it if you want to skip collapse state

// Default if true

// Default if true

// Status bar color. The default uses the colorDark attribute value.

// The height of the bottom sheet when it is collapsed

If you want to change the properties of a single bottom sheet you can override these methods:

fun getPeekHeight(): Int {
    // Your code goes here
}

fun getDim(): Float { // Your code goes here }

fun getBackgroundColor(): Int { // Your code goes here }

fun getStatusBarColor(): Int { // Your code goes here }

fun getCornerRadius(): Float { // Your code goes here }

fun isSheetAlwaysExpanded(): Boolean { // Your code goes here }

fun isSheetCancelableOnTouchOutside(): Boolean { // Your code goes here }

fun isSheetCancelable(): Boolean { // Your code goes here }

fun animateCornerRadius(): Boolean { // Your code goes here }

fun animateStatusBar(): Boolean { // Your code goes here }

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.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.