Skip to content

Commit 3a8ee0f

Browse files
committed
修复onstop会被阻塞的问题
1 parent e04069f commit 3a8ee0f

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

czxing/src/main/java/me/devilsen/czxing/view/ScanBoxView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ private void moveScanLine() {
357357
@Override
358358
public void onAnimationUpdate(ValueAnimator animation) {
359359
mScanLinePosition = (float) animation.getAnimatedValue();
360-
// postInvalidate();
361-
postInvalidate(mBoxLeft,
360+
// 这里如果用postInvalidate会导致所在Activity的onStop和onDestroy方法阻塞,感谢lhhseraph的反馈
361+
postInvalidateOnAnimation(mBoxLeft,
362362
((int) (mBoxTop + mScanLinePosition - 10)),
363363
mBoxLeft + mBoxSize,
364364
((int) (mBoxTop + mScanLinePosition + SCAN_LINE_HEIGHT + 10)));

sample/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ android {
4747

4848
dependencies {
4949

50-
// implementation project(':czxing')
51-
implementation 'me.devilsen:CZXing:0.8.9'
50+
implementation project(':czxing')
51+
// implementation 'me.devilsen:CZXing:0.8.9'
5252

5353
implementation rootProject.ext.appcompat
5454
testImplementation rootProject.ext.junit

0 commit comments

Comments
 (0)