kutils / com.celites.kutils / androidx.fragment.app.Fragment

Extensions for androidx.fragment.app.Fragment

allowOptionsMenu

fun Fragment.allowOptionsMenu(hasOptionsMenu: Boolean = true): Unit

Calls fragment's setHasOptionMenu with true as default

getIntent

fun <T : Context> Fragment.getIntent(flags: Int = 0, bundle: Bundle? = null, data: Uri? = null): Intent?

Generates intent from Fragment

goBackToFragment

fun Fragment.goBackToFragment(name: String, flag: Int = 0): Unit

Go back to fragment whose tag matches with name

setSupportActionbar

fun Fragment.setSupportActionbar(toolbar: Toolbar): Unit

Call's Parent activity's setSupportActionBar from Fragment

startActivity

fun <T : Activity> Fragment.startActivity(flags: Int = 0, data: Uri? = null, extras: Bundle? = null): Unit

Starts Activity

startActivityForResult

fun <T : Activity> Fragment.startActivityForResult(flags: Int = 0, data: Uri? = null, extras: Bundle? = null, requestCode: Int): Unit

Calls startActivityForResult using given flags, bundles and url