Easy manage commit Fragment and Activity with some little extra

Easy manage commit Fragment and Activity, with some little extra.

Import

At the moment the library is in my personal maven repo

repositories {
    maven {
        url 'http://dl.bintray.com/raphaelbussa/maven'
    }
}
dependencies {
    implementation 'com.raphaelbussa:navutils:4.0.0.alpha6'
}

How to use

Activity

The library provide several methods to commit a new activity, in Fragment and Activity you can use extentions

pushActivity(ResultActivity::class) {
    //remove all activity from current stack 
    clearStack(true)
    //add arguments 
    arguments(Bundle.EMPTY)
    //add standard animation
    animationType(NavUtils.Anim.HORIZONTAL_RIGHT)
    //add custom animation
    customAnimation(R.anim.popup_enter, R.anim.popup_exit)
    //add scene transition
    sceneTransition(view)     
}.commit()

For commit an Activty with result

.commit(requestCode = 9000)

Fragment

The library provide several methods to commit a new fragment, in Fragment and Activity you can use extentions

pushFragment(ResultFragment::class, R.id.container) {
    //add standard animation
    animationType(animationType)
    //remove start animation
    noEnterAnimations(true)
    //remove exit animation
    noExitAnimations(true)
    //add arguments 
    arguments(Bundle.EMPTY)
    //add custom animation
    customAnimation(R.anim.popup_enter, R.anim.popup_exit, R.anim.popup_enter, R.anim.popup_exit)
    //add fragment to backstack
    addToBackStack()
    //set custom tag
    tag("custom tag")
}.replace()

If you want to add

.add()

GitHub