Przeglądaj źródła

upgrade:代码优化

xwh 1 tydzień temu
rodzic
commit
9d130b1acd

+ 6 - 6
app/src/main/java/com/hanghui/senic/baiduface/BaiduFaceMainActivity.java

@@ -701,21 +701,21 @@ public class BaiduFaceMainActivity extends BaseActivity {
     /**
      * 刷新当前人数
      */
-   public Runnable flushPeopleRunnable=new Runnable() {
+    public Runnable flushPeopleRunnable = new Runnable() {
         @Override
         public void run() {
-            if(!ConfigManager.getAuthenticationBeanListBean().getShowPersonalNumSwitch()){
+            if (!ConfigManager.getAuthenticationBeanListBean().getShowPersonalNumSwitch()) {
                 AppHandler.getHandler().removeCallbacks(flushPeopleRunnable);
-                if(llNumPeople!=null){
+                if (llNumPeople != null) {
                     llNumPeople.setVisibility(View.INVISIBLE);
                 }
                 return;
-            }else if(llNumPeople!=null){
+            } else if (llNumPeople != null) {
                 llNumPeople.setVisibility(View.VISIBLE);
             }
             if (mPeopleCountFuture3 != null && !mPeopleCountFuture3.isDone()) {
                 AppHandler.getHandler().removeCallbacks(flushPeopleRunnable);
-                AppHandler.getHandler().postDelayed(flushPeopleRunnable,1000);
+                AppHandler.getHandler().postDelayed(flushPeopleRunnable, 1000);
                 return;
             }
             if (mPeopleCountExecutorService == null) {
@@ -728,7 +728,7 @@ public class BaiduFaceMainActivity extends BaseActivity {
                         tvNumPeople.setText("" + dataList.size());
                     }
                     AppHandler.getHandler().removeCallbacks(flushPeopleRunnable);
-                    AppHandler.getHandler().postDelayed(flushPeopleRunnable,1000);
+                    AppHandler.getHandler().postDelayed(flushPeopleRunnable, 1000);
                 });
             });
         }

+ 215 - 259
app/src/main/java/com/hanghui/senic/baiduface/view/BaiduResultView.java

@@ -7,7 +7,6 @@ import android.os.Handler;
 import android.os.Looper;
 import android.text.TextUtils;
 import android.util.AttributeSet;
-import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.FrameLayout;
@@ -51,37 +50,37 @@ import java.util.concurrent.Future;
 
 /**
  * Description: 悬浮无核验版本。主要解决结果页面卡顿问题
+ *
  * @author xwh
  * time 2024/12/24
  **/
-public class BaiduResultView  extends LinearLayout  {
+public class BaiduResultView extends LinearLayout {
 
-    private ImageView ivPhoto,iv_through,iv_top_bg;
-    private TextView tv_name,tv_card,tv_phone,tv_through;
-    private LinearLayout ll_outcome_masked;
-    private FrameLayout fl_user_info;
-
-
-    private LinearLayout ll_count_down;
-    private TextView tv_count_down;
+    private final String TAG = BaiduResultView.class.getName();
+    private ImageView ivPhoto, ivThrough, ivTopBg;
+    private TextView tvName, tvCard, tvPhone, tvThrough;
+    private LinearLayout llOutcomeMasked;
+    private FrameLayout flUserInfo;
+    private LinearLayout llCountDown;
+    private TextView tvCountDown;
 
     private BaiduFaceResultStateCallback baiduFaceResultStateCallback;
-    
+
     private volatile long oneToNFailStartDetectionTime = 0L;//1:N刷脸连续失败帧起始时间(用于提示1:N比对失败结果页)
     private Future mFuture; //开门线程
-    private volatile  RequestOptions options ;
+    private volatile RequestOptions options;
 
     private volatile PersonCardWaitRunnable personCardWaitRunnable; //1:1比对失败后执行的runnable
     //判断1:1人脸连续未通过的runnable是否启动
     private volatile boolean isCreatedPersonCardRunnable = false;
     private volatile CountDownTimer oneToOneWaitCountDownTimer; //1:1比对等待倒计时
-    private Handler mHandler =new Handler(Looper.getMainLooper());
+    private Handler mHandler = new Handler(Looper.getMainLooper());
 
     private Handler getmHandler() {
-        if(mHandler==null){
-            synchronized (BaiduResultView.class){
-                if(mHandler==null){
-                    mHandler=new android.os.Handler(Looper.getMainLooper());
+        if (mHandler == null) {
+            synchronized (BaiduResultView.class) {
+                if (mHandler == null) {
+                    mHandler = new android.os.Handler(Looper.getMainLooper());
                 }
             }
         }
@@ -100,7 +99,7 @@ public class BaiduResultView  extends LinearLayout  {
     };
 
     private volatile CountDownTimer closeResultPageCountDownTimer; //关闭页面倒计时
-    private volatile boolean isCountDowning=false;  //关闭页面倒计时是否正在执行
+    private volatile boolean isCountDowning = false;  //关闭页面倒计时是否正在执行
 
     public BaiduResultView(Context context) {
         super(context);
@@ -122,77 +121,69 @@ public class BaiduResultView  extends LinearLayout  {
         init(context);
     }
 
-    private void init(Context context){
+    private void init(Context context) {
         initView(context);
         initEvent();
         initData();
     }
 
     /**
-     *
      * @author xwh
      * Time 2024/12/27
      * Description: 初始化控件
-     *
-    **/
-    private void initView(Context context){
+     **/
+    private void initView(Context context) {
 
         LayoutInflater.from(context).inflate(R.layout.layout_baidu_result_view, this);
-        ivPhoto=findViewById(R.id.iv_photo);
-        tv_name=findViewById(R.id.tv_name);
-        tv_card=findViewById(R.id.tv_card);
-        tv_phone=findViewById(R.id.tv_phone);
-        iv_through=findViewById(R.id.iv_through);
-        iv_top_bg=findViewById(R.id.iv_top_bg);
-        tv_through=findViewById(R.id.tv_through);
-        fl_user_info=findViewById(R.id.fl_user_info);
-        ll_outcome_masked=findViewById(R.id.ll_outcome_masked);
-        tv_count_down=findViewById(R.id.tv_count_down);
-        ll_count_down = findViewById(R.id.ll_count_down);
-        ImageLoaderUtils.loadRes(R.mipmap.mainactivity_aicon,iv_through);
-        ImageLoaderUtils.loadRes(R.mipmap.blue_background_gradient,iv_top_bg);
+        ivPhoto = findViewById(R.id.iv_photo);
+        tvName = findViewById(R.id.tv_name);
+        tvCard = findViewById(R.id.tv_card);
+        tvPhone = findViewById(R.id.tv_phone);
+        ivThrough = findViewById(R.id.iv_through);
+        ivTopBg = findViewById(R.id.iv_top_bg);
+        tvThrough = findViewById(R.id.tv_through);
+        flUserInfo = findViewById(R.id.fl_user_info);
+        llOutcomeMasked = findViewById(R.id.ll_outcome_masked);
+        tvCountDown = findViewById(R.id.tv_count_down);
+        llCountDown = findViewById(R.id.ll_count_down);
+        ImageLoaderUtils.loadRes(R.mipmap.mainactivity_aicon, ivThrough);
+        ImageLoaderUtils.loadRes(R.mipmap.blue_background_gradient, ivTopBg);
     }
 
     /**
-     *
      * @author xwh
      * Time 2024/12/27
      * Description: 事件
-     *
-    **/
-    private void initEvent(){
-        ll_count_down.setOnClickListener(new OnClickListener() {
+     **/
+    private void initEvent() {
+        llCountDown.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
-                if(DoubClickUtils.onDoubClick()){
+                if (DoubClickUtils.onDoubClick()) {
                     return;
                 }
                 closePage();
             }
         });
     }
-    
+
     /**
-     *
      * @author xwh
      * Time 2024/12/27
      * Description: 初始化数据
-     *
-    **/
-    private void initData(){
+     **/
+    private void initData() {
         options = new RequestOptions().bitmapTransform(new RoundedCorners(30));
         options.diskCacheStrategy(DiskCacheStrategy.NONE).skipMemoryCache(true);
     }
 
 
     /**
-     *
      * @author xwh
      * Time 2024/12/27
      * Description: 百度无核验版本结果页
-     *
-    **/
-    public void baiDuFaceNoVerificationResultPage(LivenessModel livenessModel,int featureCheckMode) {
+     **/
+    public void baiDuFaceNoVerificationResultPage(LivenessModel livenessModel, int featureCheckMode) {
         // 设备已过期,不做任何处理
         if (DeviceExpireManager.getInstance().isDeviceExpire()) {
             return;
@@ -211,33 +202,29 @@ public class BaiduResultView  extends LinearLayout  {
     }
 
     /**
-     *
      * @author xwh
      * Time 2024/12/27
      * Description: 1:N结果处理
-     *
-    **/
-    private void oneToN(final LivenessModel livenessModel){
-        if(livenessModel ==null){
+     **/
+    private void oneToN(final LivenessModel livenessModel) {
+        if (livenessModel == null) {
             return;
         }
         final User user = livenessModel.getUser();
-        if(user !=null){ //检测到用户
+        if (user != null) { //检测到用户
             oneToNFailStartDetectionTime = 0L; //检测到用户,重置字段
             doScanFaceOneToNSuccess(livenessModel);
-        }else{
+        } else {
             doScanFaceOneToNFailed(livenessModel);
         }
     }
-    
+
     /**
-     *
      * @author xwh
      * Time 2024/12/27
      * Description: 1:1结果处理
-     *
-    **/
-    private void oneToOne(final LivenessModel livenessModel){
+     **/
+    private void oneToOne(final LivenessModel livenessModel) {
         if (livenessModel == null) {
             return;
         }
@@ -257,14 +244,12 @@ public class BaiduResultView  extends LinearLayout  {
         }
 
     }
-    
+
     /**
-     *
      * @author xwh
      * Time 2024/12/27
      * Description: 1:N刷脸成功后续逻辑
-     *
-    **/
+     **/
     private void doScanFaceOneToNSuccess(LivenessModel livenessModel) {
         if (livenessModel == null) {
             return;
@@ -274,29 +259,29 @@ public class BaiduResultView  extends LinearLayout  {
             return;
         }
         //同人脸判断是否在规定时间内
-        if (userIdUniqueId.equals(StringIsNull.ReturnString(user.getUserId()))){
+        if (userIdUniqueId.equals(StringIsNull.ReturnString(user.getUserId()))) {
             return;
         }
-        if(baiduFaceResultStateCallback!=null){
+        if (baiduFaceResultStateCallback != null) {
             baiduFaceResultStateCallback.invokeStopVerify();
         }
         TaskStatus.setStatus(TaskStatus.TASK_STATUS_FACE);
         TaskStatus.setCurrentTask(TaskStatus.CURRENT_TASSK_LOCAL_FACE);
         BDFaceImageInstance rgbImage = livenessModel.getBdFaceImageInstance();
-        Bitmap bitmap =null;
+        Bitmap bitmap = null;
         if (rgbImage != null) {
             bitmap = BitmapUtils.getInstaceBmp(rgbImage);
         }
         //重置现场照片、姓名、身份证号等用户信息
-        setUserInfoToUserInfoManager(livenessModel,bitmap);
+        setUserInfoToUserInfoManager(livenessModel, bitmap);
         DataReturns.getInstance().clearData();
-        
-        if(oneToNPreconditions(user)){
+
+        if (oneToNPreconditions(user)) {
             //TODO 刷脸通过前置条件,包括黑名单、有效时限等判断条件
             return;
         }
         //判断1:N刷脸 同人脸间隔
-        if(ConfigManager.getAuthenticationBeanListBean().getSameFaceInterval() > 0){
+        if (ConfigManager.getAuthenticationBeanListBean().getSameFaceInterval() > 0) {
             userIdUniqueId = StringIsNull.ReturnString(user.getUserId());
             //销毁延时器,重新计时
             AppHandler.getHandler().removeCallbacks(userIdUniqueIdRunnable);
@@ -305,18 +290,19 @@ public class BaiduResultView  extends LinearLayout  {
         }
 
         Constants.IDCARD_TYPE = 0;
-        AuthenticationBean.DataDTO dataDTO= ConfigManager.getAuthenticationBean().getData().get(0);
-        RelaysAndLedUtile.getInstance().openDoor(dataDTO.getUseSerialPort(),dataDTO.getSignalNo());
+        AuthenticationBean.DataDTO dataDTO = ConfigManager.getAuthenticationBean().getData().get(0);
+        RelaysAndLedUtile.getInstance().openDoor(dataDTO.getUseSerialPort(), dataDTO.getSignalNo());
         ThreadPoolManager.getInstance().execute(new Runnable() {
             @Override
             public void run() {
-                String speak=   ConfigManager.getAuthenticationBeanListBean().getSucVoice();
-                if(TextUtils.isEmpty(speak)){
-                    speak ="请通行";
+                String speak = ConfigManager.getAuthenticationBeanListBean().getSucVoice();
+                if (TextUtils.isEmpty(speak)) {
+                    speak = "请通行";
                 }
                 MTTSManager.getInstance().speak(speak);
             }
         });
+        AppLogUtils.i(true, TAG, "doScanFaceOneToNSuccess:现场照:" + bitmap);
         if (bitmap != null) {
             HttpRequest.getInstance().setEventRecords(TaskStatus.currentTask,
                     UserInfoManager.getInstance().getUserInformationBean().getName(),
@@ -325,18 +311,16 @@ public class BaiduResultView  extends LinearLayout  {
                     UserInfoManager.getInstance().getUserInformationBean().getMobile(), true,
                     0,
                     UserInfoManager.getInstance().getUserInformationBean().getCardIdEx(),
-                    UserInfoManager.getInstance().getUserInformationBean().getUserId(),bitmap);
+                    UserInfoManager.getInstance().getUserInformationBean().getUserId(), bitmap);
         }
         showSuccessUI(bitmap);
     }
 
     /**
-     *
      * @author xwh
      * Time 2024/12/27
      * Description: 1:N刷脸失败后续逻辑
-     *
-    **/
+     **/
     private void doScanFaceOneToNFailed(LivenessModel livenessModel) {
         if (ConfigManager.getAuthenticationBeanListBean().getOneToNFailShowTip()) {
             long currentTime = System.currentTimeMillis();
@@ -360,36 +344,37 @@ public class BaiduResultView  extends LinearLayout  {
                     failText = ConfigManager.getAuthenticationBeanListBean().getFailText();
                 }
 
-                String openVoiceMsg =  ConfigManager.getAuthenticationBeanListBean().getFailVoice();
+                String openVoiceMsg = ConfigManager.getAuthenticationBeanListBean().getFailVoice();
                 if (StringIsNull.IsStringNull(openVoiceMsg)) {
                     openVoiceMsg = failText;
                 }
                 isCreatedPersonCardRunnable = false;
                 oneToNFailStartDetectionTime = 0L;
-                showFailUI(failText,openVoiceMsg);
+                showFailUI(failText, openVoiceMsg);
             }
         }
     }
 
 
     /**
-     *
      * @author xwh
      * Time 2024/12/27
      * Description: 1:N 刷脸展示前置条件
-     *
-    **/
-    private boolean oneToNPreconditions(User user){
+     **/
+    private boolean oneToNPreconditions(User user) {
         //判断用户是否在有效期内
         if (ConfigManager.getAuthenticationBeanListBean().getValidTimeSwitch() && isUserExpire(user)) {
+            AppLogUtils.i(true, TAG, "判断用户不在有效期内:" + user == null ? "" : user.getUserName());
             return true;
         }
         //判断黑名单中是否存在该用户
         if (BlacklistManager.getInstance().isInBlacklist(user.getIdNumber(), user.getPhone(), new BaiDuFaceResultPageListener() {
             @Override
-            public void showUI(String msgStr,String voiceStr) {
-                showFailUI(msgStr,voiceStr);
-            }})) {
+            public void showUI(String msgStr, String voiceStr) {
+                showFailUI(msgStr, voiceStr);
+            }
+        })) {
+            AppLogUtils.i(true, TAG, "判断黑名单中:" + user == null ? "" : user.getIdNumber());
             return true;
         }
 
@@ -397,20 +382,20 @@ public class BaiduResultView  extends LinearLayout  {
         if (ConfigManager.isAgeLimitOpen(user.getIdNumber(), user.getUserId(), new BaiDuFaceResultPageListener() {
             @Override
             public void showUI(String msgStr, String voiceStr) {
-                showFailUI(msgStr,voiceStr);
-            }})) {
+                showFailUI(msgStr, voiceStr);
+            }
+        })) {
+            AppLogUtils.i(true, TAG, "年龄限制:" + user == null ? "" : user.getIdNumber());
             return true;
         }
         return false;
     }
 
     /**
-     *
      * @author xwh
      * Time 2024/12/27
      * Description: 1:1人脸比对逻辑
-     *
-    **/
+     **/
     private void doPersonCardComparison(float compareScore, float idThreshold, LivenessModel livenessModel) {
         if (compareScore >= idThreshold) {
             UserInfoManager.getInstance().updateUserInformationBean_VerifyScore(compareScore);
@@ -427,44 +412,41 @@ public class BaiduResultView  extends LinearLayout  {
 
 
     /**
-     *
      * @author xwh
      * Time 2024/12/27
      * Description: 删除1:1比对失败后执行的runnable
-     *
-    **/
-    private void removePersonCardWaitRunnable(){
-        if(personCardWaitRunnable!=null){
+     **/
+    private void removePersonCardWaitRunnable() {
+        if (personCardWaitRunnable != null) {
             getmHandler().removeCallbacks(personCardWaitRunnable);
         }
     }
 
     /**
-     *
      * @author xwh
      * Time 2024/12/30
      * Description: 1:1比对成功
-     *
-    **/
-    private void doPersonCardResultSuccess(LivenessModel livenessModel){
-        if(baiduFaceResultStateCallback!=null){
+     **/
+    private void doPersonCardResultSuccess(LivenessModel livenessModel) {
+        if (baiduFaceResultStateCallback != null) {
             baiduFaceResultStateCallback.invokeStopVerify();
         }
         removePersonCardWaitRunnable();
-        AuthenticationBean.DataDTO dataDTO= ConfigManager.getAuthenticationBean().getData().get(0);
-        RelaysAndLedUtile.getInstance().openDoor(dataDTO.getUseSerialPort(),dataDTO.getSignalNo());
+        AuthenticationBean.DataDTO dataDTO = ConfigManager.getAuthenticationBean().getData().get(0);
+        RelaysAndLedUtile.getInstance().openDoor(dataDTO.getUseSerialPort(), dataDTO.getSignalNo());
         ThreadPoolManager.getInstance().execute(new Runnable() {
             @Override
             public void run() {
-                String speak=   ConfigManager.getAuthenticationBeanListBean().getSucVoice();
-                if(TextUtils.isEmpty(speak)){
-                    speak ="请通行";
+                String speak = ConfigManager.getAuthenticationBeanListBean().getSucVoice();
+                if (TextUtils.isEmpty(speak)) {
+                    speak = "请通行";
                 }
                 MTTSManager.getInstance().speak(speak);
             }
         });
         BDFaceImageInstance rgbImage = livenessModel.getBdFaceImageInstance();
         Bitmap bitmap = null;
+        AppLogUtils.i(true, TAG, "doPersonCardResultSuccess:现场照:" + bitmap);
         if (rgbImage != null) {
             bitmap = BitmapUtils.getInstaceBmp(rgbImage);
             HttpRequest.getInstance().setEventRecords(TaskStatus.currentTask,
@@ -474,26 +456,19 @@ public class BaiduResultView  extends LinearLayout  {
                     UserInfoManager.getInstance().getUserInformationBean().getMobile(), true,
                     0,
                     UserInfoManager.getInstance().getUserInformationBean().getCardIdEx(),
-                    UserInfoManager.getInstance().getUserInformationBean().getUserId(),bitmap);
+                    UserInfoManager.getInstance().getUserInformationBean().getUserId(), bitmap);
         }
         showSuccessUI(bitmap);
     }
 
 
-
-
-
-
-
     /**
-     *
      * @author xwh
      * Time 2024/12/27
      * Description: 显示刷脸通过结果页面UI
-     *
-    **/
-    private void showSuccessUI(Bitmap bitmap){
-        AuthenticationBean.DataDTO dataDTO= ConfigManager.getAuthenticationBean().getData().get(0);
+     **/
+    private void showSuccessUI(Bitmap bitmap) {
+        AuthenticationBean.DataDTO dataDTO = ConfigManager.getAuthenticationBean().getData().get(0);
 
         String name = UserInfoManager.getInstance().getUserInformationBean().getName();
         String idCard = UserInfoManager.getInstance().getUserInformationBean().getIdNumber();
@@ -535,53 +510,50 @@ public class BaiduResultView  extends LinearLayout  {
             name = StringUtils.defaultDesensitization(name);
         }
 
-        final String finalName = name ;
-        final String finalidCard=idCard;
-        final String finalPhone=phone;
+        final String finalName = name;
+        final String finalidCard = idCard;
+        final String finalPhone = phone;
         final Bitmap finalBitmap = bitmap;
         AppHandler.getHandler().post(new Runnable() {
             @Override
             public void run() {
                 setVisibility(View.VISIBLE);
-                setViewVisibility(fl_user_info,ConfigManager.isShowResultPageUserInfo());
-                setViewVisibility(ivPhoto,ConfigManager.isSuccessShowPersenalInfoPhoto);
-                setViewVisibility(tv_name,ConfigManager.isSuccessShowPersenalInfoName);
-                setViewVisibility(tv_card,ConfigManager.isSuccessShowPersenalInfoIDCard);
-                setViewVisibility(tv_phone,ConfigManager.isSuccessShowPersenalInfoPhone);
-                String sucText=   ConfigManager.getAuthenticationBeanListBean().getSucText();
-                if(TextUtils.isEmpty(sucText)){
-                    sucText="请通行";
+                setViewVisibility(flUserInfo, ConfigManager.isShowResultPageUserInfo());
+                setViewVisibility(ivPhoto, ConfigManager.isSuccessShowPersenalInfoPhoto);
+                setViewVisibility(tvName, ConfigManager.isSuccessShowPersenalInfoName);
+                setViewVisibility(tvCard, ConfigManager.isSuccessShowPersenalInfoIDCard);
+                setViewVisibility(tvPhone, ConfigManager.isSuccessShowPersenalInfoPhone);
+                String sucText = ConfigManager.getAuthenticationBeanListBean().getSucText();
+                if (TextUtils.isEmpty(sucText)) {
+                    sucText = "请通行";
                 }
-                if(finalBitmap !=null) {
+                if (finalBitmap != null) {
                     ImageLoaderUtils.loadImage(finalBitmap, ivPhoto, options);
-                }else{
+                } else {
                     ivPhoto.setVisibility(GONE);
                 }
-                iv_through.setVisibility(VISIBLE);
-                ImageLoaderUtils.loadRes(R.mipmap.mainactivity_aicon,iv_through);
-                ImageLoaderUtils.loadRes(R.mipmap.blue_background_gradient,iv_top_bg);
-                ll_outcome_masked.setBackgroundResource(R.drawable.outcome_masked_blues);
-                tv_name.setText(finalName);
-                tv_card.setText(finalidCard);
-                tv_phone.setText(finalPhone);
-                tv_through.setText(sucText);
-                tv_through.setTextColor(ContextCompat.getColor(getContext(),R.color.f1677FF));
+                ivThrough.setVisibility(VISIBLE);
+                ImageLoaderUtils.loadRes(R.mipmap.mainactivity_aicon, ivThrough);
+                ImageLoaderUtils.loadRes(R.mipmap.blue_background_gradient, ivTopBg);
+                llOutcomeMasked.setBackgroundResource(R.drawable.outcome_masked_blues);
+                tvName.setText(finalName);
+                tvCard.setText(finalidCard);
+                tvPhone.setText(finalPhone);
+                tvThrough.setText(sucText);
+                tvThrough.setTextColor(ContextCompat.getColor(getContext(), R.color.f1677FF));
             }
         });
-        int delay=dataDTO.getSuccessPageTime();
+        int delay = dataDTO.getSuccessPageTime();
         delayCloseResultPage(delay);
     }
-    
-   
+
 
     /**
-     *
      * @author xwh
      * Time 2024/12/30
      * Description: 结果页 - 倒计时  启动
-     *
-    **/
-    private void startCountDownTimer(int delay){
+     **/
+    private void startCountDownTimer(int delay) {
         AppHandler.getHandler().post(new Runnable() {
             @Override
             public void run() {
@@ -590,12 +562,12 @@ public class BaiduResultView  extends LinearLayout  {
                         return;
                     }
                     isCountDowning = true;
-                    ll_count_down.setVisibility(VISIBLE);
-                    tv_count_down.setText(delay + "s");
+                    llCountDown.setVisibility(VISIBLE);
+                    tvCountDown.setText(delay + "s");
                     closeResultPageCountDownTimer = new CountDownTimer(delay * 1000, 1000) {
                         public void onTick(long millisUntilFinished) {
                             // 每次间隔,这里更新UI,显示剩余时间
-                            tv_count_down.setText(" "+(millisUntilFinished / 1000) + "s");
+                            tvCountDown.setText(" " + (millisUntilFinished / 1000) + "s");
                         }
 
                         public void onFinish() {
@@ -606,7 +578,7 @@ public class BaiduResultView  extends LinearLayout  {
                     // 开始倒计时
                     closeResultPageCountDownTimer.start();
                 } catch (Exception e) {
-                    isCountDowning=false;
+                    isCountDowning = false;
                     stopCountDownTimer();
                 }
             }
@@ -615,31 +587,29 @@ public class BaiduResultView  extends LinearLayout  {
     }
 
     /**
-     *
      * @author xwh
      * Time 2024/12/30
      * Description: 恢复字段初始值并且隐藏结果页
-     *
-    **/
-    private void closePage(){
+     **/
+    private void closePage() {
         AppHandler.getHandler().post(new Runnable() {
             @Override
             public void run() {
                 isCountDowning = false;
-                ll_count_down.setVisibility(INVISIBLE);
+                llCountDown.setVisibility(INVISIBLE);
                 ivPhoto.setImageResource(0);
-                ll_outcome_masked.setBackgroundResource(0);
-                tv_name.setText("");
-                tv_card.setText("");
-                tv_phone.setText("");
-                tv_through.setText("");
+                llOutcomeMasked.setBackgroundResource(0);
+                tvName.setText("");
+                tvCard.setText("");
+                tvPhone.setText("");
+                tvThrough.setText("");
                 setVisibility(View.INVISIBLE);
-                fl_user_info.setVisibility(INVISIBLE);
-                iv_through.setVisibility(VISIBLE);
+                flUserInfo.setVisibility(INVISIBLE);
+                ivThrough.setVisibility(VISIBLE);
                 getmHandler().removeCallbacksAndMessages(null);
                 isCreatedPersonCardRunnable = false;
-                isCountDowning=false;
-                oneToNFailStartDetectionTime =0L;
+                isCountDowning = false;
+                oneToNFailStartDetectionTime = 0L;
                 TaskStatus.setInitState();
                 UserInfoManager.getInstance().setUserInformationBeanNull();
                 if (baiduFaceResultStateCallback != null) {
@@ -648,20 +618,19 @@ public class BaiduResultView  extends LinearLayout  {
             }
         });
     }
+
     /**
-     *
      * @author xwh
      * Time 2024/9/3
      * Description: 停止倒计时
-     *
      **/
-    private void stopCountDownTimer(){
+    private void stopCountDownTimer() {
         AppHandler.getHandler().post(new Runnable() {
             @Override
             public void run() {
                 if (closeResultPageCountDownTimer != null) {
                     closeResultPageCountDownTimer.cancel();
-                    closeResultPageCountDownTimer=null;
+                    closeResultPageCountDownTimer = null;
                 }
             }
         });
@@ -669,41 +638,37 @@ public class BaiduResultView  extends LinearLayout  {
     }
 
     /**
-     *
      * @author xwh
      * Time 2024/12/30
      * Description: 延迟关闭结果页
-     *
-    **/
-    private void delayCloseResultPage(int delay){
+     **/
+    private void delayCloseResultPage(int delay) {
         startCountDownTimer(delay);
 
     }
 
 
     /**
-     *
      * @author xwh
      * Time 2024/12/30
      * Description: 失败页面
-     *
-    **/
-    public void showFailUI(String msgStr, String voiceStr){
-        
-        if(baiduFaceResultStateCallback!=null){  
+     **/
+    public void showFailUI(String msgStr, String voiceStr) {
+
+        if (baiduFaceResultStateCallback != null) {
             baiduFaceResultStateCallback.invokeStopVerify();
         }
         stopOneToOneCountDownTimer();
-        AuthenticationBean.DataDTO dataDTO= ConfigManager.getAuthenticationBean().getData().get(0);
+        AuthenticationBean.DataDTO dataDTO = ConfigManager.getAuthenticationBean().getData().get(0);
         ThreadPoolManager.getInstance().execute(new Runnable() {
             @Override
             public void run() {
-                String voice=  voiceStr;
-                if(TextUtils.isEmpty(voiceStr)){
-                    voice=ConfigManager.getAuthenticationBeanListBean().getFailVoice();
+                String voice = voiceStr;
+                if (TextUtils.isEmpty(voiceStr)) {
+                    voice = ConfigManager.getAuthenticationBeanListBean().getFailVoice();
                 }
-                if(TextUtils.isEmpty(voice)){
-                   return;
+                if (TextUtils.isEmpty(voice)) {
+                    return;
                 }
                 MTTSManager.getInstance().speak(voice);
             }
@@ -713,46 +678,44 @@ public class BaiduResultView  extends LinearLayout  {
             public void run() {
                 getmHandler().removeCallbacks(personCardWaitRunnable);
                 setVisibility(View.VISIBLE);
-                fl_user_info.setVisibility(INVISIBLE);
-                String sucText=  msgStr;
-                if(TextUtils.isEmpty(msgStr)){
-                    sucText=ConfigManager.getAuthenticationBeanListBean().getFailText();
+                flUserInfo.setVisibility(INVISIBLE);
+                String sucText = msgStr;
+                if (TextUtils.isEmpty(msgStr)) {
+                    sucText = ConfigManager.getAuthenticationBeanListBean().getFailText();
                 }
-                iv_through.setVisibility(VISIBLE);
-                ImageLoaderUtils.loadRes(R.mipmap.mainactivity_erroe,iv_through);
-                ImageLoaderUtils.loadRes(R.mipmap.red_background_gradient,iv_top_bg);
-                ll_outcome_masked.setBackgroundResource(R.drawable.outcome_masked_reds);
-                tv_through.setText(sucText);
-                tv_through.setTextColor(ContextCompat.getColor(getContext(),R.color.fEE4523));
+                ivThrough.setVisibility(VISIBLE);
+                ImageLoaderUtils.loadRes(R.mipmap.mainactivity_erroe, ivThrough);
+                ImageLoaderUtils.loadRes(R.mipmap.red_background_gradient, ivTopBg);
+                llOutcomeMasked.setBackgroundResource(R.drawable.outcome_masked_reds);
+                tvThrough.setText(sucText);
+                tvThrough.setTextColor(ContextCompat.getColor(getContext(), R.color.fEE4523));
             }
         });
-        int delay=dataDTO.getFailPageTime();
+        int delay = dataDTO.getFailPageTime();
         delayCloseResultPage(delay);
 
 
     }
-    
-    
+
+
     /**
-     *
      * @author xwh
      * Time 2024/12/30
      * Description: 显示1:1比对等待时间UI
-     *
-    **/
-    public void showOneToOneComparisonWaitUi(String msgStr,String voiceStr){
-        if(baiduFaceResultStateCallback!=null){
+     **/
+    public void showOneToOneComparisonWaitUi(String msgStr, String voiceStr) {
+        if (baiduFaceResultStateCallback != null) {
             baiduFaceResultStateCallback.invokeStopVerify();
         }
         stopOneToOneCountDownTimer();
         ThreadPoolManager.getInstance().execute(new Runnable() {
             @Override
             public void run() {
-                String voice=  voiceStr;
-                if(TextUtils.isEmpty(voiceStr)){
-                    voice=ConfigManager.getAuthenticationBeanListBean().getOneToOneVoice();
+                String voice = voiceStr;
+                if (TextUtils.isEmpty(voiceStr)) {
+                    voice = ConfigManager.getAuthenticationBeanListBean().getOneToOneVoice();
                 }
-                if(TextUtils.isEmpty(voice)){
+                if (TextUtils.isEmpty(voice)) {
                     return;
                 }
                 MTTSManager.getInstance().speak(voice);
@@ -762,41 +725,39 @@ public class BaiduResultView  extends LinearLayout  {
             @Override
             public void run() {
                 setVisibility(View.VISIBLE);
-                fl_user_info.setVisibility(INVISIBLE);
-                String sucText=  msgStr;
-                if(TextUtils.isEmpty(msgStr)){
-                    sucText=ConfigManager.getAuthenticationBeanListBean().getOneToOneTips();
+                flUserInfo.setVisibility(INVISIBLE);
+                String sucText = msgStr;
+                if (TextUtils.isEmpty(msgStr)) {
+                    sucText = ConfigManager.getAuthenticationBeanListBean().getOneToOneTips();
                 }
-                iv_through.setVisibility(GONE);
-                ImageLoaderUtils.loadRes(R.mipmap.mainactivity_aicon,iv_through);
-                ImageLoaderUtils.loadRes(R.mipmap.blue_background_gradient,iv_top_bg);
-                ll_outcome_masked.setBackgroundResource(R.drawable.outcome_masked_blues);
-                tv_through.setText(sucText);
-                tv_through.setTextColor(ContextCompat.getColor(getContext(),R.color.f1677FF));
+                ivThrough.setVisibility(GONE);
+                ImageLoaderUtils.loadRes(R.mipmap.mainactivity_aicon, ivThrough);
+                ImageLoaderUtils.loadRes(R.mipmap.blue_background_gradient, ivTopBg);
+                llOutcomeMasked.setBackgroundResource(R.drawable.outcome_masked_blues);
+                tvThrough.setText(sucText);
+                tvThrough.setTextColor(ContextCompat.getColor(getContext(), R.color.f1677FF));
             }
         });
-        int delay=ConfigManager.getAuthenticationBean().getData().get(0).getOneToOneTimeout() ;
+        int delay = ConfigManager.getAuthenticationBean().getData().get(0).getOneToOneTimeout();
         startOneToOneCountDownTimer(delay);
     }
 
     /**
-     *
      * @author xwh
      * Time 2024/12/30
      * Description: 启动1:1比对等待倒计时
-     *
      **/
-    private void startOneToOneCountDownTimer(int delay){
+    private void startOneToOneCountDownTimer(int delay) {
         AppHandler.getHandler().post(new Runnable() {
             @Override
             public void run() {
                 try {
-                    ll_count_down.setVisibility(VISIBLE);
-                    tv_count_down.setText(delay + "s");
+                    llCountDown.setVisibility(VISIBLE);
+                    tvCountDown.setText(delay + "s");
                     oneToOneWaitCountDownTimer = new CountDownTimer(delay * 1000, 1000) {
                         public void onTick(long millisUntilFinished) {
                             // 每次间隔,这里更新UI,显示剩余时间
-                            tv_count_down.setText(" "+(millisUntilFinished / 1000) + "s");
+                            tvCountDown.setText(" " + (millisUntilFinished / 1000) + "s");
                         }
 
                         public void onFinish() {
@@ -812,20 +773,19 @@ public class BaiduResultView  extends LinearLayout  {
         });
 
     }
+
     /**
-     *
      * @author xwh
      * Time 2024/12/30
      * Description: 停止1:1比对等待倒计时
-     *
      **/
-    private void stopOneToOneCountDownTimer(){
+    private void stopOneToOneCountDownTimer() {
         AppHandler.getHandler().post(new Runnable() {
             @Override
             public void run() {
                 if (oneToOneWaitCountDownTimer != null) {
                     oneToOneWaitCountDownTimer.cancel();
-                    oneToOneWaitCountDownTimer =null;
+                    oneToOneWaitCountDownTimer = null;
                 }
             }
         });
@@ -833,36 +793,35 @@ public class BaiduResultView  extends LinearLayout  {
     }
 
 
-
-
     /**
      * 1:N、1:1 刷脸失败进出记录推送
+     *
      * @param type
      */
     private void sendPushFailed(int type, BDFaceImageInstance rgbImage) {
-        if (!ConfigManager.getAuthenticationBeanListBean().isPushFailedRecordSwitch()){
-            AppLogUtils.e(false,"刷脸失败记录推送","刷脸失败记录推送 - 检测到未开启失败记录推送,直接return");
+        if (!ConfigManager.getAuthenticationBeanListBean().isPushFailedRecordSwitch()) {
+            AppLogUtils.e(false, "刷脸失败记录推送", "刷脸失败记录推送 - 检测到未开启失败记录推送,直接return");
             return;
         }
-        if (!ConfigManager.getAuthenticationBeanListBean().getPushFailedRecordType().contains(type)){
-            AppLogUtils.e(false,"刷脸失败记录推送","刷脸失败记录推送 - 检测到失败类型中不包含当前类型,直接return  type = "+type);
+        if (!ConfigManager.getAuthenticationBeanListBean().getPushFailedRecordType().contains(type)) {
+            AppLogUtils.e(false, "刷脸失败记录推送", "刷脸失败记录推送 - 检测到失败类型中不包含当前类型,直接return  type = " + type);
             return;
         }
         Bitmap bitmap = null;
         if (rgbImage != null) {
-             bitmap = BitmapUtils.getInstaceBmp(rgbImage);
+            bitmap = BitmapUtils.getInstaceBmp(rgbImage);
 
         }
         HttpRequest.getInstance().setEventRecords(TaskStatus.currentTask,
                 UserInfoManager.getInstance().getUserInformationBean().getName(),
                 UserInfoManager.getInstance().getUserInformationBean().getIdNumber(),
                 "", "", UserInfoManager.getInstance().getUserInformationBean().getMobile(),
-                false, type, UserInfoManager.getInstance().getUserInformationBean().getCardIdEx(), "",bitmap);
+                false, type, UserInfoManager.getInstance().getUserInformationBean().getCardIdEx(), "", bitmap);
 
 
     }
-    
-    
+
+
     public void setBaiduFaceResultStateCallback(BaiduFaceResultStateCallback baiduFaceResultStateCallback) {
         this.baiduFaceResultStateCallback = baiduFaceResultStateCallback;
     }
@@ -881,24 +840,24 @@ public class BaiduResultView  extends LinearLayout  {
         long startTime = user.getStartTime();
         long endTime = user.getEndTime();
         long curTime = System.currentTimeMillis();
-        if (curTime <= startTime){
-            showFailUI("未到有效时间","未到有效时间");
+
+        if (curTime <= startTime) {
+            showFailUI("未到有效时间", "未到有效时间");
             return true;
         }
-        if (curTime >= endTime){
-            showFailUI("已过期","已过期");
+        if (curTime >= endTime) {
+            showFailUI("已过期", "已过期");
             return true;
         }
         return false;
     }
 
 
-    private void setUserInfoToUserInfoManager(LivenessModel livenessModel,Bitmap bitmap) {
+    private void setUserInfoToUserInfoManager(LivenessModel livenessModel, Bitmap bitmap) {
         if (livenessModel == null) {
             return;
         }
         User user = livenessModel.getUser();
-
         if (user == null) {
             return;
         }
@@ -911,14 +870,13 @@ public class BaiduResultView  extends LinearLayout  {
         String scenePhotoUrl = user.getPhoto();
         UserInfoManager.getInstance().setUserInformationBean(userName, idNumber, "", photo, phone, cardIdEx, userId, livenessModel.getFeatureScore(), scenePhotoUrl);
         //人脸图片
-        BDFaceImageInstance rgbImage = livenessModel.getBdFaceImageInstance();
         if (bitmap != null) {
             UserInfoManager.getInstance().setUserInformationBean(userName, idNumber, "", "", phone, bitmap, cardIdEx, userId, livenessModel.getFeatureScore(), scenePhotoUrl);
         }
     }
 
     public interface BaiduFaceResultStateCallback {
-        
+
         void invokeStopVerify();
 
         void invokeResume();
@@ -941,28 +899,26 @@ public class BaiduResultView  extends LinearLayout  {
                 public void run() {
                     //判断失败进出记录是否开启,且类型包含1:1刷脸失败类型
                     UserInfoManager.getInstance().updateUserInformationBean_VerifyScore(compareScore);
-                    sendPushFailed(4,livenessModel.getBdFaceImageInstance());
+                    sendPushFailed(4, livenessModel.getBdFaceImageInstance());
                     String failText = "比对失败";
-                    showFailUI(failText,failText);
+                    showFailUI(failText, failText);
                 }
             });
         }
     }
 
     /**
-     *
      * @author xwh
      * Time 2024/12/30
      * Description: 设置控件显示隐藏
-     *
      **/
-    private void setViewVisibility(View view,boolean isVisibility){
-        if(view!=null){
-            view.setVisibility(isVisibility?VISIBLE:GONE);
+    private void setViewVisibility(View view, boolean isVisibility) {
+        if (view != null) {
+            view.setVisibility(isVisibility ? VISIBLE : GONE);
         }
     }
 
-    public void onRelease(){
+    public void onRelease() {
         if (mFuture != null && !mFuture.isDone()) {
             mFuture.cancel(true);
             mFuture = null;