PullDownLayout is a small library that allows you to implement a view that can be dragged down your layout. PullDownLayout can also be used to implement Pull-To-Dismiss feature for your activities and fragments.
dependencies {
implementation 'com.github.tizisdeepan:pulldownlayout:1.0.0'
}
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
<com.layout.pulldown.PullDownLayout
android:id="@+id/pullDown"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--Your Views-->
</com.layout.pulldown.PullDownLayout>
class FragmentClass: Fragment(), PullDownLayout.Callback {
override fun onPullStart() {
}
override fun onPull(progress: Float) {
}
override fun onPullCancel() {
}
override fun onPullComplete() {
(ctx as MainActivity).onBackPressed()
}
...
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
pullDown.setCallback(this)
}
}
Note: Check out sample project for cool pull down transitions.
And that's it! You have now successfully implemented a cool PullDownLayout for your android project!