Skip to content

Commit 611c22e

Browse files
committed
2019-12-31
1 parent 7d4b1dc commit 611c22e

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
## 使用
2020
### 依赖
2121
```
22-
implementation 'com.shouzhong:Scanner:1.1.1'
22+
implementation 'com.shouzhong:Scanner:1.1.2-beta1'
2323
```
2424
以下选择自己需要的
2525
```

app/src/main/java/com/shouzhong/scanner/demo/ScannerActivity.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ private void startVibrator() {
145145

146146
class ViewFinder extends View implements IViewFinder {
147147
private Rect framingRect;//扫码框所占区域
148-
private float widthRatio = 0.8f;//扫码框宽度占view总宽度的比例
148+
private float widthRatio = 0.9f;//扫码框宽度占view总宽度的比例
149149
private float heightRatio = 0.8f;
150-
private float heightWidthRatio = 1f;//扫码框的高宽比
150+
private float heightWidthRatio = 0.5626f;//扫码框的高宽比
151151
private int leftOffset = -1;//扫码框相对于左边的偏移量,若为负值,则扫码框会水平居中
152152
private int topOffset = -1;//扫码框相对于顶部的偏移量,若为负值,则扫码框会竖直居中
153153

@@ -254,8 +254,8 @@ private synchronized void updateFramingRect() {
254254
Point viewSize = new Point(getWidth(), getHeight());
255255
int width = getWidth() * 801 / 1080, height = getWidth() * 811 / 1080;
256256
width = (int) (getWidth() * widthRatio);
257-
height = (int) (getHeight() * heightRatio);
258-
// height = (int) (heightWidthRatio * width);
257+
// height = (int) (getHeight() * heightRatio);
258+
height = (int) (heightWidthRatio * width);
259259

260260
int left, top;
261261
if (leftOffset < 0) {

lib/src/main/java/com/shouzhong/scanner/Utils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ static final Result decodeIdCard(byte[] bResultBuf, int resLen) throws Exception
355355
rdCount++;
356356
}
357357
if (idCard.type != Result.TYPE_ID_CARD_FRONT && idCard.type != Result.TYPE_ID_CARD_BACK) return null;
358+
idCard.data = out.toString();
358359
return idCard;
359360
}
360361
}

0 commit comments

Comments
 (0)