Repository navigation
Conversation
- CustomToastView 使用独立 HandlerThread 串行展示,避免连续 toast 互相覆盖 - 支持文字大小/颜色、背景色、圆角、显示时长、边距等配置 - 新增 layout_custom_toast.xml 布局
原来在 showFull() 里直接 toastHandler.postDelayed(dismiss, duration), 而 wm.addView 通过 mainHandler.post 异步排到主线程。主线程排队与加窗口的 几十到几百毫秒被算进 duration,500ms 这类短时长实际可见时间明显偏短。 把 postDelayed 移进 mainHandler.post、放在 addView 之后,计时从真正上屏 开始;pending dismiss 仍在 toastHandler 上,dismissAll() 可正常取消。 顺带删掉重复调用一次的 toastViews.add(view)(原本导致 list 只增不减、 第 11 个 toast 就误触发 dismissAll 清掉队列)。
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| ErrorProne | 2 high |
🟢 Metrics 41 complexity · 0 duplication
Metric Results Complexity 41 Duplication 0
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
toastX,提供toastX.init(config)设置默认样式、toastX.show(msg[, config])显示提示。override: true可清空队列并立即显示最新一条。