diff --git a/app/src/main/java/com/ouxuan/oxface/MainActivity.java b/app/src/main/java/com/ouxuan/oxface/MainActivity.java index 40c88f7..549cad3 100644 --- a/app/src/main/java/com/ouxuan/oxface/MainActivity.java +++ b/app/src/main/java/com/ouxuan/oxface/MainActivity.java @@ -112,7 +112,7 @@ public class MainActivity extends AppCompatActivity { // 设置长按登录按钮显示日志路径信息(调试功能) setupLogPathDebug(); - //切换第六批设备 + //切换第六批设备(0-5) switchCameraByDeviceType(5); } diff --git a/app/src/main/java/com/ouxuan/oxface/OXFaceOnlineActivity.java b/app/src/main/java/com/ouxuan/oxface/OXFaceOnlineActivity.java index 19ac470..2871206 100644 --- a/app/src/main/java/com/ouxuan/oxface/OXFaceOnlineActivity.java +++ b/app/src/main/java/com/ouxuan/oxface/OXFaceOnlineActivity.java @@ -114,6 +114,17 @@ public class OXFaceOnlineActivity extends BaseActivity implements View.OnClickLi private long searshTime; private boolean isCompareCheck = false; + // 底部按钮 + private Button btnOpenDoor; + private Button btnScanQR; + private Button btnSettings; + + // 新增的二维码区域控件 + private ImageView imgMiniProgramCode; + private ImageView imgScanDoorQRCode; + private Button btnVerificationCode; + private Button btnScannerDoor; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -167,105 +178,103 @@ public class OXFaceOnlineActivity extends BaseActivity implements View.OnClickLi ImageView mButReturn = findViewById(R.id.btn_back); mButReturn.setOnClickListener(this); - // ***************预览模式************* - // 导航栏 -// preText = findViewById(R.id.preview_text); -// if (preText != null) { -// preText.setOnClickListener(this); -// preText.setTextColor(Color.parseColor("#ffffff")); -// } -// previewView = findViewById(R.id.preview_view); - // 信息展示 - preViewRelativeLayout = findViewById(R.id.yvlan_relativeLayout); - preToastText = findViewById(R.id.pre_toast_text); - progressLayout = findViewById(R.id.progress_layout); - progressBarView = findViewById(R.id.progress_bar_view); - // 隐藏圆形进度条 - if (progressLayout != null) { - progressLayout.setVisibility(View.GONE); + // 初始化二维码区域控件 + imgMiniProgramCode = findViewById(R.id.img_mini_program_code); + imgScanDoorQRCode = findViewById(R.id.img_scan_door_qrcode); + btnVerificationCode = findViewById(R.id.btn_verification_code); + btnScannerDoor = findViewById(R.id.btn_scanner_door); + + // 设置二维码区域控件的点击事件 + if (imgMiniProgramCode != null) { + imgMiniProgramCode.setOnClickListener(this); + } + if (imgScanDoorQRCode != null) { + imgScanDoorQRCode.setOnClickListener(this); + } + if (btnVerificationCode != null) { + btnVerificationCode.setOnClickListener(this); + } + if (btnScannerDoor != null) { + btnScannerDoor.setOnClickListener(this); + } + + // 底部覆盖层,包含按钮和二维码 + RelativeLayout bottomOverlay = findViewById(R.id.bottom_overlay); + if (bottomOverlay != null) { + // 确保底部覆盖层显示 + bottomOverlay.setVisibility(View.VISIBLE); + } + + // 初始化底部按钮 + btnOpenDoor = findViewById(R.id.button_open_door); + btnScanQR = findViewById(R.id.button_scan_qr); + btnSettings = findViewById(R.id.button_settings); + + if (btnOpenDoor != null) { + btnOpenDoor.setOnClickListener(this); + } + if (btnScanQR != null) { + btnScanQR.setOnClickListener(this); } - // 预览模式下提示 - payHintRl = findViewById(R.id.pay_hintRl); - - // ***************开发模式************* - // 导航栏 -// deveLop = findViewById(R.id.develop_text); -// if (deveLop != null) { -// deveLop.setOnClickListener(this); -// deveLop.setTextColor(Color.parseColor("#a9a9a9")); -// } -// developView = findViewById(R.id.develop_view); -// if (developView != null) { -// developView.setVisibility(View.GONE); -// } - // 信息展示 -// deveLopRelativeLayout = findViewById(R.id.kaifa_relativeLayout); - // isCheckImage = findViewById(R.id.is_check_image); -// detectSurfaceText = findViewById(R.id.detect_surface_text); -// if (detectSurfaceText != null) { -// detectSurfaceText.setVisibility(View.GONE); -// } - // 送检RGB 图像回显 -// mFaceDetectImageView = findViewById(R.id.face_detect_image_view); -// if (mFaceDetectImageView != null) { -// mFaceDetectImageView.setVisibility(View.GONE); -// } - // 检测耗时 -// mTvDetect = findViewById(R.id.tv_detect_time); - // RGB活体 -// mTvLive = findViewById(R.id.tv_rgb_live_time); -// mTvLiveScore = findViewById(R.id.tv_rgb_live_score); - // 总耗时 -// mTvAllTime = findViewById(R.id.tv_all_time); + if (btnSettings != null) { + btnSettings.setOnClickListener(this); + } + + // 隐藏原有的UI元素 + hideOriginalUI(); + + // 初始化状态信息显示 layoutCompareStatus = findViewById(R.id.layout_compare_status); if (layoutCompareStatus != null) { layoutCompareStatus.setVisibility(View.GONE); } textCompareStatus = findViewById(R.id.text_compare_status); - // 存图按钮 - saveCamera = findViewById(R.id.save_camera); - if (saveCamera != null) { - saveCamera.setOnClickListener(this); - saveCamera.setVisibility(View.GONE); - } - spot = findViewById(R.id.spot); - - // 质量检测未通过 - financeQualityTestFailed = findViewById(R.id.finance_quality_test_failed); - qualityTestTimeTv = findViewById(R.id.quality_test_timeTv); - qualityDetectedTv = findViewById(R.id.quality_detectedTv); - qualityShelteredPart = findViewById(R.id.quality_sheltered_part); - qualityRetestDetectBtn = findViewById(R.id.quality_retest_detectBtn); - if (qualityRetestDetectBtn != null) { - qualityRetestDetectBtn.setOnClickListener(this); + + // 初始化测试弹窗 + initTestPopWindow(); + } + + /** + * 隐藏原有的UI元素,保持界面简洁 + */ + private void hideOriginalUI() { + // 隐藏进度条 + if (progressLayout != null) { + progressLayout.setVisibility(View.GONE); } - // 活体通过 - financeByLivingDetection = findViewById(R.id.finance_by_living_detection); - byLivingDetectionRgb = findViewById(R.id.by_living_detection_rgb); - byLivingDetectionNir = findViewById(R.id.by_living_detection_nir); - byLivingDetectionDepth = findViewById(R.id.by_living_detection_depth); - byLivingTetectionTime = findViewById(R.id.by_living_detection_time); - byLivingDetectionFrames = findViewById(R.id.by_living_detection_Frames); - Button byLivingDetectionBtn = findViewById(R.id.by_living_detection_btn); - if (byLivingDetectionBtn != null) { - byLivingDetectionBtn.setOnClickListener(this); + progressBarView = findViewById(R.id.progress_bar_view); + if (progressBarView != null) { + progressBarView.setVisibility(View.GONE); } - detectRegImageItem = findViewById(R.id.detect_reg_image_item); - - // 活体未通过 - financeFailedInVivoTest = findViewById(R.id.finance_failed_in_vivo_test); - failedInVivoTestRgb = findViewById(R.id.failed_in_vivo_test_rgb); - failedInVivoTestNir = findViewById(R.id.failed_in_vivo_test_nir); - failedInVivoTestDepth = findViewById(R.id.failed_in_vivo_test_depth); - failedInVivoTestTime = findViewById(R.id.failed_in_vivo_test_time); - failedInVivoTestFrames = findViewById(R.id.failed_in_vivo_test_Frames); - Button failed_in_vivo_testBtn = findViewById(R.id.failed_in_vivo_testBtn); - if (failed_in_vivo_testBtn != null) { - failed_in_vivo_testBtn.setOnClickListener(this); + + // 隐藏提示区域 + if (preViewRelativeLayout != null) { + preViewRelativeLayout.setVisibility(View.GONE); } - noDetectRegImageItem = findViewById(R.id.no_detect_reg_image_item); - + + // 隐藏其他不需要的UI元素 + if (financeQualityTestFailed != null) { + financeQualityTestFailed.setVisibility(View.GONE); + } + if (financeByLivingDetection != null) { + financeByLivingDetection.setVisibility(View.GONE); + } + if (financeFailedInVivoTest != null) { + financeFailedInVivoTest.setVisibility(View.GONE); + } + if (saveCamera != null) { + saveCamera.setVisibility(View.GONE); + } + if (spot != null) { + spot.setVisibility(View.GONE); + } + } + + /** + * 初始化测试弹窗 + */ + private void initTestPopWindow() { testPopWindow = new TestPopWindow(this, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); testPopWindow.setmOnClickFinance(new TestPopWindow.OnClickFinance() { @@ -399,6 +408,224 @@ public class OXFaceOnlineActivity extends BaseActivity implements View.OnClickLi int id = view.getId(); if (id == R.id.btn_back) { finish(); + } else if (id == R.id.button_open_door) { + // 开门按钮点击事件 + handleOpenDoorClick(); + } else if (id == R.id.button_scan_qr) { + // 扫码按钮点击事件 + handleScanQRClick(); + } else if (id == R.id.button_settings) { + // 设置按钮点击事件 + handleSettingsClick(); + } else if (id == R.id.img_mini_program_code) { + // 新用户扫码上传人脸点击事件 + handleMiniProgramCodeClick(); + } else if (id == R.id.img_scan_door_qrcode) { + // 扫码开门点击事件 + handleScanDoorQRCodeClick(); + } else if (id == R.id.btn_verification_code) { + // 验证码开门点击事件 + handleVerificationCodeClick(); + } else if (id == R.id.btn_scanner_door) { + // 扫码器开门点击事件 + handleScannerDoorClick(); + } + } + + /** + * 处理开门按钮点击事件 + */ + private void handleOpenDoorClick() { + LogManager.logInfo(TAG, "用户点击开门按钮"); + Toast.makeText(this, "开门功能已触发", Toast.LENGTH_SHORT).show(); + + // 这里可以添加实际的开门逻辑 + // 例如:发送网络请求到服务器执行开门操作 + // 或者通过蓝牙/WiFi连接门锁设备 + + // 显示开门状态 + if (layoutCompareStatus != null) { + layoutCompareStatus.setVisibility(View.VISIBLE); + textCompareStatus.setTextColor(Color.parseColor("#009874")); + textCompareStatus.setText("正在开门..."); + + // 3秒后隐藏状态提示 + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + if (layoutCompareStatus != null) { + layoutCompareStatus.setVisibility(View.GONE); + } + } + }, 3000); + } + } + + /** + * 处理扫码按钮点击事件 + */ + private void handleScanQRClick() { + LogManager.logInfo(TAG, "用户点击扫码按钮"); + Toast.makeText(this, "扫码功能已触发", Toast.LENGTH_SHORT).show(); + + // 这里可以添加实际的扫码逻辑 + // 例如:启动扫码Activity或显示扫码界面 + + // 显示扫码状态 + if (layoutCompareStatus != null) { + layoutCompareStatus.setVisibility(View.VISIBLE); + textCompareStatus.setTextColor(Color.parseColor("#009874")); + textCompareStatus.setText("请将二维码对准扫描区域"); + + // 3秒后隐藏状态提示 + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + if (layoutCompareStatus != null) { + layoutCompareStatus.setVisibility(View.GONE); + } + } + }, 3000); + } + } + + /** + * 处理设置按钮点击事件 + */ + private void handleSettingsClick() { + LogManager.logInfo(TAG, "用户点击设置按钮"); + Toast.makeText(this, "设置功能已触发", Toast.LENGTH_SHORT).show(); + + // 这里可以添加实际的设置逻辑 + // 例如:启动设置Activity或显示设置对话框 + + // 显示设置状态 + if (layoutCompareStatus != null) { + layoutCompareStatus.setVisibility(View.VISIBLE); + textCompareStatus.setTextColor(Color.parseColor("#009874")); + textCompareStatus.setText("正在加载设置..."); + + // 3秒后隐藏状态提示 + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + if (layoutCompareStatus != null) { + layoutCompareStatus.setVisibility(View.GONE); + } + } + }, 3000); + } + } + + /** + * 处理新用户扫码上传人脸点击事件 + */ + private void handleMiniProgramCodeClick() { + LogManager.logInfo(TAG, "用户点击新用户扫码上传人脸"); + Toast.makeText(this, "新用户扫码上传人脸功能已触发", Toast.LENGTH_SHORT).show(); + + // 这里可以添加实际的扫码逻辑 + // 例如:启动扫码Activity或显示扫码界面 + + // 显示扫码状态 + if (layoutCompareStatus != null) { + layoutCompareStatus.setVisibility(View.VISIBLE); + textCompareStatus.setTextColor(Color.parseColor("#009874")); + textCompareStatus.setText("请使用小程序扫码上传人脸"); + + // 3秒后隐藏状态提示 + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + if (layoutCompareStatus != null) { + layoutCompareStatus.setVisibility(View.GONE); + } + } + }, 3000); + } + } + + /** + * 处理扫码开门点击事件 + */ + private void handleScanDoorQRCodeClick() { + LogManager.logInfo(TAG, "用户点击扫码开门"); + Toast.makeText(this, "扫码开门功能已触发", Toast.LENGTH_SHORT).show(); + + // 这里可以添加实际的扫码开门逻辑 + // 例如:启动扫码Activity或显示扫码界面 + + // 显示扫码状态 + if (layoutCompareStatus != null) { + layoutCompareStatus.setVisibility(View.VISIBLE); + textCompareStatus.setTextColor(Color.parseColor("#009874")); + textCompareStatus.setText("请扫描二维码开门"); + + // 3秒后隐藏状态提示 + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + if (layoutCompareStatus != null) { + layoutCompareStatus.setVisibility(View.GONE); + } + } + }, 3000); + } + } + + /** + * 处理验证码开门点击事件 + */ + private void handleVerificationCodeClick() { + LogManager.logInfo(TAG, "用户点击验证码开门"); + Toast.makeText(this, "验证码开门功能已触发", Toast.LENGTH_SHORT).show(); + + // 这里可以添加实际的验证码开门逻辑 + // 例如:弹出输入验证码的对话框 + + // 显示状态提示 + if (layoutCompareStatus != null) { + layoutCompareStatus.setVisibility(View.VISIBLE); + textCompareStatus.setTextColor(Color.parseColor("#009874")); + textCompareStatus.setText("请输入验证码开门"); + + // 3秒后隐藏状态提示 + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + if (layoutCompareStatus != null) { + layoutCompareStatus.setVisibility(View.GONE); + } + } + }, 3000); + } + } + + /** + * 处理扫码器开门点击事件 + */ + private void handleScannerDoorClick() { + LogManager.logInfo(TAG, "用户点击扫码器开门"); + Toast.makeText(this, "扫码器开门功能已触发", Toast.LENGTH_SHORT).show(); + + // 这里可以添加实际的扫码器开门逻辑 + // 例如:启动扫码器Activity或显示扫码器界面 + + // 显示状态提示 + if (layoutCompareStatus != null) { + layoutCompareStatus.setVisibility(View.VISIBLE); + textCompareStatus.setTextColor(Color.parseColor("#009874")); + textCompareStatus.setText("请使用扫码器开门"); + + // 3秒后隐藏状态提示 + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + if (layoutCompareStatus != null) { + layoutCompareStatus.setVisibility(View.GONE); + } + } + }, 3000); } } diff --git a/app/src/main/res/drawable/circle_background.xml b/app/src/main/res/drawable/circle_background.xml new file mode 100644 index 0000000..4ccdc73 --- /dev/null +++ b/app/src/main/res/drawable/circle_background.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_placeholder_circle.xml b/app/src/main/res/drawable/ic_placeholder_circle.xml new file mode 100644 index 0000000..1cbd534 --- /dev/null +++ b/app/src/main/res/drawable/ic_placeholder_circle.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_placeholder_qrcode.xml b/app/src/main/res/drawable/ic_placeholder_qrcode.xml new file mode 100644 index 0000000..adc871f --- /dev/null +++ b/app/src/main/res/drawable/ic_placeholder_qrcode.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rounded_square_background.xml b/app/src/main/res/drawable/rounded_square_background.xml new file mode 100644 index 0000000..210728a --- /dev/null +++ b/app/src/main/res/drawable/rounded_square_background.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_oxface_online.xml b/app/src/main/res/layout/activity_oxface_online.xml index f8a0502..4cdab2b 100644 --- a/app/src/main/res/layout/activity_oxface_online.xml +++ b/app/src/main/res/layout/activity_oxface_online.xml @@ -216,4 +216,149 @@ android:textSize="20sp" /> + + + + + + + + + + + + + + + + + + + + + + + + + +