Blankj / Blankj/AndroidUtilCode
ClickUtils防抖出现点击按键无反应问题?
- Dominant language
- Java
- Stars
- 33.6k
- Forks
- 10.6k
- PR merge metrics
- No merged PRs in 30d
Description
## 描述 Bug
使用了ClickUtils.applyGlobalDebouncing API,偶现点击按钮无反应。
断点进去查看,进入onClick方法mEnabled变量为false,大概就明白原因了。因为没有把mEnabled置为true导致。
框架采用了postDelayed去设置mEnabled为true,但是有可能被removeCallbacks导致恢复为true失败。
- AndroidUtilCode 的版本:1.30.5
- 出现 Bug 的设备型号:未知型号
- 设备的 Android 版本:Android 9.0
## 相关代码
```java
@Override
public final void onClick(View v) {
if (mIsGlobal) {
if (mEnabled) {
mEnabled = false;
v.postDelayed(ENABLE_AGAIN, mDuration);
onDebouncingClick(v);
}
} else {
if (isValid(v, mDuration)) {
onDebouncingClick(v);
}
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.