Skip to content

Commit

Permalink
Bottom and Top sheet behavior is now accessible to modify
Browse files Browse the repository at this point in the history
  • Loading branch information
TayfunCesur committed Jun 18, 2019
1 parent 994bca1 commit 12b94c7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
versionCode 2
versionName "1.0.1"
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ import android.view.View

class CurvedBottomSheet(
private val radius: Float = 180F,
private var view: View,
private var view: CurvedLayout,
private val type: Type = Type.CURVE,
private val location: Location = Location.BOTTOM,
private val shape: Shape = Shape.Concave,
private val callback: Callback? = null
) {

lateinit var bottomSheetBehavior: BottomSheetBehavior<*>
lateinit var topSheetBehavior: TopSheetBehavior<*>

enum class Type {
CURVE, WAVE
}
Expand All @@ -26,14 +29,14 @@ class CurvedBottomSheet(
Concave, Convex
}

fun init() {
(view as CurvedLayout).radius = radius.toInt()
(view as CurvedLayout).type = type
(view as CurvedLayout).shape = shape
(view as CurvedLayout).location = location
fun init() : CurvedBottomSheet{
view.radius = radius.toInt()
view.type = type
view.shape = shape
view.location = location
view.setBackgroundColor(Color.TRANSPARENT)
if (location == Location.BOTTOM) {
val bottomSheetBehavior = BottomSheetBehavior.from(view)
bottomSheetBehavior = BottomSheetBehavior.from(view)
bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
bottomSheetBehavior.setBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
override fun onSlide(p0: View, p1: Float) {
Expand All @@ -47,7 +50,7 @@ class CurvedBottomSheet(
}
})
} else {
val topSheetBehavior = TopSheetBehavior.from(view)
topSheetBehavior = TopSheetBehavior.from(view)
topSheetBehavior.setTopSheetCallback(object : TopSheetBehavior.TopSheetCallback() {
override fun onStateChanged(bottomSheet: View, newState: Int) {

Expand All @@ -61,7 +64,7 @@ class CurvedBottomSheet(
})

}

return this
}

}

0 comments on commit 12b94c7

Please sign in to comment.