From 7562541202056446945028026f1cbc64bb2407db Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期二, 25 六月 2024 14:49:07 +0800
Subject: [PATCH] 2024年06月25日14:48:56

---
 third-zxing/src/main/java/com/zxing/qrcode/CaptureActivity.java |   50 ++++++++++++++++----------------------------------
 1 files changed, 16 insertions(+), 34 deletions(-)

diff --git a/third-zxing/src/main/java/com/zxing/qrcode/CaptureActivity.java b/third-zxing/src/main/java/com/zxing/qrcode/CaptureActivity.java
index 51ddfa1..acd1ce9 100644
--- a/third-zxing/src/main/java/com/zxing/qrcode/CaptureActivity.java
+++ b/third-zxing/src/main/java/com/zxing/qrcode/CaptureActivity.java
@@ -1,6 +1,7 @@
 package com.zxing.qrcode;///*
 
 import android.app.Activity;
+import android.content.Context;
 import android.content.Intent;
 import android.database.Cursor;
 import android.graphics.Rect;
@@ -19,11 +20,9 @@
 import android.view.animation.Animation;
 import android.view.animation.TranslateAnimation;
 import android.widget.ImageView;
-import android.widget.LinearLayout;
 import android.widget.RelativeLayout;
+import android.widget.TextView;
 import android.widget.Toast;
-
-import androidx.appcompat.content.res.AppCompatResources;
 
 import com.google.zxing.BinaryBitmap;
 import com.google.zxing.ChecksumException;
@@ -60,10 +59,10 @@
     private SurfaceView scanPreview = null;
     private RelativeLayout scanContainer;
     private RelativeLayout scanCropView;
-    private LinearLayout backll;
-    private ImageView light_iv;
+    private TextView tvCancel;
     private Rect mCropRect = null;
     private boolean isHasSurface = false;
+
 
     @Override
     public Handler getHandler() {
@@ -93,18 +92,15 @@
         View mContentView = LayoutInflater.from(this).inflate(getRootLayoutId(), null);
         setContentView(mContentView);
         afterViewBind(mContentView, savedInstanceState);
-
-
     }
 
     public void afterViewBind(View rootView, Bundle savedInstanceState) {
-
-        light_iv = findViewById(R.id.light_iv);
-        backll = findViewById(R.id.top_back_ll);
-        backll.setOnClickListener(new View.OnClickListener() {
+        tvCancel = findViewById(R.id.tv_text_cancel);
+        tvCancel.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 finish();
+//                enterGallery();
             }
         });
         scanPreview = findViewById(R.id.capture_preview);
@@ -121,30 +117,15 @@
         animation.setRepeatCount(-1);
         animation.setRepeatMode(Animation.RESTART);
         scanLine.startAnimation(animation);
-        light_iv.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                v.setSelected(!v.isSelected());
-                if (v.isSelected()) {
-//                    cameraManager.open();
-                    light_iv.setImageDrawable(AppCompatResources.getDrawable(CaptureActivity.this, R.drawable.fast_scan_light_open));
-                } else {
-//                    cameraManager.close();
-                    light_iv.setImageDrawable(AppCompatResources.getDrawable(CaptureActivity.this, R.drawable.fast_scan_light_close));
-                }
-
-            }
-        });
-
     }
 
     public void enterGallery() {
         // 杩涘叆鍥惧簱
-        Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
-        intent.addCategory(Intent.CATEGORY_OPENABLE);
-        intent.setType("image/*");
-        intent.putExtra("return-data", true);
-        startActivityForResult(intent, REQUEST_CODE);
+        Intent pickIntent = new Intent(Intent.ACTION_PICK,
+                MediaStore.Images.Media.EXTERNAL_CONTENT_URI);//鍚姩绯荤粺鐩稿唽
+        pickIntent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
+        startActivityForResult(pickIntent, REQUEST_CODE);
+
     }
 
     @Override
@@ -319,6 +300,9 @@
             intent.putExtra("data", result);
             setResult(RESULT_OK, intent);
             finish();
+
+
+
         }
     }
 
@@ -341,7 +325,7 @@
                 if (!TextUtils.isEmpty(path)) {
                     handleQRCodeFormPhoto(path);
                 } else {
-                    Toast.makeText(this, "鍥剧墖宸叉崯鍧忥紝璇烽噸鏂伴�夋嫨锛�", Toast.LENGTH_SHORT).show();
+//                    Toast.makeText(this, R.string.pic_error, Toast.LENGTH_SHORT).show();
                 }
             }
         }
@@ -393,6 +377,4 @@
             }
         });
     }
-
-
 }
\ No newline at end of file

--
Gitblit v1.8.0