VastVmFragment

VastVmActivity.

// Because don't using the ViewBinding,so just set the layoutId to layout id.
class SampleVmFragment(override val layoutId: Int = R.layout.fragment_sample_vm) : VastVmFragment<SampleSharedVM>()
{
override fun initView(view: View, savedInstanceState: Bundle?) {
// Something to do
}
}

Parameters

VM

ViewModel of the fragment.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
protected abstract val layoutId: Int

When you are not using view binding, you should set layoutId to the corresponding view resource id of this Fragment.

Link copied to clipboard
private val mViewModel: VM

Functions

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
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.