Skip to content

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.

Notifications You must be signed in to change notification settings

tizisdeepan/pulldownlayout

Repository files navigation

PullDownLayout

License

Screenshot 2

What is Pull Down Layout?

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.

Implementation

[1] In your app module gradle file

dependencies {
    implementation 'com.github.tizisdeepan:pulldownlayout:1.0.0'
}

[2] In your project level gradle file

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

[3] Use PullBackLayout in your layout.xml

<com.layout.pulldown.PullDownLayout
        android:id="@+id/pullDown"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
  <!--Your Views-->
</com.layout.pulldown.PullDownLayout>

[4] Set Callback for PullBackLayout in your Activity or Fragment

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!

About

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.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published