FragmentUtils

class FragmentUtils
    author: Blankj
    blog  : http://blankj.com
    time  : 2017/01/17
    desc  : utils about fragment

Types

FragmentNode
Link copied to clipboard
open class FragmentNode
OnBackClickListener
Link copied to clipboard
interface OnBackClickListener

Functions

add
Link copied to clipboard
open fun add(@NonNull() fm: FragmentManager, @NonNull() add: Fragment, @IdRes() containerId: Int)
Add fragment.
open fun add(@NonNull() fm: FragmentManager, @NonNull() add: Fragment, @IdRes() containerId: Int, @NonNull() sharedElements: Array<View>)
Add fragment.
open fun add(@NonNull() fm: FragmentManager, @NonNull() add: Fragment, @IdRes() containerId: Int, isHide: Boolean)
Add fragment.
open fun add(@NonNull() fm: FragmentManager, @NonNull() adds: Array<Fragment>, @IdRes() containerId: Int, showIndex: Int)
Add fragment.
open fun add(@NonNull() fm: FragmentManager, @NonNull() adds: List<Fragment>, @IdRes() containerId: Int, showIndex: Int)
Add fragment.
open fun add(@NonNull() fm: FragmentManager, @NonNull() add: Fragment, @IdRes() containerId: Int, isAddStack: Boolean, @NonNull() sharedElements: Array<View>)
Add fragment.
open fun add(@NonNull() fm: FragmentManager, @NonNull() add: Fragment, @IdRes() containerId: Int, isHide: Boolean, isAddStack: Boolean)
Add fragment.
open fun add(@NonNull() fm: FragmentManager, @NonNull() add: Fragment, @IdRes() containerId: Int, @AnimRes() enterAnim: Int, @AnimRes() exitAnim: Int)
Add fragment.
open fun add(@NonNull() fm: FragmentManager, @NonNull() add: Fragment, @IdRes() containerId: Int, isAddStack: Boolean, @AnimRes() enterAnim: Int, @AnimRes() exitAnim: Int)
Add fragment.
open fun add(@NonNull() fm: FragmentManager, @NonNull() add: Fragment, @IdRes() containerId: Int, @AnimRes() enterAnim: Int, @AnimRes() exitAnim: Int, @AnimRes() popEnterAnim: Int, @AnimRes() popExitAnim: Int)
Add fragment.
open fun add(@NonNull() fm: FragmentManager, @NonNull() add: Fragment, @IdRes() containerId: Int, isAddStack: Boolean, @AnimRes() enterAnim: Int, @AnimRes() exitAnim: Int, @AnimRes() popEnterAnim: Int, @AnimRes() popExitAnim: Int)
Add fragment.
dispatchBackPress
Link copied to clipboard
open fun dispatchBackPress(@NonNull() fragment: Fragment): Boolean
Dispatch the back press for fragment.
open fun dispatchBackPress(@NonNull() fm: FragmentManager): Boolean
Dispatch the back press for fragment.
findFragment
Link copied to clipboard
open fun findFragment(@NonNull() fm: FragmentManager, findClz: Class<out Fragment>): Fragment
Find fragment by class.
getAllFragments
Link copied to clipboard
open fun getAllFragments(@NonNull() fm: FragmentManager): List<FragmentUtils.FragmentNode>
Return all fragments in manager.
getAllFragmentsInStack
Link copied to clipboard
open fun getAllFragmentsInStack(@NonNull() fm: FragmentManager): List<FragmentUtils.FragmentNode>
Return all fragments in stack in manager.
getFragments
Link copied to clipboard
open fun getFragments(@NonNull() fm: FragmentManager): List<Fragment>
Return the fragments in manager.
getFragmentsInStack
Link copied to clipboard
open fun getFragmentsInStack(@NonNull() fm: FragmentManager): List<Fragment>
Return the fragments in stack in manager.
getSimpleName
Link copied to clipboard
open fun getSimpleName(fragment: Fragment): String
Return the simple name of fragment.
getTop
Link copied to clipboard
open fun getTop(@NonNull() fm: FragmentManager): Fragment
Return the top fragment.
getTopInStack
Link copied to clipboard
open fun getTopInStack(@NonNull() fm: FragmentManager): Fragment
Return the top fragment in stack.
getTopShow
Link copied to clipboard
open fun getTopShow(@NonNull() fm: FragmentManager): Fragment
Return the top fragment which is shown.
getTopShowInStack
Link copied to clipboard
open fun getTopShowInStack(@NonNull() fm: FragmentManager): Fragment
Return the top fragment which is shown in stack.
hide
Link copied to clipboard
open fun hide(@NonNull() hide: Fragment)
Hide fragment.
open fun hide(@NonNull() fm: FragmentManager)
Hide fragment.
pop
Link copied to clipboard
open fun pop(@NonNull() fm: FragmentManager)
Pop fragment.
open fun pop(@NonNull() fm: FragmentManager, isImmediate: Boolean)
Pop fragment.
popAll
Link copied to clipboard
open fun popAll(@NonNull() fm: FragmentManager)
Pop all fragments.
open fun popAll(@NonNull() fm: FragmentManager, isImmediate: Boolean)
Pop all fragments.
popTo
Link copied to clipboard
open fun popTo(@NonNull() fm: FragmentManager, popClz: Class<out Fragment>, isIncludeSelf: Boolean)
Pop to fragment.
open fun popTo(@NonNull() fm: FragmentManager, popClz: Class<out Fragment>, isIncludeSelf: Boolean, isImmediate: Boolean)
Pop to fragment.
remove
Link copied to clipboard
open fun remove(@NonNull() remove: Fragment)
Remove fragment.
removeAll
Link copied to clipboard
open fun removeAll(@NonNull() fm: FragmentManager)
Remove all fragments.
removeTo
Link copied to clipboard
open fun removeTo(@NonNull() removeTo: Fragment, isIncludeSelf: Boolean)
Remove to fragment.
replace
Link copied to clipboard
open fun replace(@NonNull() srcFragment: Fragment, @NonNull() destFragment: Fragment)
Replace fragment.
open fun replace(@NonNull() srcFragment: Fragment, @NonNull() destFragment: Fragment, sharedElements: Array<View>)
Replace fragment.
open fun replace(@NonNull() srcFragment: Fragment, @NonNull() destFragment: Fragment, isAddStack: Boolean)
Replace fragment.
open fun replace(@NonNull() fm: FragmentManager, @NonNull() fragment: Fragment, @IdRes() containerId: Int)
Replace fragment.
open fun replace(@NonNull() srcFragment: Fragment, @NonNull() destFragment: Fragment, isAddStack: Boolean, sharedElements: Array<View>)
Replace fragment.
open fun replace(@NonNull() srcFragment: Fragment, @NonNull() destFragment: Fragment, @AnimRes() enterAnim: Int, @AnimRes() exitAnim: Int)
Replace fragment.
open fun replace(@NonNull() fm: FragmentManager, @NonNull() fragment: Fragment, @IdRes() containerId: Int, sharedElements: Array<View>)
Replace fragment.
open fun replace(@NonNull() fm: FragmentManager, @NonNull() fragment: Fragment, @IdRes() containerId: Int, isAddStack: Boolean)
Replace fragment.
open fun replace(@NonNull() srcFragment: Fragment, @NonNull() destFragment: Fragment, isAddStack: Boolean, @AnimRes() enterAnim: Int, @AnimRes() exitAnim: Int)
Replace fragment.
open fun replace(@NonNull() fm: FragmentManager, @NonNull() fragment: Fragment, @IdRes() containerId: Int, isAddStack: Boolean, sharedElements: Array<View>)
Replace fragment.
open fun replace(@NonNull() fm: FragmentManager, @NonNull() fragment: Fragment, @IdRes() containerId: Int, @AnimRes() enterAnim: Int, @AnimRes() exitAnim: Int)
Replace fragment.
open fun replace(@NonNull() srcFragment: Fragment, @NonNull() destFragment: Fragment, @AnimRes() enterAnim: Int, @AnimRes() exitAnim: Int, @AnimRes() popEnterAnim: Int, @AnimRes() popExitAnim: Int)
Replace fragment.
open fun replace(@NonNull() fm: FragmentManager, @NonNull() fragment: Fragment, @IdRes() containerId: Int, isAddStack: Boolean, @AnimRes() enterAnim: Int, @AnimRes() exitAnim: Int)
Replace fragment.
open fun replace(@NonNull() srcFragment: Fragment, @NonNull() destFragment: Fragment, isAddStack: Boolean, @AnimRes() enterAnim: Int, @AnimRes() exitAnim: Int, @AnimRes() popEnterAnim: Int, @AnimRes() popExitAnim: Int)
Replace fragment.
open fun replace(@NonNull() fm: FragmentManager, @NonNull() fragment: Fragment, @IdRes() containerId: Int, @AnimRes() enterAnim: Int, @AnimRes() exitAnim: Int, @AnimRes() popEnterAnim: Int, @AnimRes() popExitAnim: Int)
Replace fragment.
open fun replace(@NonNull() fm: FragmentManager, @NonNull() fragment: Fragment, @IdRes() containerId: Int, isAddStack: Boolean, @AnimRes() enterAnim: Int, @AnimRes() exitAnim: Int, @AnimRes() popEnterAnim: Int, @AnimRes() popExitAnim: Int)
Replace fragment.
setBackground
Link copied to clipboard
open fun setBackground(@NonNull() fragment: Fragment, background: Drawable)
Set background color for fragment.
setBackgroundColor
Link copied to clipboard
open fun setBackgroundColor(@NonNull() fragment: Fragment, @ColorInt() color: Int)
Set background color for fragment.
setBackgroundResource
Link copied to clipboard
open fun setBackgroundResource(@NonNull() fragment: Fragment, @DrawableRes() resId: Int)
Set background resource for fragment.
show
Link copied to clipboard
open fun show(@NonNull() show: Fragment)
Show fragment.
open fun show(@NonNull() fm: FragmentManager)
Show fragment.
showHide
Link copied to clipboard
open fun showHide(@NonNull() show: Fragment, @NonNull() hide: Array<Fragment>)
Show fragment then hide other fragment.
open fun showHide(@NonNull() show: Fragment, @NonNull() hide: Fragment)
Show fragment then hide other fragment.
open fun showHide(@NonNull() show: Fragment, @NonNull() hide: List<Fragment>)
Show fragment then hide other fragment.
open fun showHide(showIndex: Int, @NonNull() fragments: Array<Fragment>)
Show fragment then hide other fragment.
open fun showHide(showIndex: Int, @NonNull() fragments: List<Fragment>)
Show fragment then hide other fragment.