Skip to content

showModal ​

显示模态对话框,并返回确认、取消及输入内容。

方法声明 ​

java
void showModal(SUDOPCommonStateHandle handle, SUDOPShowModalParams params);

这是 SUDOPWrappedClient 的宿主回调,通过 registerWrappedClient 注册实现。宿主执行实际操作后,通过 SDK 传入的 handle 返回结果;一次请求只返回一次成功或失败。涉及视图和窗口的操作应在 Android 主线程执行。

SUDOPShowModalParams ​

字段类型说明
titleString标题
contentString正文
showCancelboolean是否显示取消按钮
cancelTextString取消文字,最多 4 个字符
cancelColorString取消文字颜色,十六进制颜色字符串
confirmTextString确认文字,最多 4 个字符
confirmColorString确认文字颜色,十六进制颜色字符串
editableboolean是否显示输入框
placeholderTextString输入框提示

返回结果 ​

成功后调用 handle.success(dataJson);失败时调用 handle.failure(retCode, retMsg),其中 retCode 为非 0 错误码。

json
{"confirm":true,"cancel":false,"content":"text"}

confirm 和 cancel 表示点击的按钮;取消按钮属于正常结果,不等于操作失败。content 返回输入内容。

句柄类型:global.sud.op.runtime.client.SUDOPCommonStateHandle。

参数类型位于 global.sud.op.runtime.core.model。