Skip to content

Commit

Permalink
扩大识别范围,解决扫码后生成的图片不是正确的方向问题
Browse files Browse the repository at this point in the history
  • Loading branch information
maning committed Nov 13, 2017
1 parent 36ec7bb commit 4a842b8
Show file tree
Hide file tree
Showing 7 changed files with 317 additions and 258 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.0.0'
compile 'com.github.maning0303:MNZXingCode:V1.1.0'
// compile project(':libraryzxing')
// compile 'com.github.maning0303:MNZXingCode:V1.1.0'
compile project(':libraryzxing')
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
Expand All @@ -32,6 +33,8 @@
import android.provider.MediaStore;
import android.text.TextUtils;
import android.util.Log;
import android.view.OrientationEventListener;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
Expand Down Expand Up @@ -95,6 +98,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
private LinearLayout btn_close;
private LinearLayout btn_photo;
private RelativeLayout btn_dialog_bg;
private ImageView ivScreenshot;
//闪光灯是否打开
private boolean is_light_on = false;
private boolean beepFlag = true;
Expand Down Expand Up @@ -125,6 +129,7 @@ public void onCreate(Bundle icicle) {
btn_close = (LinearLayout) findViewById(R.id.btn_close);
btn_photo = (LinearLayout) findViewById(R.id.btn_photo);
btn_dialog_bg = (RelativeLayout) findViewById(R.id.btn_dialog_bg);
ivScreenshot = (ImageView) findViewById(R.id.ivScreenshot);
btn_dialog_bg.setVisibility(View.GONE);

//初始化相关参数
Expand Down Expand Up @@ -213,7 +218,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//去相册选择图片
if (requestCode == 1000) {
if (data == null){
if (data == null) {
//隐藏Dialog
btn_dialog_bg.setVisibility(View.GONE);
return;
Expand Down Expand Up @@ -324,6 +329,9 @@ public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {
beepManager.playBeepSoundAndVibrate();
//关闭页面
finishSuccess(lastResult.getText());
//图片显示:测试才显示
ivScreenshot.setImageBitmap(barcode);

}

private void finishFailed(String errorMsg) {
Expand Down
Loading

0 comments on commit 4a842b8

Please sign in to comment.