DialogCoroutineScope

class DialogCoroutineScope(activity: FragmentActivity, dialog: Dialog?, cancelable: Boolean, dispatcher: CoroutineDispatcher) : NetCoroutineScope, LifecycleObserver

自动加载对话框网络请求

开始: 显示对话框 错误: 提示错误信息, 关闭对话框 完全: 关闭对话框

Parameters

activity

对话框跟随生命周期的FragmentActivity

dialog

不使用默认的加载对话框而指定对话框

cancelable

是否允许用户取消对话框

Constructors

DialogCoroutineScope
Link copied to clipboard
fun DialogCoroutineScope(activity: FragmentActivity, dialog: Dialog? = null, cancelable: Boolean = true, dispatcher: CoroutineDispatcher = Dispatchers.Main)
对话框跟随生命周期的FragmentActivity

Functions

cancel
Link copied to clipboard
open override fun cancel(cause: CancellationException?)
open fun cancel(message: String, cause: Throwable? = null)
catch
Link copied to clipboard
open fun catch(block: AndroidScope.(Throwable) -> Unit = {}): AndroidScope
当作用域内发生异常时回调
close
Link copied to clipboard
open override fun close()
dismiss
Link copied to clipboard
fun dismiss()
finally
Link copied to clipboard
open fun finally(block: AndroidScope.(Throwable?) -> Unit = {}): AndroidScope
无论正常或者异常结束都将最终执行
handleError
Link copied to clipboard
open override fun handleError(e: Throwable)
错误处理
launch
Link copied to clipboard
open override fun launch(block: suspend CoroutineScope.() -> Unit): NetCoroutineScope
preview
Link copied to clipboard
fun preview(ignore: Boolean = false, animate: Boolean = false, block: suspend CoroutineScope.() -> Unit): AndroidScope
"预览"作用域 该函数一般用于缓存读取, 只在第一次启动作用域时回调 该函数在作用域NetCoroutineScope.launch之前执行 函数内部所有的异常都不会被抛出, 也不会终止作用域执行

Properties

activity
Link copied to clipboard
val activity: FragmentActivity
对话框跟随生命周期的FragmentActivity
animate
Link copied to clipboard
var animate: Boolean = false
cancelable
Link copied to clipboard
val cancelable: Boolean = true
是否允许用户取消对话框
coroutineContext
Link copied to clipboard
open override val coroutineContext: CoroutineContext
dialog
Link copied to clipboard
var dialog: Dialog? = null
不使用默认的加载对话框而指定对话框
dispatcher
Link copied to clipboard
val dispatcher: CoroutineDispatcher
scopeGroup
Link copied to clipboard
val scopeGroup: CoroutineExceptionHandler