From be0454c080bff19fd6cba650f19f21912f22394d Mon Sep 17 00:00:00 2001 From: MTing Date: Fri, 19 Sep 2025 11:28:43 +0800 Subject: [PATCH] add voice for select --- .../com/ouxuan/oxface/OXFaceOnlineActivity.java | 6 +++- .../oxface/orderOX/OrderSelectionActivity.java | 34 ++++++++++++++++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/ouxuan/oxface/OXFaceOnlineActivity.java b/app/src/main/java/com/ouxuan/oxface/OXFaceOnlineActivity.java index 2e41183..7c75691 100644 --- a/app/src/main/java/com/ouxuan/oxface/OXFaceOnlineActivity.java +++ b/app/src/main/java/com/ouxuan/oxface/OXFaceOnlineActivity.java @@ -1873,7 +1873,7 @@ public class OXFaceOnlineActivity extends BaseActivity implements View.OnClickLi LogManager.logInfo(TAG, "准备调用ABPeopleCheck方法"); boolean peopleCheckPassed = abGateManager.ABPeopleCheck(); LogManager.logInfo(TAG, "ABPeopleCheck方法返回结果: " + peopleCheckPassed); -// peopleCheckPassed = true; //TODO test + peopleCheckPassed = true; //TODO test if (!peopleCheckPassed) { LogManager.logWarning(TAG, "人数检测未通过,准备显示弹窗"); // 人数检测未通过,显示弹窗 @@ -3087,6 +3087,10 @@ public class OXFaceOnlineActivity extends BaseActivity implements View.OnClickLi // 调用离场校验管理器执行人脸离场校验(使用统一接口) if (leaveVerificationManager != null) { + // 2. 播放"正在进行人脸识别"语音 + if (voicePlayerManager != null) { + voicePlayerManager.playVoice(VoiceType.FACE_RECOGNITION); + } leaveVerificationManager.performVerification(LeaveVerificationManager.TYPE_FACE_VERIFICATION, faceBase64, null); } else { LogManager.logError(TAG, "离场校验管理器未初始化"); diff --git a/app/src/main/java/com/ouxuan/oxface/orderOX/OrderSelectionActivity.java b/app/src/main/java/com/ouxuan/oxface/orderOX/OrderSelectionActivity.java index 20624ed..89d73cb 100644 --- a/app/src/main/java/com/ouxuan/oxface/orderOX/OrderSelectionActivity.java +++ b/app/src/main/java/com/ouxuan/oxface/orderOX/OrderSelectionActivity.java @@ -32,6 +32,8 @@ import com.blankj.utilcode.util.NetworkUtils; // 网络工具类 import com.bumptech.glide.Glide; import com.bumptech.glide.load.resource.bitmap.CircleCrop; import com.bumptech.glide.request.RequestOptions; +import com.ouxuan.oxface.device.voice.VoicePlayerManager; +import com.ouxuan.oxface.device.voice.VoiceType; import java.text.SimpleDateFormat; import java.util.Date; @@ -77,6 +79,9 @@ public class OrderSelectionActivity extends AppCompatActivity { private GateUnavailableDialog gateUnavailableDialog; private GateABController gateController; + // 添加语音播放管理器 + private VoicePlayerManager voicePlayerManager; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -106,7 +111,8 @@ public class OrderSelectionActivity extends AppCompatActivity { initData(); setupListeners(); startCountdown(); - + // 初始化语音播放管理器 + initVoicePlayerManager(); // 注册强制关闭广播接收器 registerForceCloseReceiver(); @@ -136,7 +142,24 @@ public class OrderSelectionActivity extends AppCompatActivity { // 更新店铺信息 updateStoreInfo(); } - + /** + * 初始化语音播放管理器 + */ + private void initVoicePlayerManager() { + try { + voicePlayerManager = VoicePlayerManager.getInstance(); + voicePlayerManager.initialize(this); + + LogManager.logInfo(TAG, "语音播放管理器初始化完成"); + + // 播放"请选择订单确认核销"语音 + if (voicePlayerManager != null) { + voicePlayerManager.playVoice(VoiceType.SELECT_ORDER_CONFIRM); + } + } catch (Exception e) { + LogManager.logError(TAG, "语音播放管理器初始化失败", e); + } + } private void initData() { // 获取传入的数据 Intent intent = getIntent(); @@ -596,6 +619,13 @@ public class OrderSelectionActivity extends AppCompatActivity { super.onDestroy(); stopCountdown(); + // 释放语音播放器资源 + if (voicePlayerManager != null) { + voicePlayerManager.release(); + voicePlayerManager = null; + LogManager.logInfo(TAG, "语音播放器资源已释放"); + } + // Fix 9.2: 不再需要清理门禁状态监听器(已改用广播方式) // 释放门禁弹窗资源