From c9c5dc252530a4d4b79decf3c7abde377a534ce3 Mon Sep 17 00:00:00 2001
From: zuoxiao <470321431@qq.com>
Date: 星期五, 01 十二月 2023 13:41:51 +0800
Subject: [PATCH] 身份证识别相关资源和代码

---
 app/libs/armeabi-v7a/libimageengine.so                            |    0 
 app/src/main/java/com/dayu/recharge/view/ViewfinderView.java      |  283 ++++++++++++++
 app/src/main/res/mipmap-xhdpi/people_face.png                     |    0 
 app/src/main/res/mipmap-xhdpi/emblem.png                          |    0 
 app/src/main/res/mipmap-xhdpi/flash_off_s.png                     |    0 
 app/src/main/res/values/colors.xml                                |   15 
 gradlew.bat                                                       |   14 
 app/libs/arm64-v8a/libimageengine.so                              |    0 
 app/src/main/res/mipmap-xhdpi/cancel_s.png                        |    0 
 app/libs/ccidcard_20211231.jar                                    |    0 
 app/build.gradle                                                  |    2 
 app/src/main/res/values/dimens.xml                                |   29 +
 gradlew                                                           |  275 ++++++++-----
 app/libs/armeabi/libIDCardengine.so                               |    0 
 app/src/main/res/layout/activity_new_card.xml                     |    2 
 app/src/main/res/mipmap-xhdpi/flash_on_s.png                      |    0 
 app/src/main/java/com/dayu/recharge/activity/NewCardActivity.java |   17 
 app/src/main/java/com/dayu/recharge/activity/CameraActivity.java  |  426 ++++++++++++++++++++++
 app/libs/arm64-v8a/libIDCardengine.so                             |    0 
 app/src/main/AndroidManifest.xml                                  |    4 
 app/libs/armeabi-v7a/libIDCardengine.so                           |    0 
 app/src/main/res/layout/camera.xml                                |   50 ++
 app/libs/armeabi/libimageengine.so                                |    0 
 /dev/null                                                         |    0 
 app/libs/ccimg_20170424.jar                                       |    0 
 local.properties                                                  |    4 
 app/assets/license.info                                           |    1 
 27 files changed, 992 insertions(+), 130 deletions(-)

diff --git a/app/assets/license.info b/app/assets/license.info
new file mode 100644
index 0000000..35fe92c
--- /dev/null
+++ b/app/assets/license.info
@@ -0,0 +1 @@
+qudaohao
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 4918915..7817996 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -67,4 +67,6 @@
         exclude group: 'androidx.appcompat';
         exclude group: 'androidx.annotation';
     }
+    implementation files('libs/ccidcard_20211231.jar')
+    implementation files('libs/ccimg_20170424.jar')
 }
\ No newline at end of file
diff --git a/app/libs/arm64-v8a/libIDCardengine.so b/app/libs/arm64-v8a/libIDCardengine.so
new file mode 100644
index 0000000..7139f54
--- /dev/null
+++ b/app/libs/arm64-v8a/libIDCardengine.so
Binary files differ
diff --git a/app/libs/arm64-v8a/libimageengine.so b/app/libs/arm64-v8a/libimageengine.so
new file mode 100644
index 0000000..3f8a3fd
--- /dev/null
+++ b/app/libs/arm64-v8a/libimageengine.so
Binary files differ
diff --git a/app/libs/armeabi-v7a/libIDCardengine.so b/app/libs/armeabi-v7a/libIDCardengine.so
new file mode 100644
index 0000000..f0a171c
--- /dev/null
+++ b/app/libs/armeabi-v7a/libIDCardengine.so
Binary files differ
diff --git a/app/libs/armeabi-v7a/libimageengine.so b/app/libs/armeabi-v7a/libimageengine.so
new file mode 100644
index 0000000..935f94b
--- /dev/null
+++ b/app/libs/armeabi-v7a/libimageengine.so
Binary files differ
diff --git a/app/libs/armeabi/libIDCardengine.so b/app/libs/armeabi/libIDCardengine.so
new file mode 100644
index 0000000..c716cd2
--- /dev/null
+++ b/app/libs/armeabi/libIDCardengine.so
Binary files differ
diff --git a/app/libs/armeabi/libimageengine.so b/app/libs/armeabi/libimageengine.so
new file mode 100644
index 0000000..5e3a5f0
--- /dev/null
+++ b/app/libs/armeabi/libimageengine.so
Binary files differ
diff --git a/app/libs/ccidcard_20211231.jar b/app/libs/ccidcard_20211231.jar
new file mode 100644
index 0000000..d2cef39
--- /dev/null
+++ b/app/libs/ccidcard_20211231.jar
Binary files differ
diff --git a/app/libs/ccimg_20170424.jar b/app/libs/ccimg_20170424.jar
new file mode 100644
index 0000000..5000e25
--- /dev/null
+++ b/app/libs/ccimg_20170424.jar
Binary files differ
diff --git a/app/libs/oaid_sdk_1.0.25.aar b/app/libs/oaid_sdk_1.0.25.aar
deleted file mode 100644
index 47ca06d..0000000
--- a/app/libs/oaid_sdk_1.0.25.aar
+++ /dev/null
Binary files differ
diff --git a/app/libs/ocr-library.aar b/app/libs/ocr-library.aar
deleted file mode 100644
index 43f4663..0000000
--- a/app/libs/ocr-library.aar
+++ /dev/null
Binary files differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 39721f4..3b5c3b1 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -32,7 +32,8 @@
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
     <!--鐢ㄤ簬鐢宠璋冪敤A-GPS妯″潡-->
     <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"></uses-permission>
-
+    <uses-permission android:name="android.permission.CAMERA" />
+    <uses-feature android:name="android.hardware.camera" />
     <application
         android:name=".MyApplication"
         android:allowBackup="true"
@@ -116,6 +117,7 @@
         <activity android:name=".activity.IdentifyingActivity" />
         <activity android:name=".activity.ReplacementActivity" />
         <activity android:name=".activity.RechargeDetail" />
+        <activity android:name=".activity.CameraActivity"/>
 
 
         <meta-data
diff --git a/app/src/main/java/com/dayu/recharge/activity/CameraActivity.java b/app/src/main/java/com/dayu/recharge/activity/CameraActivity.java
new file mode 100644
index 0000000..8ac11bb
--- /dev/null
+++ b/app/src/main/java/com/dayu/recharge/activity/CameraActivity.java
@@ -0,0 +1,426 @@
+package com.dayu.recharge.activity;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Rect;
+import android.hardware.Camera;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+import android.view.Display;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.dayu.recharge.R;
+import com.dayu.recharge.view.ViewfinderView;
+import com.yunmai.cc.idcard.controler.CameraManager;
+import com.yunmai.cc.idcard.controler.OcrConstant;
+import com.yunmai.cc.idcard.controler.OcrManager;
+import com.yunmai.cc.idcard.vo.IdCardInfoNew;
+
+/**
+ * 瑙嗛璇嗗埆绫�
+ * 
+ * @author fangcm 2013-03-18
+ * 
+ */
+
+public class CameraActivity extends BaseActivity implements SurfaceHolder.Callback {
+
+	private final String TAG = "cc_idcard";
+
+	private TextView tvTips;
+	private SurfaceView sv_preview;
+	private SurfaceHolder surfaceHolder;
+	private CameraManager cameraManager;
+	private boolean autoFoucs = true;
+	private ViewfinderView finderView;
+	private OcrManager ocrManager;
+	private Rect rect;
+	private boolean cameraError = false;
+	// private boolean over = false;
+
+	private Button btnFlash, btnCancel;
+	private ImageView imgTips;
+	private ImageView iv, ivHead;
+	private int typeFront = 1;// 0涓嶅尯鍒� 锛�1姝i潰锛�2鑳岄潰
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState) {
+		// TODO Auto-generated method stub
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.camera);
+
+		typeFront = this.getIntent().getIntExtra("typeFront", 0);
+		initView();
+		cameraManager = new CameraManager(getBaseContext(), mHandler);
+		mCameraOpenThread.start();
+		try {
+			mCameraOpenThread.join();
+			mCameraOpenThread = null;
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			cameraError = true;
+		}
+		if (cameraError) {
+			Toast.makeText(getBaseContext(), "鐓х浉鏈烘湭鍚姩锛�", Toast.LENGTH_SHORT).show();
+			finish();
+			return;
+		}
+		setParameters();
+
+	}
+
+	private Thread mCameraOpenThread = new Thread(new Runnable() {
+		@Override
+		public void run() {
+			try {
+				cameraManager.openCamera();
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+				cameraError = true;
+			}
+		}
+	});
+
+	private void setParameters() {
+
+		WindowManager manager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
+		Display display = manager.getDefaultDisplay();
+		int wWidth = display.getWidth();
+		int wHeight = display.getHeight();
+
+		cameraManager.setCameraFlashModel(Camera.Parameters.FLASH_MODE_OFF);
+
+		float ps = wWidth * 1.0f / wHeight;
+		cameraManager.setPreviewSize(ps);
+
+		int pWidth = cameraManager.getPreviewWidth();
+		int pHeight = cameraManager.getPreviewHeight();
+		if (pWidth == 0 || pHeight == 0) {
+			Toast.makeText(getBaseContext(), "鐓х浉鏈烘湭鍚姩锛侊紒", Toast.LENGTH_SHORT).show();
+			finish();
+			return;
+		}
+		Log.i(TAG, pWidth + "<--------W----Preview-----H------->" + pHeight);
+		Log.i(TAG, wWidth + "<--------W----WindowManager-----H------->" + wHeight);
+
+		int tempWidth = pWidth;
+		int tempHeidht = pHeight;
+		float x = 100.0f;
+		int tempW = pWidth;
+		int tempH = pHeight;
+		if (wWidth > pWidth && wHeight > pHeight) {
+			while (wWidth > tempW && wHeight > tempH) {
+				x++;
+				Log.d(TAG, "---xx----->" + x / 100.0);
+				tempW = (int) (pWidth * x / 100.0);
+				tempH = (int) (pHeight * x / 100.0);
+				if (wWidth > tempW && wHeight > tempH) {
+					tempWidth = tempW;
+					tempHeidht = tempH;
+				}
+			}
+			Log.d(TAG, "<------11--wWidth > pWidth && wHeight > pHeight------>");
+		} else {
+			while (tempWidth > wWidth || tempHeidht > wHeight) {
+				x--;
+				Log.d(TAG, "---xx----->" + x / 100.0);
+				tempWidth = (int) (pWidth * x / 100.0);
+				tempHeidht = (int) (pHeight * x / 100.0);
+			}
+			Log.d(TAG, "<-----22---tempWidth > wWidth || tempHeidht > wHeight------>");
+		}
+
+		Log.d(TAG, tempWidth + "<--------W----setParameters-----H------->" + tempHeidht);
+		// tempWidth = 854;
+		// tempHeidht = 480;
+		ViewGroup.LayoutParams lp = sv_preview.getLayoutParams();
+		lp.width = tempWidth;
+		lp.height = tempHeidht;
+		sv_preview.getHolder().setFixedSize(tempWidth, tempHeidht);
+		sv_preview.setLayoutParams(lp);
+
+		surfaceHolder = sv_preview.getHolder();
+		surfaceHolder.addCallback(CameraActivity.this);
+		surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
+
+		float[] img = finderView.initFinder(tempWidth, tempHeidht, mHandler, typeFront);
+
+		imgTips.setY(img[0]);
+		imgTips.setX(img[1]);
+
+	}
+
+	private void initView() {
+		sv_preview = (SurfaceView) findViewById(R.id.camera_sv);
+		finderView = (ViewfinderView) findViewById(R.id.camera_finderView);
+		tvTips = (TextView) findViewById(R.id.tv_tips);
+		btnCancel = (Button) findViewById(R.id.bt_cancel);
+		btnFlash = (Button) findViewById(R.id.bt_flash);
+		imgTips = (ImageView) findViewById(R.id.iv_tips);
+		switch (typeFront) {
+		case 0:
+			imgTips.setVisibility(View.GONE);
+			break;
+		case 1:
+			imgTips.setBackgroundResource(R.mipmap.people_face);
+			break;
+		case 2:
+			imgTips.setBackgroundResource(R.mipmap.emblem);
+			break;
+
+		default:
+			break;
+		}
+
+		btnFlash.setOnClickListener(listener);
+		btnCancel.setOnClickListener(listener);
+	}
+
+	private boolean isFlashOn = false;
+
+	private OnClickListener listener = new OnClickListener() {
+
+		@Override
+		public void onClick(View v) {
+			// TODO Auto-generated method stub
+			switch (v.getId()) {
+			case R.id.bt_cancel:
+				setResult(998);
+				finish();
+				break;
+			case R.id.bt_flash:
+				if (isFlashOn) {
+					try {
+						if (cameraManager.closeFlashlight()) {
+							btnFlash.setBackgroundDrawable(getResources().getDrawable(R.mipmap.flash_on_s));
+							isFlashOn = false;
+						}
+					} catch (Exception e) {
+						// TODO: handle exception
+					}
+
+				} else {
+					try {
+						if (cameraManager.openFlashlight()) {
+							btnFlash.setBackgroundDrawable(getResources().getDrawable(R.mipmap.flash_off_s));
+							isFlashOn = true;
+						}
+					} catch (Exception e) {
+						// TODO: handle exception
+					}
+
+				}
+				break;
+
+			default:
+				break;
+			}
+		}
+	};
+
+	private Handler mHandler = new Handler() {
+
+		@Override
+		public void handleMessage(Message msg) {
+			// TODO Auto-generated method stub
+			super.handleMessage(msg);
+			switch (msg.what) {
+			case OcrConstant.TAKE_PREVIEW_DATA_OK:
+
+				if (ocrManager == null) {
+					ocrManager = new OcrManager(mHandler, CameraActivity.this);
+					try {
+						rect = cameraManager.getViewfinder(finderView.getFinder());
+					} catch (Exception e) {
+						// TODO: handle exception
+						return;
+					}
+
+				}
+
+				byte[] data_p = (byte[]) msg.obj;
+				if (data_p != null && data_p.length > 0) {
+					// if(over){
+					// return;
+					// }
+					ocrManager.recognIDCard(data_p, cameraManager.getPreviewWidth(), cameraManager.getPreviewHeight(),
+							rect, 0, typeFront);
+					mHandler.sendEmptyMessageDelayed(OcrConstant.START_AUTOFOCUS, 100);
+				} else {
+					finderView.setLineRect(0);
+					Toast.makeText(getBaseContext(), "鐩告満鍑虹幇闂锛岃閲嶅惎鎵嬫満锛�", Toast.LENGTH_SHORT).show();
+					mHandler.sendEmptyMessageDelayed(OcrConstant.START_AUTOFOCUS, 500);
+				}
+				break;
+			case OcrConstant.RECOGN_OK:
+				mHandler.removeMessages(OcrConstant.TAKE_PREVIEW_DATA_OK);
+				mHandler.removeMessages(OcrConstant.START_AUTOFOCUS);
+//				String imgPath = "/sdcard/aidtest.jpg";
+//				String headPath = "/sdcard/aidheadtest.jpg";
+
+				byte[] headPath = new byte[2048 * 1024 * 3];
+				byte[] imgPath = new byte[2048 * 1024 * 3];
+				int[] headRect = new int[8];
+				int[] imgRect = new int[8];
+
+				IdCardInfoNew idCardInfo = ocrManager.getResultToByte(imgPath, imgRect, headPath, headRect);
+//				IdCardInfo idCardInfo = ocrManager.getResult(imgPath, headPath);
+				Intent data2 = new Intent();
+				data2.putExtra("idcardinfo", idCardInfo);
+				setResult(200, data2);
+
+				finish();
+
+				break;
+			case OcrConstant.REPEAT_AUTOFOCUS:
+				cameraManager.autoFoucs();
+				mHandler.sendEmptyMessageDelayed(OcrConstant.REPEAT_AUTOFOCUS, 2000);
+				break;
+			case OcrConstant.RECOGN_EG_TIME_OUT:
+				Toast.makeText(getBaseContext(), "寮曟搸杩囨湡锛岃灏藉揩鏇存柊锛�", Toast.LENGTH_LONG).show();
+				finish();
+				break;
+			case OcrConstant.RECOGN_EG_LICENSE:
+				int ret = -1;
+				if (msg.obj != null) {
+					ret = (Integer) msg.obj;
+				}
+				Toast.makeText(getBaseContext(), "鎺堟潈澶辫触-->" + ret, Toast.LENGTH_LONG).show();
+				finish();
+				break;
+			case OcrConstant.RECOGN_EG_INIT_ERROR:
+				Toast.makeText(getBaseContext(), "寮曟搸鍒濆鍖栧け璐ワ紒", Toast.LENGTH_LONG).show();
+				finish();
+				break;
+			case OcrConstant.START_AUTOFOCUS:
+				if (autoFoucs) {
+					cameraManager.autoFoucs();
+					autoFoucs = false;
+					mHandler.sendEmptyMessageDelayed(OcrConstant.START_AUTOFOCUS, 500);
+					mHandler.sendEmptyMessageDelayed(OcrConstant.REPEAT_AUTOFOCUS, 1500);
+				} else {
+					cameraManager.autoFocusAndPreviewCallback();
+				}
+				break;
+			case OcrConstant.RECOGN_LINE_IN_RECT:
+				int restult = (Integer) msg.obj;
+				finderView.setLineRect(restult);
+				break;
+			case OcrConstant.RECOGN_TIPS:
+				int tips = (Integer) msg.obj;
+				switch (tips) {
+				case 1000:
+					tvTips.setText("璇峰皢韬唤璇佺疆浜庢鍖哄煙\r\n灏濊瘯瀵归綈杈圭紭");
+					break;
+				case 1001:
+					tvTips.setText("璺濈绋嶈繎锛岃灏濊瘯杩滅偣");
+					break;
+				case 1002:
+					tvTips.setText("璺濈绋嶈繙锛岃灏濊瘯闈犺繎");
+					break;
+				case 1003:
+					// tvTips.setText("鍥惧儚妯$硦锛岃璋冩暣璺濈");
+					break;
+				case 1004:
+					tvTips.setText("鍥惧儚鍊炬枩锛岃淇濇寔姘村钩鎷嶆憚");
+					break;
+				case 1005:
+					tvTips.setText("璇峰皢韬唤璇佺疆浜庢鍖哄煙\r\n灏濊瘯瀵归綈杈圭紭");
+					break;
+				case 1006:
+					tvTips.setText("璇峰皢韬唤璇佹闈㈣嚦浜庢鍖哄煙");
+					break;
+				case 1007:
+					tvTips.setText("璇峰皢韬唤璇佸弽闈㈣嚦浜庢鍖哄煙");
+					break;
+
+				default:
+					break;
+				}
+
+				break;
+			default:
+				cameraManager.initDisplay();
+				mHandler.sendEmptyMessageDelayed(OcrConstant.START_AUTOFOCUS, 500);
+				Toast.makeText(getBaseContext(), "<>" + msg.what, Toast.LENGTH_SHORT).show();
+				break;
+			}
+		}
+
+	};
+
+	@Override
+	public void surfaceCreated(SurfaceHolder holder) {
+		// TODO Auto-generated method stub
+		Log.d(TAG, "surfaceCreated");
+		if (!cameraManager.cameraOpened()) {
+			cameraManager.openCamera();
+			setParameters();
+		}
+	}
+
+	@Override
+	public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
+		// TODO Auto-generated method stub
+		if (holder.getSurface() == null) {
+			Log.d(TAG, "holder.getSurface() == null");
+			return;
+		}
+		Log.v(TAG, "surfaceChanged. w=" + width + ". h=" + height);
+		surfaceHolder = holder;
+		cameraManager.setPreviewDisplay(surfaceHolder);
+		cameraManager.initDisplay();
+		mHandler.sendEmptyMessageDelayed(OcrConstant.START_AUTOFOCUS, 500);
+
+	}
+
+	@Override
+	public void surfaceDestroyed(SurfaceHolder holder) {
+		// TODO Auto-generated method stub
+		Log.d(TAG, "surfaceDestroyed");
+		try {
+			cameraManager.closeCamera();
+		} catch (Exception e) {
+			// TODO: handle exception
+		}
+
+		surfaceHolder = null;
+	}
+
+	private void finishAll() {
+		if (cameraManager != null) {
+			try {
+				cameraManager.closeCamera();
+			} catch (Exception e) {
+				// TODO: handle exception
+			}
+
+		}
+
+	}
+
+	@Override
+	protected void onDestroy() {
+		// TODO Auto-generated method stub
+		super.onDestroy();
+		mHandler.removeMessages(OcrConstant.TAKE_PREVIEW_DATA_OK);
+		mHandler.removeMessages(OcrConstant.START_AUTOFOCUS);
+		finishAll();
+
+	}
+
+}
diff --git a/app/src/main/java/com/dayu/recharge/activity/NewCardActivity.java b/app/src/main/java/com/dayu/recharge/activity/NewCardActivity.java
index 0d5db30..8beda8e 100644
--- a/app/src/main/java/com/dayu/recharge/activity/NewCardActivity.java
+++ b/app/src/main/java/com/dayu/recharge/activity/NewCardActivity.java
@@ -10,9 +10,6 @@
 import android.view.LayoutInflater;
 import android.view.View;
 
-import com.dayu.recharge.utils.DeviceNumberUtils;
-import com.dayu.recharge.view.ProgressDialog;
-import com.msd.ocr.idcard.LibraryInitOCR;
 import com.dayu.recharge.MyApplication;
 import com.dayu.recharge.card.UserCard;
 import com.dayu.recharge.databinding.ActivityNewCardBinding;
@@ -28,8 +25,10 @@
 import com.dayu.recharge.tools.HexUtil;
 import com.dayu.recharge.tools.Utils;
 import com.dayu.recharge.utils.CRC8;
+import com.dayu.recharge.utils.DeviceNumberUtils;
 import com.dayu.recharge.utils.SocketUtil;
 import com.dayu.recharge.utils.TipUtil;
+import com.dayu.recharge.view.ProgressDialog;
 import com.permissionx.guolindev.PermissionX;
 
 import org.json.JSONException;
@@ -134,12 +133,9 @@
 
 
     private void startCamera() {
-
-        Bundle bundle = new Bundle();
-        bundle.putBoolean("saveImage", false);
-        bundle.putInt("requestCode", SCAN_IDCARD_REQUEST);
-        bundle.putInt("type", 0); //0韬唤璇�, 1椹鹃┒璇�
-        LibraryInitOCR.startScan(NewCardActivity.this, bundle);
+        Intent intent = new Intent(NewCardActivity.this, CameraActivity.class);
+        intent.putExtra("typeFront", 1);
+        startActivityForResult(intent, 110);
     }
 
     @Override
@@ -320,10 +316,11 @@
             return (c >= 0x4e00 && c <= 0x9fa5);
         }
     }
+
     @Override
     protected void onDestroy() {
         super.onDestroy();
-        newCardActivity=null;
+        newCardActivity = null;
     }
 
 }
diff --git a/app/src/main/java/com/dayu/recharge/view/ViewfinderView.java b/app/src/main/java/com/dayu/recharge/view/ViewfinderView.java
new file mode 100644
index 0000000..44e3224
--- /dev/null
+++ b/app/src/main/java/com/dayu/recharge/view/ViewfinderView.java
@@ -0,0 +1,283 @@
+package com.dayu.recharge.view;
+
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.os.Handler;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.Display;
+import android.view.View;
+import android.view.WindowManager;
+
+import com.dayu.recharge.R;
+
+
+/**
+ * 瑙嗛鍙栨櫙鍣ㄦ帶浠�
+ *
+ * @author fangcm 2012-09-06
+ */
+public class ViewfinderView extends View {
+
+    private int width, height;
+    private Paint paint;
+    private Context mContext;
+    private int mWidth, mHeight;
+    private float lineLeft, lineRight, lineTop, lineBottom;
+    private int lineModel = 0;
+    private float marginW = 0f;
+    private float marginH = 0f;
+    private float marginT = 0f;
+    private int dLineWidth = 12;
+    private int dLen = 60;
+    private int m_nImageWidth;
+    private int m_nImageHeight;
+
+    boolean l = false, r = false, t = false, b = false, L = false;
+
+    public ViewfinderView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        // TODO Auto-generated constructor stub
+        this.mContext = context;
+    }
+
+
+    public ViewfinderView(Context context) {
+        super(context);
+        // TODO Auto-generated constructor stub
+        this.mContext = context;
+    }
+
+    public ViewfinderView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+        // TODO Auto-generated constructor stub
+        this.mContext = context;
+    }
+
+    /**
+     * 澶у皬  85.6*54
+     * 闀挎槸瀹界殑1.58鍊�
+     *
+     * @param pWidth
+     * @param pHeight
+     */
+    public float[] initFinder(int pWidth, int pHeight, Handler mHandler, int typeFront) {
+        m_nImageWidth = pWidth;
+        m_nImageHeight = pHeight;
+        WindowManager manager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
+        Display display = manager.getDefaultDisplay();
+        width = display.getWidth();
+        height = display.getHeight();
+        Log.d("tag", "-1-------->>" + width);
+
+        marginT = mContext.getResources().getDimension(R.dimen.public_46_dp);
+
+        marginW = (float) ((width - pWidth) / 2.0);
+        marginH = (float) ((height - pHeight) / 2.0);
+
+        mWidth = width / 2;
+        mHeight = height / 2;
+
+        float g = height - marginT * 2;
+        float k = g * 1.58f;
+        float x = 10.0f;
+        Log.d("ocr", k + "<<--k---楂樺害----g--1---->>" + g);
+        while (k > pWidth) {
+            x--;
+            k = k * (x / 10.0f);
+            g = g * (x / 10.0f);
+        }
+        Log.d("ocr", k + "<<--k---楂樺害----g--2---->>" + g);
+        lineLeft = (float) (mWidth - k / 2.0);
+        lineRight = (float) (mWidth + k / 2.0);
+        lineTop = (float) (mHeight - g / 2.0);
+        lineBottom = (float) (mHeight + g / 2.0);
+
+
+        int nDisplayWidth = display.getWidth();
+        int nDisplayHeight = display.getHeight();
+
+        int nImageWidth = m_nImageWidth;
+        int nImageHeight = m_nImageHeight;
+        double nFitWidth;
+        double nFitHeight;
+        double nUseWidth = 0;
+        double nUseHeight = 0;
+        double dRealRegionWidth = 0;
+//		double dRealRegionHeight = 0;
+        if (nImageWidth * nDisplayHeight < nDisplayWidth * nImageHeight) {
+            nFitHeight = nDisplayHeight;
+            nFitWidth = (nImageWidth / (double) nImageHeight) * nFitHeight;
+        } else {
+            nFitWidth = nDisplayWidth;
+            nFitHeight = nFitWidth * (nImageHeight / (double) nImageWidth);
+        }
+        if (nFitWidth / nFitHeight >= 4 / 3) {
+            nUseHeight = nFitHeight;
+            nUseWidth = 4 * nUseHeight / 3.0f;
+        } else {
+            nUseWidth = nFitWidth;
+            nUseHeight = 3 * nUseWidth / 4.0f;
+        }
+        dRealRegionWidth = nUseWidth / 480.0f * 420.0f;
+//		dRealRegionHeight = nUseHeight/360.0f*270.0f;
+
+//		lineLeft = (int)((nDisplayWidth - dRealRegionWidth)/2.0f);//- (nDisplayWidth - nFitWidth)/2.0f);
+//		lineRight = (int)( nDisplayWidth - lineLeft);//- (nDisplayWidth - nFitWidth) );
+//		lineTop = (int)(nDisplayHeight - dRealRegionHeight)/2.0f;
+//		lineBottom = nDisplayHeight - lineTop;
+
+
+        paint = new Paint();
+        dLineWidth = (int) dRealRegionWidth / 28; //30
+        dLineWidth = 4;
+        paint.setStrokeWidth(dLineWidth);
+        dLen = (int) dRealRegionWidth / 6; //160
+
+
+        float imgX = 10000;
+        float imgY = 10000;
+        switch (typeFront) {
+            case 1:
+                imgX = (mWidth - k / 2) + k * 0.56f;
+                imgY = lineTop + g * 0.18f;
+                break;
+            case 2:
+                imgX = lineLeft + k * 0.1f;
+                imgY = lineTop + g * 0.1f;
+                break;
+
+            default:
+                break;
+        }
+        float[] img = {imgY, imgX};
+        return img;
+    }
+
+
+    public void initFinder(int w, int h, int d) {
+    }
+
+    public Rect getFinder() {
+        return new Rect((int) (lineLeft - marginW), (int) (lineTop - marginH), (int) (lineRight + marginW), (int) (lineBottom + marginH));
+    }
+
+
+    public void setLineRect(int model) {
+        lineModel = model;
+        invalidate();
+    }
+
+
+    @Override
+    public void draw(Canvas canvas) {
+        // TODO Auto-generated method stub
+        super.draw(canvas);
+
+        paint.setColor(Color.GREEN);
+
+
+        canvas.drawLine(lineLeft - dLineWidth / 2, lineTop, lineLeft + dLen, lineTop, paint);
+        canvas.drawLine(lineLeft, lineTop - dLineWidth / 2, lineLeft, lineTop + dLen, paint);
+
+        canvas.drawLine(lineRight, lineTop - dLineWidth / 2, lineRight, lineTop + dLen, paint);
+        canvas.drawLine(lineRight + dLineWidth / 2, lineTop, lineRight - dLen, lineTop, paint);
+
+        canvas.drawLine(lineLeft, lineBottom + dLineWidth / 2, lineLeft, lineBottom - dLen, paint);
+        canvas.drawLine(lineLeft - dLineWidth / 2, lineBottom, lineLeft + dLen, lineBottom, paint);
+
+        canvas.drawLine(lineRight + dLineWidth / 2, lineBottom, lineRight - dLen, lineBottom, paint);
+        canvas.drawLine(lineRight, lineBottom + dLineWidth / 2, lineRight, lineBottom - dLen, paint);
+
+        switch (lineModel) {
+            case 0:
+
+                break;
+            case 1://宸﹁竟妗嗙嚎
+                canvas.drawLine(lineLeft, lineTop, lineLeft, lineBottom, paint);
+                break;
+            case 2://鍙宠竟妗嗙嚎
+                canvas.drawLine(lineRight, lineTop, lineRight, lineBottom, paint);
+                break;
+            case 3://宸﹀彸
+                canvas.drawLine(lineLeft, lineTop, lineLeft, lineBottom, paint);
+                canvas.drawLine(lineRight, lineTop, lineRight, lineBottom, paint);
+                break;
+            case 4://涓婅竟妗�
+                canvas.drawLine(lineLeft, lineTop, lineRight, lineTop, paint);
+                break;
+            case 5://宸︿笂
+                canvas.drawLine(lineLeft, lineTop, lineLeft, lineBottom, paint);
+                canvas.drawLine(lineLeft, lineTop, lineRight, lineTop, paint);
+                break;
+            case 6://鍙充笂
+                canvas.drawLine(lineRight, lineTop, lineRight, lineBottom, paint);
+                canvas.drawLine(lineLeft, lineTop, lineRight, lineTop, paint);
+                break;
+            case 7://宸﹀彸涓�
+                canvas.drawLine(lineLeft, lineTop, lineLeft, lineBottom, paint);
+                canvas.drawLine(lineRight, lineTop, lineRight, lineBottom, paint);
+                canvas.drawLine(lineLeft, lineTop, lineRight, lineTop, paint);
+                break;
+            case 8://涓嬭竟妗�
+                canvas.drawLine(lineLeft, lineBottom, lineRight, lineBottom, paint);
+                break;
+            case 9://宸︿笅
+                canvas.drawLine(lineLeft, lineTop, lineLeft, lineBottom, paint);
+                canvas.drawLine(lineLeft, lineBottom, lineRight, lineBottom, paint);
+                break;
+            case 10://鍙充笅杈规
+                canvas.drawLine(lineRight, lineTop, lineRight, lineBottom, paint);
+                canvas.drawLine(lineLeft, lineBottom, lineRight, lineBottom, paint);
+                break;
+            case 11://宸﹀彸涓�
+                canvas.drawLine(lineLeft, lineTop, lineLeft, lineBottom, paint);
+                canvas.drawLine(lineRight, lineTop, lineRight, lineBottom, paint);
+                canvas.drawLine(lineLeft, lineBottom, lineRight, lineBottom, paint);
+                break;
+            case 12://涓婁笅
+                canvas.drawLine(lineLeft, lineTop, lineRight, lineTop, paint);
+                canvas.drawLine(lineLeft, lineBottom, lineRight, lineBottom, paint);
+                break;
+            case 13://涓婁笅宸�
+                canvas.drawLine(lineLeft, lineTop, lineRight, lineTop, paint);
+                canvas.drawLine(lineLeft, lineBottom, lineRight, lineBottom, paint);
+                canvas.drawLine(lineLeft, lineTop, lineLeft, lineBottom, paint);
+                break;
+            case 14://涓婁笅鍙�
+                canvas.drawLine(lineLeft, lineTop, lineRight, lineTop, paint);
+                canvas.drawLine(lineLeft, lineBottom, lineRight, lineBottom, paint);
+                canvas.drawLine(lineRight, lineTop, lineRight, lineBottom, paint);
+                break;
+            case 15://鍏�
+                canvas.drawLine(lineLeft, lineTop, lineLeft, lineBottom, paint);
+                canvas.drawLine(lineRight, lineTop, lineRight, lineBottom, paint);
+                canvas.drawLine(lineLeft, lineTop, lineRight, lineTop, paint);
+                canvas.drawLine(lineLeft, lineBottom, lineRight, lineBottom, paint);
+                break;
+
+            default:
+
+                break;
+        }
+        paint.setColor(Color.BLACK);
+        paint.setAlpha(100);
+//		canvas.drawRect(lineLeft + dLineWidth / 2, lineTop + dLineWidth / 2, lineRight - dLineWidth / 2, lineBottom - dLineWidth / 2, paint);
+
+        //鐢诲洓鍛�
+        canvas.drawRect(0, 0, width, lineTop - dLineWidth / 2, paint);
+
+        canvas.drawRect(0, lineTop - dLineWidth / 2, lineLeft - dLineWidth / 2, lineBottom + dLineWidth / 2, paint);
+
+        canvas.drawRect(0, lineBottom + dLineWidth / 2, width, height, paint);
+
+        canvas.drawRect(lineRight + dLineWidth / 2, lineTop - dLineWidth / 2, width, lineBottom + dLineWidth / 2, paint);
+
+    }
+
+
+}
diff --git a/app/src/main/res/layout/activity_new_card.xml b/app/src/main/res/layout/activity_new_card.xml
index c365bc9..36c573e 100644
--- a/app/src/main/res/layout/activity_new_card.xml
+++ b/app/src/main/res/layout/activity_new_card.xml
@@ -67,7 +67,7 @@
                     android:id="@+id/newCard_scanBtn"
                     android:layout_width="45dp"
                     android:layout_height="45dp"
-                    android:visibility="gone"
+
                     android:padding="10dp"
                     android:src="@mipmap/icon_scan" />
 
diff --git a/app/src/main/res/layout/camera.xml b/app/src/main/res/layout/camera.xml
new file mode 100644
index 0000000..e61ffdc
--- /dev/null
+++ b/app/src/main/res/layout/camera.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="vertical">
+
+    <SurfaceView
+        android:id="@+id/camera_sv"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_centerInParent="true" />
+
+    <Button
+        android:id="@+id/bt_cancel"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentRight="true"
+        android:layout_marginTop="20dip"
+        android:background="@mipmap/cancel_s" />
+
+    <Button
+        android:id="@+id/bt_flash"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="20dip"
+        android:background="@mipmap/flash_on_s" />
+
+    <TextView
+        android:id="@+id/tv_tips"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_centerInParent="true"
+        android:gravity="center"
+        android:text="璇峰皢韬唤璇佺疆浜庢鍖哄煙\n灏濊瘯瀵归綈杈圭紭"
+        android:textColor="@color/white"
+        android:textSize="20sp" />
+
+    <com.dayu.recharge.view.ViewfinderView
+        android:id="@+id/camera_finderView"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
+    <ImageView
+        android:id="@+id/iv_tips"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:background="@mipmap/people_face" />
+
+
+</RelativeLayout>
diff --git a/app/src/main/res/mipmap-xhdpi/cancel_s.png b/app/src/main/res/mipmap-xhdpi/cancel_s.png
new file mode 100644
index 0000000..22af697
--- /dev/null
+++ b/app/src/main/res/mipmap-xhdpi/cancel_s.png
Binary files differ
diff --git a/app/src/main/res/mipmap-xhdpi/emblem.png b/app/src/main/res/mipmap-xhdpi/emblem.png
new file mode 100644
index 0000000..645c34b
--- /dev/null
+++ b/app/src/main/res/mipmap-xhdpi/emblem.png
Binary files differ
diff --git a/app/src/main/res/mipmap-xhdpi/flash_off_s.png b/app/src/main/res/mipmap-xhdpi/flash_off_s.png
new file mode 100644
index 0000000..7374c37
--- /dev/null
+++ b/app/src/main/res/mipmap-xhdpi/flash_off_s.png
Binary files differ
diff --git a/app/src/main/res/mipmap-xhdpi/flash_on_s.png b/app/src/main/res/mipmap-xhdpi/flash_on_s.png
new file mode 100644
index 0000000..7f1db37
--- /dev/null
+++ b/app/src/main/res/mipmap-xhdpi/flash_on_s.png
Binary files differ
diff --git a/app/src/main/res/mipmap-xhdpi/people_face.png b/app/src/main/res/mipmap-xhdpi/people_face.png
new file mode 100644
index 0000000..f8cf43d
--- /dev/null
+++ b/app/src/main/res/mipmap-xhdpi/people_face.png
Binary files differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index d1be4a7..3268ea5 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -22,4 +22,19 @@
     <color name="red">#ff0000</color>
 
     <color name="text_wite">#ffffff</color>
+
+    <color name="white">#ffffff</color>
+    <color name="black">#000000</color>
+    <color name="blue">#0000FF</color>
+    <color name="gray">#666666</color>
+    <color name="use">#cccccc</color> <!-- 娴呯伆 -->
+    <color name="transparent">#cccccc</color> <!-- 閫忔槑 -->
+    <color name="snow">#444546</color> <!-- 娴呯櫧 -->
+    <color name="azury">#1d8ee4</color> <!-- 娴呰摑 -->
+    <color name="qblue">#335bed</color><!-- 娴呰摑 -->
+    <color name="qgreen">#9dc446</color><!-- 娴呯豢鑹� -->
+    <color name="quse">#9da0ab</color> <!-- 娴呯伆 -->
+    <color name="qquse">#9c9c9c</color> <!-- 娴呮祬鐏� -->
+    <color name="finder_1">#33b5e5</color> <!-- 娴呰摑鑹� -->
+    <color name="finder_2">#0d80aa</color> <!-- 娣变竴鐐圭殑娴呰摑鑹� -->
 </resources>
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 7f1ca6e..122004a 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -12,4 +12,33 @@
     <dimen name="dimen_title_text_size">19sp</dimen>
     <dimen name="picker_view_height">160dp</dimen>
     <dimen name="date_unit_text_size">18sp</dimen>
+
+    <dimen name="public_1_dp">1dip</dimen>
+    <dimen name="public_4_dp">4dip</dimen>
+    <dimen name="public_3_dp">3dip</dimen>
+    <dimen name="public_6_dp">6dip</dimen>
+    <dimen name="public_8_dp">8dip</dimen>
+    <dimen name="public_10_dp">10dip</dimen>
+    <dimen name="public_12_dp">12dip</dimen>
+    <dimen name="public_14_dp">14dip</dimen>
+    <dimen name="public_16_dp">16dip</dimen>
+    <dimen name="public_18_dp">18dip</dimen>
+    <dimen name="public_20_dp">20dip</dimen>
+    <dimen name="public_24_dp">24dip</dimen>
+    <dimen name="public_28_dp">28dip</dimen>
+    <dimen name="public_30_dp">30dip</dimen>
+    <dimen name="public_36_dp">36dip</dimen>
+    <dimen name="public_34_dp">34dip</dimen>
+    <dimen name="public_40_dp">40dip</dimen>
+    <dimen name="public_46_dp">46dip</dimen>
+    <dimen name="public_48_dp">48dip</dimen>
+    <dimen name="public_60_dp">60dip</dimen>
+    <dimen name="public_68_dp">68dip</dimen>
+    <dimen name="public_70_dp">70dip</dimen>
+    <dimen name="public_80_dp">80dip</dimen>
+    <dimen name="public_100_dp">100dip</dimen>
+    <dimen name="public_120_dp">120dip</dimen>
+    <dimen name="public_160_dp">160dip</dimen>
+    <dimen name="public_180_dp">180dip</dimen>
+    <dimen name="public_200_dp">200dip</dimen>
 </resources>
diff --git a/gradlew b/gradlew
index 4f906e0..a69d9cb 100644
--- a/gradlew
+++ b/gradlew
@@ -1,7 +1,7 @@
-#!/usr/bin/env sh
+#!/bin/sh
 
 #
-# Copyright 2015 the original author or authors.
+# Copyright 漏 2015-2021 the original authors.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -17,67 +17,101 @@
 #
 
 ##############################################################################
-##
-##  Gradle start up script for UN*X
-##
+#
+#   Gradle start up script for POSIX generated by Gradle.
+#
+#   Important for running:
+#
+#   (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+#       noncompliant, but you have some other compliant shell such as ksh or
+#       bash, then to run this script, type that shell name before the whole
+#       command line, like:
+#
+#           ksh Gradle
+#
+#       Busybox and similar reduced shells will NOT work, because this script
+#       requires all of these POSIX shell features:
+#         * functions;
+#         * expansions 芦$var禄, 芦${var}禄, 芦${var:-default}禄, 芦${var+SET}禄,
+#           芦${var#prefix}禄, 芦${var%suffix}禄, and 芦$( cmd )禄;
+#         * compound commands having a testable exit status, especially 芦case禄;
+#         * various built-in commands including 芦command禄, 芦set禄, and 芦ulimit禄.
+#
+#   Important for patching:
+#
+#   (2) This script targets any POSIX shell, so it avoids extensions provided
+#       by Bash, Ksh, etc; in particular arrays are avoided.
+#
+#       The "traditional" practice of packing multiple parameters into a
+#       space-separated string is a well documented source of bugs and security
+#       problems, so this is (mostly) avoided, by progressively accumulating
+#       options in "$@", and eventually passing that to Java.
+#
+#       Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+#       and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+#       see the in-line comments for details.
+#
+#       There are tweaks for specific operating systems such as AIX, CygWin,
+#       Darwin, MinGW, and NonStop.
+#
+#   (3) This script is generated from the Groovy template
+#       https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+#       within the Gradle project.
+#
+#       You can find Gradle at https://github.com/gradle/gradle/.
+#
 ##############################################################################
 
 # Attempt to set APP_HOME
+
 # Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
-    ls=`ls -ld "$PRG"`
-    link=`expr "$ls" : '.*-> \(.*\)$'`
-    if expr "$link" : '/.*' > /dev/null; then
-        PRG="$link"
-    else
-        PRG=`dirname "$PRG"`"/$link"
-    fi
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+    APP_HOME=${app_path%"${app_path##*/}"}  # leaves a trailing /; empty if no leading path
+    [ -h "$app_path" ]
+do
+    ls=$( ls -ld "$app_path" )
+    link=${ls#*' -> '}
+    case $link in             #(
+      /*)   app_path=$link ;; #(
+      *)    app_path=$APP_HOME$link ;;
+    esac
 done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
+
+APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
 
 APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
+APP_BASE_NAME=${0##*/}
 
 # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
 DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
 
 # Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
+MAX_FD=maximum
 
 warn () {
     echo "$*"
-}
+} >&2
 
 die () {
     echo
     echo "$*"
     echo
     exit 1
-}
+} >&2
 
 # OS specific support (must be 'true' or 'false').
 cygwin=false
 msys=false
 darwin=false
 nonstop=false
-case "`uname`" in
-  CYGWIN* )
-    cygwin=true
-    ;;
-  Darwin* )
-    darwin=true
-    ;;
-  MINGW* )
-    msys=true
-    ;;
-  NONSTOP* )
-    nonstop=true
-    ;;
+case "$( uname )" in                #(
+  CYGWIN* )         cygwin=true  ;; #(
+  Darwin* )         darwin=true  ;; #(
+  MSYS* | MINGW* )  msys=true    ;; #(
+  NONSTOP* )        nonstop=true ;;
 esac
 
 CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -87,9 +121,9 @@
 if [ -n "$JAVA_HOME" ] ; then
     if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
         # IBM's JDK on AIX uses strange locations for the executables
-        JAVACMD="$JAVA_HOME/jre/sh/java"
+        JAVACMD=$JAVA_HOME/jre/sh/java
     else
-        JAVACMD="$JAVA_HOME/bin/java"
+        JAVACMD=$JAVA_HOME/bin/java
     fi
     if [ ! -x "$JAVACMD" ] ; then
         die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -98,7 +132,7 @@
 location of your Java installation."
     fi
 else
-    JAVACMD="java"
+    JAVACMD=java
     which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
 
 Please set the JAVA_HOME variable in your environment to match the
@@ -106,80 +140,101 @@
 fi
 
 # Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
-    MAX_FD_LIMIT=`ulimit -H -n`
-    if [ $? -eq 0 ] ; then
-        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
-            MAX_FD="$MAX_FD_LIMIT"
-        fi
-        ulimit -n $MAX_FD
-        if [ $? -ne 0 ] ; then
-            warn "Could not set maximum file descriptor limit: $MAX_FD"
-        fi
-    else
-        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
-    fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
-    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin or MSYS, switch paths to Windows format before running java
-if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
-    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
-    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
-    JAVACMD=`cygpath --unix "$JAVACMD"`
-
-    # We build the pattern for arguments to be converted via cygpath
-    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
-    SEP=""
-    for dir in $ROOTDIRSRAW ; do
-        ROOTDIRS="$ROOTDIRS$SEP$dir"
-        SEP="|"
-    done
-    OURCYGPATTERN="(^($ROOTDIRS))"
-    # Add a user-defined pattern to the cygpath arguments
-    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
-        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
-    fi
-    # Now convert the arguments - kludge to limit ourselves to /bin/sh
-    i=0
-    for arg in "$@" ; do
-        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
-        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
-
-        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
-            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
-        else
-            eval `echo args$i`="\"$arg\""
-        fi
-        i=`expr $i + 1`
-    done
-    case $i in
-        0) set -- ;;
-        1) set -- "$args0" ;;
-        2) set -- "$args0" "$args1" ;;
-        3) set -- "$args0" "$args1" "$args2" ;;
-        4) set -- "$args0" "$args1" "$args2" "$args3" ;;
-        5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
-        6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
-        7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
-        8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
-        9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+    case $MAX_FD in #(
+      max*)
+        MAX_FD=$( ulimit -H -n ) ||
+            warn "Could not query maximum file descriptor limit"
+    esac
+    case $MAX_FD in  #(
+      '' | soft) :;; #(
+      *)
+        ulimit -n "$MAX_FD" ||
+            warn "Could not set maximum file descriptor limit to $MAX_FD"
     esac
 fi
 
-# Escape application args
-save () {
-    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
-    echo " "
-}
-APP_ARGS=`save "$@"`
+# Collect all arguments for the java command, stacking in reverse order:
+#   * args from the command line
+#   * the main class name
+#   * -classpath
+#   * -D...appname settings
+#   * --module-path (only if needed)
+#   * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
 
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+    APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+    CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+    JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    for arg do
+        if
+            case $arg in                                #(
+              -*)   false ;;                            # don't mess with options #(
+              /?*)  t=${arg#/} t=/${t%%/*}              # looks like a POSIX filepath
+                    [ -e "$t" ] ;;                      #(
+              *)    false ;;
+            esac
+        then
+            arg=$( cygpath --path --ignore --mixed "$arg" )
+        fi
+        # Roll the args list around exactly as many times as the number of
+        # args, so each arg winds up back in the position where it started, but
+        # possibly modified.
+        #
+        # NB: a `for` loop captures its iteration list before it begins, so
+        # changing the positional parameters here affects neither the number of
+        # iterations, nor the values presented in `arg`.
+        shift                   # remove old arg
+        set -- "$@" "$arg"      # push replacement arg
+    done
+fi
+
+# Collect all arguments for the java command;
+#   * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
+#     shell script including quotes and variable substitutions, so put them in
+#     double quotes to make sure that they get re-expanded; and
+#   * put everything else in single quotes, so that it's not re-expanded.
+
+set -- \
+        "-Dorg.gradle.appname=$APP_BASE_NAME" \
+        -classpath "$CLASSPATH" \
+        org.gradle.wrapper.GradleWrapperMain \
+        "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+    die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+#   readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+#   set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+        printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+        xargs -n1 |
+        sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+        tr '\n' ' '
+    )" '"$@"'
 
 exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
index 107acd3..f127cfd 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -14,7 +14,7 @@
 @rem limitations under the License.
 @rem
 
-@if "%DEBUG%" == "" @echo off
+@if "%DEBUG%"=="" @echo off
 @rem ##########################################################################
 @rem
 @rem  Gradle startup script for Windows
@@ -25,7 +25,7 @@
 if "%OS%"=="Windows_NT" setlocal
 
 set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
+if "%DIRNAME%"=="" set DIRNAME=.
 set APP_BASE_NAME=%~n0
 set APP_HOME=%DIRNAME%
 
@@ -40,7 +40,7 @@
 
 set JAVA_EXE=java.exe
 %JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto execute
+if %ERRORLEVEL% equ 0 goto execute
 
 echo.
 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +75,15 @@
 
 :end
 @rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
+if %ERRORLEVEL% equ 0 goto mainEnd
 
 :fail
 rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
 rem the _cmd.exe /c_ return code!
-if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
 
 :mainEnd
 if "%OS%"=="Windows_NT" endlocal
diff --git a/local.properties b/local.properties
index f059514..72e4336 100644
--- a/local.properties
+++ b/local.properties
@@ -4,5 +4,5 @@
 # Location of the SDK. This is only used by Gradle.
 # For customization when using a Version Control System, please read the
 # header note.
-#Sat Nov 11 20:12:34 CST 2023
-sdk.dir=D\:\\AndroidStudio\\sdk
+#Thu Nov 30 15:06:34 CST 2023
+sdk.dir=D\:\\sdk

--
Gitblit v1.8.0