vector / com.haroldadmin.vector / VectorFragment

VectorFragment

abstract class VectorFragment :Fragment

A Fragment which has a convenient fragmentScope property to easily launch coroutines in it.

Constructors

Name Summary
<init> VectorFragment()
A Fragment which has a convenient fragmentScope property to easily launch coroutines in it.

Properties

Name Summary
fragmentScope open val ~~fragmentScope~~: CoroutineScope
A CoroutineScope associated with the lifecycle of this fragment. The scope is cancelled when onDestroy of this Fragment has been called.
logger open val logger:Logger
viewScope open val ~~viewScope~~: CoroutineScope
A CoroutineScope associated with the view-lifecycle of this fragment. The scope is cancelled when onDestroyView of this Fragment has been called, and created when onCreateView is called.

Functions

Name Summary
renderState fun <S :VectorState> renderState(state:S, renderer: (S) ->Unit):Unit
Renders the UI based on the given state parameter using the renderer block. If your fragment is tied to a VectorViewModel then consider using the overloaded version of the method which takes in a viewModel as an input parameter.fun <S :VectorState> renderState(viewModel:VectorViewModel<S>, renderer: suspend CoroutineScope.(S) ->Unit):Unit
Renders the UI based on emitted state updates from the given viewModel using the renderer block.

Extension Functions

Name Summary
activityViewModel fun <VM :VectorViewModel<S>, S :VectorState>Fragment.activityViewModel(stateStoreContext:CoroutineContext= Dispatchers.Default + Job()):vectorLazy<VM>
Lazy delegate for creating an activity scoped VectorViewModel from a Fragment. Creates and returns the requested VectorViewModel automatically using reflection. The returned ViewModel is scoped to this Fragment's parent activity.fun <VM :VectorViewModel<S>, S :VectorState>Fragment.activityViewModel(viewModelCreator: (initialState:S, handle:SavedStateHandle) ->VM):vectorLazy<VM>
Lazy delegate for creating a parent activity scoped VectorViewModel from a Fragment using the given producer lambda
activityViewModelOwner funFragment.activityViewModelOwner():ActivityViewModelOwner
Creates a ViewModelOwner from the parent activity of this Fragment
fragmentViewModel fun <VM :VectorViewModel<S>, S :VectorState>Fragment.fragmentViewModel(stateStoreContext:CoroutineContext= Dispatchers.Default + Job()):vectorLazy<VM>
Lazy delegate for creating a VectorViewModel from a Fragmentfun <VM :VectorViewModel<S>, S :VectorState>Fragment.fragmentViewModel(viewModelCreator: (initialState:S, handle:SavedStateHandle) ->VM):vectorLazy<VM>
Lazy delegate for creating a VectorViewModel from a Fragment using the given producer lambda
fragmentViewModelOwner funFragment.fragmentViewModelOwner():FragmentViewModelOwner
Creates a ViewModelOwner from this Fragment