Skip to content

Commit 90af191

Browse files
committed
修复一些问题
1 parent 7fc7122 commit 90af191

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

module_camera/src/main/java/com/ailiwean/core/zxing/CustomMultiFormatReader.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,22 @@ public void reset() {
154154
}
155155

156156
private Result decodeInternal(BinaryBitmap image) {
157+
Result resultFinal = null;
157158
if (readers != null) {
158159
for (Reader reader : readers) {
159160
try {
160-
return reader.decode(image, hints);
161+
Result result = reader.decode(image, hints);
162+
if (result != null)
163+
resultFinal = result;
164+
if (result != null && result.getText() != null)
165+
return resultFinal;
161166
} catch (ReaderException re) {
162167
// continue
163168
} catch (Exception ignored) {
164-
165169
}
166170
}
167171
}
168-
return null;
172+
return resultFinal;
169173
}
170174

171175

module_camera/src/main/java/com/ailiwean/core/zxing/core/PlanarYUVLuminanceSource.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.ailiwean.core.zxing.core;
1818

1919
import android.text.TextUtils;
20+
import android.util.Log;
2021

2122
import com.ailiwean.core.zxing.core.common.HybridBinarizer;
2223
import com.ailiwean.core.zxing.core.common.HybridBinarizerCrude;

module_camera/src/main/java/com/ailiwean/core/zxing/core/qrcode/QRCodeReader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public Result decode(BinaryBitmap image) throws NotFoundException, ChecksumExcep
6868

6969
@Override
7070
public final Result decode(BinaryBitmap image, Map<DecodeHintType, ?> hints)
71-
throws ChecksumException, FormatException {
71+
throws ChecksumException, FormatException, NotFoundException {
7272
DecoderResult decoderResult;
7373
ResultPoint[] points;
7474
if (hints != null && hints.containsKey(DecodeHintType.PURE_BARCODE)) {
@@ -89,10 +89,10 @@ public final Result decode(BinaryBitmap image, Map<DecodeHintType, ?> hints)
8989
try {
9090
detectorResult = new Detector2(image.getBlackMatrix()).detect(hints);
9191
} catch (NotFoundException notFoundException) {
92-
return null;
92+
throw NotFoundException.getNotFoundInstance();
9393
}
9494
} else
95-
return null;
95+
throw NotFoundException.getNotFoundInstance();
9696
}
9797
points = detectorResult.getPoints();
9898
try {

0 commit comments

Comments
 (0)