Browse Source

add bottom view in face activity

main
MTing 2 weeks ago
parent
commit
6c4e199474
  1. 2
      app/src/main/java/com/ouxuan/oxface/MainActivity.java
  2. 405
      app/src/main/java/com/ouxuan/oxface/OXFaceOnlineActivity.java
  3. 5
      app/src/main/res/drawable/circle_background.xml
  4. 5
      app/src/main/res/drawable/ic_placeholder_circle.xml
  5. 49
      app/src/main/res/drawable/ic_placeholder_qrcode.xml
  6. 6
      app/src/main/res/drawable/rounded_square_background.xml
  7. 145
      app/src/main/res/layout/activity_oxface_online.xml

2
app/src/main/java/com/ouxuan/oxface/MainActivity.java

@ -112,7 +112,7 @@ public class MainActivity extends AppCompatActivity {
// 设置长按登录按钮显示日志路径信息调试功能 // 设置长按登录按钮显示日志路径信息调试功能
setupLogPathDebug(); setupLogPathDebug();
//切换第六批设备
//切换第六批设备0-5
switchCameraByDeviceType(5); switchCameraByDeviceType(5);
} }

405
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 long searshTime;
private boolean isCompareCheck = false; 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 @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -167,105 +178,103 @@ public class OXFaceOnlineActivity extends BaseActivity implements View.OnClickLi
ImageView mButReturn = findViewById(R.id.btn_back); ImageView mButReturn = findViewById(R.id.btn_back);
mButReturn.setOnClickListener(this); 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); layoutCompareStatus = findViewById(R.id.layout_compare_status);
if (layoutCompareStatus != null) { if (layoutCompareStatus != null) {
layoutCompareStatus.setVisibility(View.GONE); layoutCompareStatus.setVisibility(View.GONE);
} }
textCompareStatus = findViewById(R.id.text_compare_status); 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, testPopWindow = new TestPopWindow(this,
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
testPopWindow.setmOnClickFinance(new TestPopWindow.OnClickFinance() { testPopWindow.setmOnClickFinance(new TestPopWindow.OnClickFinance() {
@ -399,6 +408,224 @@ public class OXFaceOnlineActivity extends BaseActivity implements View.OnClickLi
int id = view.getId(); int id = view.getId();
if (id == R.id.btn_back) { if (id == R.id.btn_back) {
finish(); 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);
} }
} }

5
app/src/main/res/drawable/circle_background.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#FFFFFF" />
</shape>

5
app/src/main/res/drawable/ic_placeholder_circle.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#EEEEEE" />
</shape>

49
app/src/main/res/drawable/ic_placeholder_qrcode.xml

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#000000"
android:pathData="M3,3h18v18h-18z"/>
<path
android:fillColor="#FFFFFF"
android:pathData="M4,4h2v2h-2z"/>
<path
android:fillColor="#FFFFFF"
android:pathData="M8,4h2v2h-2z"/>
<path
android:fillColor="#FFFFFF"
android:pathData="M12,4h2v2h-2z"/>
<path
android:fillColor="#FFFFFF"
android:pathData="M16,4h2v2h-2z"/>
<path
android:fillColor="#FFFFFF"
android:pathData="M4,8h2v2h-2z"/>
<path
android:fillColor="#FFFFFF"
android:pathData="M12,8h2v2h-2z"/>
<path
android:fillColor="#FFFFFF"
android:pathData="M16,8h2v2h-2z"/>
<path
android:fillColor="#FFFFFF"
android:pathData="M4,12h2v2h-2z"/>
<path
android:fillColor="#FFFFFF"
android:pathData="M8,12h2v2h-2z"/>
<path
android:fillColor="#FFFFFF"
android:pathData="M16,12h2v2h-2z"/>
<path
android:fillColor="#FFFFFF"
android:pathData="M4,16h2v2h-2z"/>
<path
android:fillColor="#FFFFFF"
android:pathData="M12,16h2v2h-2z"/>
<path
android:fillColor="#FFFFFF"
android:pathData="M16,16h2v2h-2z"/>
</vector>

6
app/src/main/res/drawable/rounded_square_background.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FFFFFF" />
<corners android:radius="4dp" />
</shape>

145
app/src/main/res/layout/activity_oxface_online.xml

@ -216,4 +216,149 @@
android:textSize="20sp" /> android:textSize="20sp" />
</RelativeLayout> </RelativeLayout>
<!-- 底部覆盖层,包含按钮和二维码区域 -->
<RelativeLayout
android:id="@+id/bottom_overlay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#80000000">
<!-- 二维码区域 - 添加在底部按钮上方 -->
<LinearLayout
android:id="@+id/qrcode_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:padding="15dp">
<!-- 左侧: 新用户扫码上传人脸 - 圆形小程序码 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:id="@+id/img_mini_program_code"
android:layout_width="70dp"
android:layout_height="70dp"
android:src="@drawable/ic_placeholder_circle"
android:background="@drawable/circle_background" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="新用户扫码上传人脸"
android:textColor="#FFFFFF"
android:textSize="12sp"
android:layout_marginTop="5dp" />
</LinearLayout>
<!-- 中间: 扫码开门 - 正方形二维码 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:id="@+id/img_scan_door_qrcode"
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/ic_placeholder_qrcode"
android:background="@drawable/rounded_square_background" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="扫码开门"
android:textColor="#FFFFFF"
android:textSize="12sp"
android:layout_marginTop="5dp" />
</LinearLayout>
<!-- 右侧: 两个按钮 - 验证码开门和扫码器开门 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center">
<Button
android:id="@+id/btn_verification_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="验证码开门"
android:textColor="#FFFFFF"
android:background="#4CAF50"
android:layout_marginBottom="10dp"
android:minHeight="40dp"
android:textSize="14sp" />
<Button
android:id="@+id/btn_scanner_door"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="扫码器开门"
android:textColor="#FFFFFF"
android:background="#2196F3"
android:minHeight="40dp"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
<!-- 底部按钮区域 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:weightSum="3"
android:layout_below="@id/qrcode_area"
android:padding="20dp">
<Button
android:id="@+id/button_open_door"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="开门"
android:textSize="18sp"
android:textColor="#FFFFFF"
android:background="#009688"
android:layout_marginEnd="10dp"
android:minHeight="50dp" />
<Button
android:id="@+id/button_scan_qr"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="扫码"
android:textSize="18sp"
android:textColor="#FFFFFF"
android:background="#FF9800"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:minHeight="50dp" />
<Button
android:id="@+id/button_settings"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="设置"
android:textSize="18sp"
android:textColor="#FFFFFF"
android:background="#9C27B0"
android:layout_marginStart="10dp"
android:minHeight="50dp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout> </RelativeLayout>
Loading…
Cancel
Save