All Projects → arthur3486 → bottomsheets

arthur3486 / bottomsheets

Licence: Apache-2.0 license
Material Bottom Sheets library for Android

Programming Languages

java
68154 projects - #9 most used programming language
kotlin
9241 projects

Projects that are alternatives of or similar to bottomsheets

Chips Input Layout
A customizable Android ViewGroup for displaying Chips (specified in the Material Design Guide).
Stars: ✭ 591 (+677.63%)
Mutual labels:  view, viewgroup
Fillingbutton
🔥Replace typical onLongClickListener with this library!
Stars: ✭ 31 (-59.21%)
Mutual labels:  view, android-ui
Discretescrollview
A scrollable list of items that centers the current element and provides easy-to-use APIs for cool item animations.
Stars: ✭ 5,533 (+7180.26%)
Mutual labels:  view, android-ui
Freepager
ViewPagers library for Android
Stars: ✭ 461 (+506.58%)
Mutual labels:  view, android-ui
Textwriter
Animate your texts like never before
Stars: ✭ 140 (+84.21%)
Mutual labels:  view, android-ui
Happybubble
💭BubbleLayout随意变化的气泡布局、消息对话框,可定制颜色,背景、弧度、尖角弧度、边框等等。BubbleDialog气泡弹窗根据点击View的位置定位它的弹窗位置,BubbleDialog可定制方向等!(BubbleLayout changes freely,BubbleDialog click on the location of View positioning its location,BubbleDialog can be customized directions.)
Stars: ✭ 487 (+540.79%)
Mutual labels:  view, android-ui
Dachshund Tab Layout
Extended Android Tab Layout with animated indicators that have continuous feedback.
Stars: ✭ 853 (+1022.37%)
Mutual labels:  view, android-ui
bubble-layout
An Android ViewGroup that displays avatar bubbles... similar to the chat bubbles on Facebook Messenger.
Stars: ✭ 46 (-39.47%)
Mutual labels:  view, viewgroup
Pincodeview
Pretty PinCode view
Stars: ✭ 138 (+81.58%)
Mutual labels:  view, android-ui
Calendarview
Calendar View Library
Stars: ✭ 71 (-6.58%)
Mutual labels:  view, viewgroup
Slidemenulayout
🔥An android slide menu that supports left and right swipes and slides with parallax.(一个支持左右滑动并带有视差滑动效果的安卓侧滑菜单控件.仿[QQ/探探侧滑])
Stars: ✭ 235 (+209.21%)
Mutual labels:  view, viewgroup
Customfloatingactionbutton
This view is for replacement of standard Floating Action Button from Google Support Library. It is easy to use, customizable and you can also add text to button
Stars: ✭ 222 (+192.11%)
Mutual labels:  view, android-ui
Slidingrootnav
DrawerLayout-like ViewGroup, where a "drawer" is hidden under the content view, which can be shifted to make the drawer visible.
Stars: ✭ 2,939 (+3767.11%)
Mutual labels:  view, android-ui
Nestedtouchscrollinglayout
🎱处理子 View,父 View 嵌套滚动,成本比 support v4 NestedScrolling 低,放心食用~
Stars: ✭ 557 (+632.89%)
Mutual labels:  view, viewgroup
recycler-adapter
RecyclerView-driven declarative UIs
Stars: ✭ 124 (+63.16%)
Mutual labels:  view, android-ui
Adaptablebottomnavigation
A simpler way for implementing the Bottom Navigation View on Android
Stars: ✭ 844 (+1010.53%)
Mutual labels:  view, android-ui
FlowlayoutTags
具有标签功能的流式布局,接口简单。可多选单选,可记住选择状态,状态切换有过渡动画。
Stars: ✭ 78 (+2.63%)
Mutual labels:  view, viewgroup
SignatureView
【Android View】:好用的Android电子签名板,能保存所签名的图片
Stars: ✭ 89 (+17.11%)
Mutual labels:  view, android-ui
Lovelydialog
This library is a set of simple wrapper classes that are aimed to help you easily create fancy material dialogs.
Stars: ✭ 1,043 (+1272.37%)
Mutual labels:  view, android-ui
Filltextview
一个填空题控件
Stars: ✭ 149 (+96.05%)
Mutual labels:  view, android-ui

BottomSheets

Android library designed to enrich your application with the beautiful stutter-free Material Design Bottom Sheets

BottomSheets will help you make your application more appealing to your end users with its sleek stutter-free implementation of the Material Bottom Sheets.

Download License Platform Android Arsenal

Contents

Demo

  • Demo Video
  • Screenshots

Getting Started

  1. Make sure that you've added the jcenter() repository to your top-level build.gradle file.
buildscript {
    //...
    repositories {
        //...
        jcenter()
    }
    //...
}
  1. Add the library dependency to your module-level build.gradle file.

Latest version: Download

ext {
    //...
    bottomSheetsLibraryVersion = "1.0.0"
}

dependencies {
    //...
    implementation "com.arthurivanets.bottomsheet:bottomsheets-core:1.0.0"
}
  1. Enable the jetifier and androidX support in the top-level gradle.properties file.
//...
android.enableJetifier=true
android.useAndroidX=true
//....
  1. Update your compileSdkVersion in the module-level build.gradle file to 28+.
//...
android {
    //...
    compileSdkVersion 28
    //...
}
//...
  1. Update your com.android.support.appcompat.* dependency to the new androidx.appcompat.* alternative.
//...
dependencies {
    //...
    implementation "androidx.appcompat:appcompat:1.0.2"
    //...
}
//...
  1. Proceed with the implementation.

See: Structure, Basic Custom Implementation

Structure

The library is comprised of 3 modules, namely:

The first module - bottomsheets-core - is a base module the other modules depend on, it is the starting point for all of your custom bottom sheet implementations and is a required module. This module provides you with the base classes required for the bottom sheet implementation, such as the BaseBottomSheet.java which should be extended by your custom implementations of the bottom sheet and BottomSheet.java contract which exposes its supported public APIs, here you will also find the Config.java class which will help you customize the bottom sheet.

The second module - bottomsheets-sheets - is an optional module which includes the implementations of the most common bottom sheet types. Here you will find the ActionPickerBottomSheet.java, CustomActionPickerBottomSheet.java, as well as the coresponding configuration class - Config.java. This module depends on the bottomsheets-core and the Adapster library.

The third and last module - bottomsheets-ktx - is a collection of the extensions and general utils. Here you'll be able to find the BottomSheetsExtensions.kt which will simplify the creation of the common bottom sheet types in your Activities and Fragments. This module depends on the bottomsheets-core, bottomsheets-sheets and the Adapster library.

Basic Custom Implementation

IMPORTANT: In order to prevent the visual inconsistencies which might be caused by certain UI elements of the Application Theme, it is recommended that you specify the Application/Activity Theme without the Action Bar (any variant of the Theme.NoActionBar will suffice). You might also want to make your Status Bar translucent for more immersive experience.

In order to implement a basic custom bottom sheet you need to follow three simple steps:

  1. Create a new class and extend it from the BaseBottomSheet.java.
  2. Provide the custom content view for your bottom sheet in the onCreateSheetContentView(...).
  3. Use the created bottom sheet in your Activity/Fragment.

So, let's create a custom bottom sheet class - SimpleCustomBottomSheet and provide our own content view:

Kotlin (click to expand)

class SimpleCustomBottomSheet(
    hostActivity : Activity,
    config : BaseConfig = Config.Builder(hostActivity).build()
) : BaseBottomSheet(hostActivity, config) {

    override fun onCreateSheetContentView(context : Context) : View {
        return LayoutInflater.from(context).inflate(
            R.layout.view_simple_custom_bottom_sheet,
            this,
            false
        )
    }

}


Java (click to expand)

public class SimpleCustomBottomSheet extends BaseBottomSheet {

    public SimpleCustomBottomSheet(@NonNull Activity hostActivity) {
        this(hostActivity, new Config.Builder(hostActivity).build());
    }

    public SimpleCustomBottomSheet(@NonNull Activity hostActivity, @NonNull BaseConfig config) {
        super(hostActivity, config);
    }

    @NonNull
    @Override
    public final View onCreateSheetContentView(@NonNull Context context) {
        return LayoutInflater.from(context).inflate(
            R.layout.view_simple_custom_bottom_sheet,
            this,
            false
        );
    }

}


And now let's use the created SimpleCustomBottomSheet in our Activity:

Kotlin (click to expand)

class MainActivity : AppCompatActivity() {

    private var bottomSheet : BaseBottomSheet? = null

    private fun showCustomBottomSheet() {
        //...
        bottomSheet = SimpleCustomBottomSheet(this).also(BottomSheet::show)
    }

}


Java (click to expand)

public class MainActivity extends AppCompatActivity {

    private BottomSheet bottomSheet;

    private void showCustomBottomSheet() {
        //...
        bottomSheet = new SimpleCustomBottomSheet(this);
        bottomSheet.show();
    }

}


Action Picker Implementation

The implementation of the Action Picker Bottom Sheet becomes a trivial task with ActionPickerBottomSheet.java, as all you need to do here is simply provide a list of options and a bottom sheet configuration.

Let's use the ActionPickerBottomSheet.java in our Activity:

Kotlin (click to expand)

class MainActivity : AppCompatActivity() {

    private var bottomSheet : BottomSheet? = null

    private fun showActionsBottomSheet() {
        bottomSheet = showActionPickerBottomSheet(
            options = getActionOptions(),
            onItemSelectedListener = OnItemSelectedListener {
                // do something...
            }
        )
    }
	
    fun getActionOptions() : List<Option> {
        // your options
    }

}


Java (click to expand)

public class MainActivity extends AppCompatActivity {

    private BottomSheet bottomSheet;

    private void showActionsBottomSheet() {
        bottomSheet = BottomSheetsUtils.showActionPickerBottomSheet(
            this,
            getActionOptions(),
            new OnItemSelectedListener<Option>() {
                @Override
                public void onItemSelected(@NonNull Option item) {
                    // do something
                }    
            }
        );
    }

    private List<Option> getActionOptions() {
        // your options
    } 

}


Kotlin (click to expand)

class MainActivity : AppCompatActivity() {

    private var bottomSheet : BottomSheet? = null

    private fun showActionsBottomSheet() {
        bottomSheet = ActionPickerBottomSheet.init(
            this,
            getActionOptions().map(::ActionItem),
            Config.Builder(this).build()
        )
        bottomSheet.setOnItemSelectedListener { 
            // do something...
        }
        bottomSheet.show()
    }

    fun getActionOptions() : List<Option> {
        // your options
    }

}


Java (click to expand)

public class MainActivity extends AppCompatActivity {

    private BottomSheet bottomSheet;

    private void showActionsBottomSheet() {
        bottomSheet = ActionPickerBottomSheet.init(
            this,
            getActionOptions(),
            new Config.Builder(this).build()
        );
        bottomSheet.setOnItemSelectedListener(new OnItemSelectedListener<ActionItem>() {
            @Override
            public void onItemSelected(@NonNull ActionItem item) {
                // do something
            }
        });
        bottomSheet.show();
    }

    private List<ActionItem> getActionOptions() {
        // your options wrapped into ActionItem(-s)
    }

}


Custom Action Picker Implementation

The implementation of the Custom Action Picker Bottom Sheet is not that much different from the Action Picker Implemenetation, you just need to use the CustomActionPickerBottomSheet.java instead of the ActionPickerBottomSheet.java in conjunction with your custom BaseActionItem-based Items and that's it.

See the example of a Custom Action Picker in Action.

Advanced Use

See the Sample app.

Contribution

See the CONTRIBUTING.md file.

Hall of Fame

Reminder
Owly

Using BottomSheets in your app and want it to get listed here? Email me at [email protected]!

License

BottomSheets library is licensed under the Apache 2.0 License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].