Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoadingActivity问题 #52

Closed
Allen0828 opened this issue Dec 7, 2021 · 4 comments
Closed

LoadingActivity问题 #52

Allen0828 opened this issue Dec 7, 2021 · 4 comments

Comments

@Allen0828
Copy link

使用ProgressDialog 发现延迟关闭是关闭不了的. 很奇怪 在测试代码里添加了 点击空白区域不响应, 就不能关闭了. 很好奇大家在使用的时候 都是怎么关的?
LoadingActivity -> 94行

 case R.id.rtv_showLoading:
        new UIProgressDialog.NormalBuilder(this)
                 .setMessage(isShowMsg ? R.string.loading : 0)
                 .setIndeterminateDrawable(isDefaultProgress ? 0 : R.drawable.progress_loading)
                 .setBackgroundRadiusResource(isDefaultRadiusBack ? R.dimen.dp_radius_loading : 0)
                 .setCanceledOnTouchOutside(false)  // 新增
                 .create()
                 .setDimAmount(isBackDim ? 0.6f : 0f)
                .show();
      break;
@AriesHoo
Copy link
Owner

AriesHoo commented Dec 7, 2021 via email

@Allen0828
Copy link
Author

就是 我需要在展示Dialog之后 自动关闭. 比如 延迟5秒后关闭.
但是 现在 使用UIWidget组件, 用户点击空白区域 Dialog会消失. 所以我加了一句 不响应空白区域的代码.
然后 不知道应该怎么关闭了
之前尝试使用了 以下代码 但是关不掉.
刚接触安卓 实在不好意思 😓

val dialog = UIProgressDialog.NormalBuilder(this)
// init代码
// 延迟2秒后自动关闭
Timer().schedule(2000) {
                runOnUiThread {
                    dialog. create().dismiss()
                }
   }

@AriesHoo
Copy link
Owner

AriesHoo commented Dec 8, 2021 via email

@AriesHoo
Copy link
Owner

调用一次create()就会返回一个Dialog 对象。show()和dismiss()要针对同一个Dialog对象。不能show()是dialog A 然后dismiss() dialog B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants