VastVbVmFragment

abstract class VastVbVmFragment<VB : ViewBinding, VM : ViewModel> : VastFragment

VastVbVmFragment.

// Use in kotlin
class SampleVbVmFragment : VastVbVmFragment<FragmentSampleVbVmBinding, SampleSharedVM>() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
// Something to do
}
}

Parameters

VB

ViewBinding of the fragment layout.

VM

ViewModel of the fragment.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
private var mBinding: VB?
Link copied to clipboard
private val mViewModel: VM

Functions

Link copied to clipboard
protected open override fun clearBinding()

Clear the ViewBinding. By default, it will throw a IllegalStateException.

Link copied to clipboard
protected open override fun getBinding(): VB

Get the ViewBinding. By default, it will throw a IllegalStateException.

Link copied to clipboard
protected open override fun getViewModel(): VM

Get the ViewModel. By default, it will throw a IllegalStateException.

Link copied to clipboard
open override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View
Link copied to clipboard
open override fun onDestroyView()
Link copied to clipboard
protected open override fun setVmBySelf(): Boolean

When setVmBySelf is true, it means that ViewModelStoreOwner is Fragment itself. When you want ViewModelStoreOwner to be the androidx.fragment.app.FragmentActivity this fragment is currently associated with, set setVmBySelf to false.