Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/andrefrsousa/SuperBottomSheet

Android native BottomSheet on steroids πŸ’ͺ
https://github.com/andrefrsousa/SuperBottomSheet

android android-app android-application android-development android-library android-ui bottomsheet bottomsheet-dialogs-library bottomsheetdialog bottomsheetdialogfragment bottomsheetview kotlin kotlin-android kotlin-language kotlin-library

Last synced: 3 months ago
JSON representation

Android native BottomSheet on steroids πŸ’ͺ

Lists

README

        


Super Bottom Sheet


Android native bottom sheet on steroids πŸ’ͺ



Build Status
jitpack
api



### Summary

This library allows you to display the bottom sheets in your application with the bonus of **animating the color of the status bar** and the **upper rounded corners** while scrolling.


## Download

This library is available in **jitpack**, so to use it you need to add the above statement to your root *build.gradle*:

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

Add the dependency:

```groovy
dependencies {
implementation 'com.github.andrefrsousa:SuperBottomSheet:2.0.0'
}
```

## Sample Project

We have a sample project in Kotlin that demonstrates the use of the library [here](https://github.com/andrefrsousa/SuperBottomSheet/blob/master/demo/src/main/java/com/andrefrsousa/superbottomsheet/demo/MainActivity.kt).

![](/raw/example.gif)

## Use

It is recommended that you review the sample project to get a full understanding of all the features offered by the library.
To create a bottom sheet in your project, you only need to extend *SuperBottomSheetFragment*.

Example:

```kotlin
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)
}
}
```

## Adjustments

This is a group of general properties that you can define. These properties are applied to the entire *SuperBottomSheet* in your project.

```xml
// The set of DIM applied to the background from 0 to 1.

// Background color of the sheet.

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

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

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

// Enable this option if you want to skip the collapse state. Default value is false.

// Default is true.

// Default is true.

// Color of the status bar. The default uses the attribute value colorDark.

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

// The height of the bottom sheet when it is expanded. Default value is match_parent (-1).


```

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

```kotlin
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
}

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

```

## License

```
Copyright (c) 2018 AndrΓ© Sousa

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.
```