Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Latest commit

 

History

History
49 lines (43 loc) · 1.44 KB

README.md

File metadata and controls

49 lines (43 loc) · 1.44 KB

DialogPro

Dialog contains multiple fragments which can be explored by swiping.

Example

Implementation

Add this depedency in your app level gradle file :

dependencies {
    ...
    implementation 'com.stevelukis.dialogpro:Dialog-Pro:1.0.0'
    ...
}

Flag

There are two flags available.

  • FLAG_KEEP This is the default flag. The fragments will be kept in memory after being swiped through. Suitable if you only have a few fragments.
  • FLAG_DESTROY_IMMEDIATELY The fragments will be removed from memory after being swiped through. Suitable if you have a lot of fragments.

Usage

Kotlin

DialogPro()
        .setFlag(DialogPro.FLAG_KEEP) // setting the flag
        .setFragments(fragments) // passing an array of Fragment
        .setOnPageSelectedListener(object : OnPageSelectedListener {
             override fun onPageSelected(pagePosition: Int) {
                   // logic
             }
        }) // implementing the listener
        .show(this) //showing the dialog

Java

new DialogPro()
        .setFlag(DialogPro.FLAG_KEEP) // setting the flag
        .setFragments(fragments) // passing an array of Fragment
        .setOnPageSelectedListener(new OnPageSelectedListener() {
             override fun onPageSelected(int pagePosition) {
                   // logic
             }
        }) // implementing the listener
        .show(this); //showing the dialog