Coder Social home page Coder Social logo

tayfuncesur / curvedbottomsheet Goto Github PK

View Code? Open in Web Editor NEW
425.0 7.0 37.0 18.55 MB

Curved-Waved-Animated BottomSheet ๐Ÿ˜Ž It uses Cubic Bezier Curves. This project can be a good start to drawing whatever you want!

Kotlin 100.00%
curved bottom-sheet-behavior curved-bottom-sheet bezier-curves curve-animation curve-bottom-sheet curve-sheet-behaviour kotlin custom-shape animation

curvedbottomsheet's Introduction

Curved Bottom Sheet

Curved-Waved-Animated BottomSheet ๐Ÿ˜Ž

Build Status api jitpack jitpack

Outputs

Curved-Bottom-Concave Curved-Bottom-Convex Curved-Top-Concave Curved-Top-Convex Waved

Summary

Curved Bottom Sheet, helps you to display fancy, extraordinary UX with Bottom Sheet Behavior. Even if its name contains Bottom,it also supports Top Sheet.If you bored classic BottomSheet, go on.

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: jitpack

dependencies {
    implementation "com.github.TayfunCesur:CurvedBottomSheet:$latest_version"
}

Note: This project has been migrated to AndroidX at v1.1 by the contribution of @ChintanRathod. If you haven't migrated your project to AndroidX yet, you can use v1.0.2

dependencies {
    implementation "com.github.TayfunCesur:CurvedBottomSheet:1.0.2"
}

Sample Usage

The sample app has all but if you want quick tip,

    <androidx.coordinatorlayout.widget.CoordinatorLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            xmlns:android="http://schemas.android.com/apk/res/android">

        <com.tayfuncesur.curvedbottomsheet.CurvedLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/bottom_sheet"
                app:fillColor="@color/colorAccent"
                app:behavior_hideable="false"
                app:behavior_peekHeight="200dp"
                app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
                
                //Your view here
                
     </com.tayfuncesur.curvedbottomsheet.CurvedLayout>
 </androidx.coordinatorlayout.widget.CoordinatorLayout>

In your activity or fragment,

CurvedBottomSheet(view = bottom_sheet,
shape = CurvedBottomSheet.Shape.Concave,
location = CurvedBottomSheet.Location.BOTTOM,
type = CurvedBottomSheet.Type.CURVE)
.init()

Parameters

Parameter Type Description
radius float The default value is 180F. This parameter is so important to your curves beauty. In general, you must pass this parameter as your (screen width / 6). If you curios about reason, don't forget to have look at the bottom of page.
shape Enum(Concave,Convex) The default value is Concave. This parameter helps you to decide your shape is convex or concave.
location Enum(TOP,BOTTOM) The default value is BOTTOM.If you want to use TOP, don't forget to pass app:layout_behavior="com.tayfuncesur.curvedbottomsheet.TopSheetBehavior" to your CurvedLayout.
type Enum(CURVE,WAVE) The default value is CURVE. This parameter draws a wave or curve.
callback null The default value is null. This parameter allows you notified while sheet is scrolling.Maybe you want to do some magic works while scrolling. For instance, alpha animation. (It is done in the WavedActivity)

Attributes

Property Type Description
fillColor color The default color is White. This parameter fills your Curved layout background. Don't use backgroundColor property because you don't want to fill whole layout that includes the places outside of curve or wave
showControlPoints boolean The default value is false. This parameters draws points in layout. If you work debug mode,it can help you to determine the your control points.

Clarification

Explanation of app:fillColor Explanation of app:showControlPoints

Bonus Part : Alpha Animation

This bonus part has already implemented in WavedActivity

If you pass the Callback parameter to CurvedBottomSheet, you gonna have

            object : Callback {
                override fun onSlide(p0: View, p1: Float) {
                    // Here you can play alpha with p1 value. 
                    contentLayout.alpha = p1
                    dolphinLayout.alpha = 1 - p1
                }

Useful Resources

Here is the all detailed Medium Story

Project Maintained By

Open-Source Enthusiast | Android Engineer

Greetings

If you have any questions, hit me on Twitter

Licence

Copyright 2019 Tayfun CESUR

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.

curvedbottomsheet's People

Contributors

chintanrathod avatar tayfuncesur 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  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  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  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  avatar  avatar  avatar  avatar  avatar

curvedbottomsheet's Issues

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.