From c445d9a2486d52f367b762261d18c8cd49d7f3eb Mon Sep 17 00:00:00 2001 From: Tayfun CESUR Date: Mon, 1 Jul 2019 18:29:27 +0300 Subject: [PATCH] Bottom/Top sheet stateChanged support implemented --- .../com/tayfuncesur/curvedbottomsheetdemo/WavedActivity.kt | 4 ++++ lib/build.gradle | 4 ++-- .../main/java/com/tayfuncesur/curvedbottomsheet/Callback.kt | 1 + .../com/tayfuncesur/curvedbottomsheet/CurvedBottomSheet.kt | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/tayfuncesur/curvedbottomsheetdemo/WavedActivity.kt b/app/src/main/java/com/tayfuncesur/curvedbottomsheetdemo/WavedActivity.kt index b845eea..bc73b7e 100644 --- a/app/src/main/java/com/tayfuncesur/curvedbottomsheetdemo/WavedActivity.kt +++ b/app/src/main/java/com/tayfuncesur/curvedbottomsheetdemo/WavedActivity.kt @@ -28,6 +28,10 @@ class WavedActivity : AppCompatActivity() { view = bottom_sheet, type = CurvedBottomSheet.Type.WAVE, callback = object : Callback { + override fun onStateChanged(p0: View, state: Int) { + + } + override fun onSlide(p0: View, p1: Float) { contentLayout.alpha = p1 dolphinLayout.alpha = 1 - p1 diff --git a/lib/build.gradle b/lib/build.gradle index b2151c5..bbf58ae 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -9,8 +9,8 @@ android { defaultConfig { minSdkVersion 16 targetSdkVersion 28 - versionCode 4 - versionName "1.1" + versionCode 5 + versionName "1.2" } } diff --git a/lib/src/main/java/com/tayfuncesur/curvedbottomsheet/Callback.kt b/lib/src/main/java/com/tayfuncesur/curvedbottomsheet/Callback.kt index e36d852..a05e1c4 100644 --- a/lib/src/main/java/com/tayfuncesur/curvedbottomsheet/Callback.kt +++ b/lib/src/main/java/com/tayfuncesur/curvedbottomsheet/Callback.kt @@ -4,4 +4,5 @@ import android.view.View interface Callback { fun onSlide(p0: View, p1: Float) + fun onStateChanged(p0: View, state: Int) } \ No newline at end of file diff --git a/lib/src/main/java/com/tayfuncesur/curvedbottomsheet/CurvedBottomSheet.kt b/lib/src/main/java/com/tayfuncesur/curvedbottomsheet/CurvedBottomSheet.kt index c7094c6..9f78f65 100644 --- a/lib/src/main/java/com/tayfuncesur/curvedbottomsheet/CurvedBottomSheet.kt +++ b/lib/src/main/java/com/tayfuncesur/curvedbottomsheet/CurvedBottomSheet.kt @@ -46,14 +46,14 @@ class CurvedBottomSheet( } override fun onStateChanged(p0: View, p1: Int) { - + callback?.onStateChanged(p0, p1) } }) } else { topSheetBehavior = TopSheetBehavior.from(view) topSheetBehavior.setTopSheetCallback(object : TopSheetBehavior.TopSheetCallback() { override fun onStateChanged(bottomSheet: View, newState: Int) { - + callback?.onStateChanged(bottomSheet, newState) } override fun onSlide(bottomSheet: View, slideOffset: Float, isOpening: Boolean?) {