BaseAndroidViewModel

open class BaseAndroidViewModel @Inject constructor(application: Application) : BaseViewModel

MVVMFrame 框架基于 Google 官方的 JetPack 构建,在使用 MVVMFrame 时,需遵循一些规范:

如果您继承使用了 BaseAndroidViewModel 或其子类,你需要参照如下方式添加 @HiltViewModel 和 @Inject 注解标记,来进行注入

// 示例
@HiltViewModel
class YourViewModel @Inject constructor(): BaseAndroidViewModel() {

}

Author

Jenly

Follow me

Constructors

Link copied to clipboard
@Inject
constructor(application: Application)

Properties

Link copied to clipboard

加载状态

Link copied to clipboard
val messageEvent: Flow<String>

消息事件

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

隐藏加载状态

Link copied to clipboard
fun sendMessage(@StringRes resId: Int)
fun sendMessage(message: String?)

发送消息;如果消息内容不为空,则将消息发送到页面,通过IView.showToast进行显示

Link copied to clipboard

显示加载状态