Index
net / com.drake.net.utils / androidx.fragment.app.Fragment
Extensions for androidx.fragment.app.Fragment¶
Name | Summary |
---|---|
getSavedModel | 返回当前组件指定的SavedViewModelfun <M : ViewModel> Fragment.getSavedModel(): M |
scopeDialog | fun Fragment.scopeDialog(dialog: Dialog ? = null, cancelable: Boolean = true, dispatcher: CoroutineDispatcher = Dispatchers.Main, block: suspend CoroutineScope.() -> Unit ): NetCoroutineScope |
scopeLife | fun Fragment.scopeLife(lifeEvent: Event = Lifecycle.Event.ON_STOP, dispatcher: CoroutineDispatcher = Dispatchers.Main, block: suspend CoroutineScope.() -> Unit ): AndroidScope |
scopeNetLife | Fragment应当在Lifecycle.Event.ON_STOP时就取消作用域, 避免Fragment.onDestroyView导致引用空视图fun Fragment.scopeNetLife(lifeEvent: Event = Lifecycle.Event.ON_STOP, dispatcher: CoroutineDispatcher = Dispatchers.Main, block: suspend CoroutineScope.() -> Unit ): NetCoroutineScope |