Skip to content

Commit

Permalink
Merge pull request #7 from lianshangyangguang/master
Browse files Browse the repository at this point in the history
扫描页文字可定制
  • Loading branch information
jwkj authored Jun 22, 2018
2 parents 00ae0f1 + 71aef3c commit 42ab11f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
15 changes: 15 additions & 0 deletions libzxing/src/main/java/com/jwsd/libzxing/QRCodeManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public class QRCodeManager extends IQRCodeStrategy {
*/
private int requestType = 0;

private int textType = 0;


private QRCodeManager() {
}

Expand Down Expand Up @@ -75,6 +78,17 @@ public QRCodeManager setReqeustType(int reqeustType) {
return this;
}

/**
* 设置文本类型
*
* @param textType
* @return
*/
public QRCodeManager setTextType(int textType) {
this.textType = textType;
return this;
}

/**
* <p>扫描二维码.</p>
* 带回调的,一般表示结果由本管理器来处理onActivityResult方法,结果通过callback拿到。
Expand Down Expand Up @@ -110,6 +124,7 @@ void scanning(int requestCode) {
this.curRequestCode = requestCode;
Intent intent = new Intent(context, CaptureActivity.class);
intent.putExtra("type", requestType);
intent.putExtra("textType", textType);
context.startActivityForResult(intent, curRequestCode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ public class CaptureActivity extends Activity implements
private RelativeLayout scanContainer;
private RelativeLayout scanCropView;
private ImageView scanLine;
private TextView capture_mask_bottom;

private Rect mCropRect = null;
private boolean isHasSurface = false;
private ImageView ivBack, ivMullt;
private int captureType = 0;
private int textType = 0;
private TextView tvAlbum;
private static final int CODE_GALLERY_REQUEST = 101;

Expand All @@ -98,6 +100,7 @@ public void onCreate(Bundle icicle) {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_capture);
captureType = getIntent().getIntExtra("type", 0);
textType = getIntent().getIntExtra("textType", 0);
String string = getApplication().getResources().getString(R.string.jwstr_scan_it);
// Log.e("hdltag", "onCreate(CaptureActivity.java:102):" +string);
scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
Expand All @@ -107,6 +110,10 @@ public void onCreate(Bundle icicle) {
ivBack = (ImageView) findViewById(R.id.iv_back);
ivMullt = (ImageView) findViewById(R.id.iv_mudle);
tvAlbum = (TextView) findViewById(R.id.tv_capture_select_album_jwsd);
capture_mask_bottom = (TextView) findViewById(R.id.capture_mask_bottom);
if (textType != 0){
capture_mask_bottom.setText(getString(R.string.jwstr_scan_device));
}
ivBack.setTag(123);
ivMullt.setTag(124);
tvAlbum.setTag(125);
Expand Down
1 change: 1 addition & 0 deletions libzxing/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
<string name="jwstr_pic_no_qrcode">图中无二维码或二维码难以识别</string>
<string name="jwstr_prompt">提示</string>
<string name="jwstr_confirm">确定</string>
<string name="jwstr_scan_device">请扫描机身上的二维码</string>
</resources>
1 change: 1 addition & 0 deletions libzxing/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
<string name="jwstr_pic_no_qrcode">图中无二维码或二维码难以识别</string>
<string name="jwstr_camera_error">相机异常</string>
<string name="jwstr_confirm">Confirm</string>
<string name="jwstr_scan_device">Please scan the QR code on the device body.</string>
</resources>

0 comments on commit 42ab11f

Please sign in to comment.