Forráskód Böngészése

Merge remote-tracking branch 'origin/FaceScenic_V2_baiduface' into FaceScenic_V2_baiduface

# Conflicts:
#	app/build.gradle
#	app/src/main/java/com/hanghui/senic/baiduface/view/BaiduResultView.java
xwh 1 hete
szülő
commit
27c0e7b1e9

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

@@ -5,17 +5,24 @@ import static com.hanghui.senic.common.TaskStatus.taskStatus;
 import android.app.Activity;
 import android.content.Intent;
 import android.content.pm.PackageManager;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ImageView;
+import android.widget.LinearLayout;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 import android.widget.Toast;
 
+import androidx.annotation.NonNull;
 import androidx.core.app.ActivityCompat;
 
 import com.bumptech.glide.load.engine.DiskCacheStrategy;
 import com.bumptech.glide.request.RequestOptions;
+import com.example.datalibrary.api.FaceApi;
+import com.example.datalibrary.model.User;
 import com.hanghui.senic.MyAppliction;
 import com.hanghui.senic.R;
 import com.hanghui.senic.activity.BaseActivity;
@@ -24,6 +31,7 @@ import com.hanghui.senic.activity.PassWordActivity;
 import com.hanghui.senic.activity.view.ClickButtonFloatView;
 import com.hanghui.senic.common.AppHandler;
 import com.hanghui.senic.common.BroadcastManager;
+import com.hanghui.senic.common.CommonUtil;
 import com.hanghui.senic.common.Constants;
 import com.hanghui.senic.common.DevelopUtil;
 import com.hanghui.senic.common.DeviceInitManager;
@@ -58,6 +66,9 @@ import com.hanghui.senic.utils.ImageLoaderUtils;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
 
 
 public class BaiduFaceMainActivity extends BaseActivity {
@@ -77,6 +88,10 @@ public class BaiduFaceMainActivity extends BaseActivity {
     private ImageView hardwareIcon_QRCode;//硬件连接状态-二维码读头
     private ImageView hardwareIcon_Passport;//硬件连接状态-护照机
     private ImageView hardwareIcon_IcCard;//硬件连接状态-IC卡
+    private TextView tvNumPeople; //下发人数
+    private LinearLayout llNumPeople;
+    private ExecutorService mPeopleCountExecutorService ;
+    private Future mPeopleCountFuture3;
 
     private IDeviceUI iDeviceUI;
     private boolean networkStatus = true;//网络状态
@@ -104,6 +119,7 @@ public class BaiduFaceMainActivity extends BaseActivity {
 //        }
 //    };
 
+
     private final HttpRequest.HttpResponseCallback httpResponseCallback = new HttpRequest.HttpResponseCallback() {
         @Override
         public void updateView(int code, String msg) {
@@ -126,6 +142,8 @@ public class BaiduFaceMainActivity extends BaseActivity {
                     //百度人脸与smile有区别,百度人脸sdk是第一个初始化的
                     appStatusTextView.setText("人脸算法SDK授权中");
                     if(isBaiduFaceExecuted){
+                        AppLogUtils.i(true, "人脸算法SDK授权中", "isBaiduFaceExecuted:"+isBaiduFaceExecuted);
+                        appStatusTextView.setVisibility(View.GONE);
                         return;
                     }
                     isBaiduFaceExecuted = true;
@@ -336,7 +354,7 @@ public class BaiduFaceMainActivity extends BaseActivity {
 
     @Override
     public int getLayout() {
-        return R.layout.activity_main;
+        return R.layout.activity_baiduface_preview;
     }
 
     @Override
@@ -565,6 +583,8 @@ public class BaiduFaceMainActivity extends BaseActivity {
         hardwareIcon_QRCode = findViewById(R.id.hardwareIcon_QRCode);
         hardwareIcon_Passport = findViewById(R.id.hardwareIcon_Passport);
         hardwareIcon_IcCard = findViewById(R.id.hardwareIcon_IcCard);
+        tvNumPeople=findViewById(R.id.tv_num_people);
+        llNumPeople=findViewById(R.id.ll_num_people);
         tv_time.setText(DateUtil.getTime(DATE_FORMAT) + " " + DateUtil.getWeekOfDate(new Date()));
         if (!(com.hanghui.senic.BuildConfig.BUILD_TYPE).equals("release")) {//debug版本
             bottomDebugView.setVisibility(View.VISIBLE);
@@ -677,4 +697,40 @@ public class BaiduFaceMainActivity extends BaseActivity {
         QRCodeController.getInstance().requestUSBPermission();
         QRCodeController.getInstance().requestOverlayPersmission();
     }
+
+    /**
+     * 刷新当前人数
+     */
+   public Runnable flushPeopleRunnable=new Runnable() {
+        @Override
+        public void run() {
+            if(!ConfigManager.getAuthenticationBeanListBean().getShowPersonalNumSwitch()){
+                AppHandler.getHandler().removeCallbacks(flushPeopleRunnable);
+                if(llNumPeople!=null){
+                    llNumPeople.setVisibility(View.INVISIBLE);
+                }
+                return;
+            }else if(llNumPeople!=null){
+                llNumPeople.setVisibility(View.VISIBLE);
+            }
+            if (mPeopleCountFuture3 != null && !mPeopleCountFuture3.isDone()) {
+                AppHandler.getHandler().removeCallbacks(flushPeopleRunnable);
+                AppHandler.getHandler().postDelayed(flushPeopleRunnable,1000);
+                return;
+            }
+            if (mPeopleCountExecutorService == null) {
+                mPeopleCountExecutorService = Executors.newSingleThreadExecutor();
+            }
+            mPeopleCountFuture3 = mPeopleCountExecutorService.submit(() -> {
+                List<User> dataList = FaceApi.getInstance().getAllUserList();
+                AppHandler.getHandler().post(() -> {
+                    if (dataList != null && tvNumPeople != null) {
+                        tvNumPeople.setText("" + dataList.size());
+                    }
+                    AppHandler.getHandler().removeCallbacks(flushPeopleRunnable);
+                    AppHandler.getHandler().postDelayed(flushPeopleRunnable,1000);
+                });
+            });
+        }
+    };
 }

+ 4 - 3
app/src/main/java/com/hanghui/senic/baiduface/BaiduFacePreviewActivity.java

@@ -336,6 +336,8 @@ public class BaiduFacePreviewActivity extends BaiduFaceMainActivity implements B
             @Override
             public void run() {
                 FaceSDKManager.getInstance().initDataBases(MyAppliction.getContext()); //初始化人脸数据库
+                AppHandler.getHandler().removeCallbacks(flushPeopleRunnable);
+                AppHandler.getHandler().post(flushPeopleRunnable);
             }
         });
         FaceSDKManager.getInstance().setActiveLog(false);//百度人脸,关闭日志log, 否则sdk内部会极其高频的输出一大堆 "<line"  开头的log
@@ -1075,6 +1077,7 @@ public class BaiduFacePreviewActivity extends BaiduFaceMainActivity implements B
 
         isNeedVerify = true;
 
+        bdFaceCheckConfig=FaceUtils.getInstance().getBDFaceCheckConfig();
         bdFaceCheckConfig.setSecondFeature(secondFeature);
 
         bdFaceCheckConfig.setFeatureCheckMode(4);
@@ -1240,9 +1243,7 @@ public class BaiduFacePreviewActivity extends BaiduFaceMainActivity implements B
     @Override
     public void invokeResume() {
         isNeedVerify = true;
-        if(bdFaceCheckConfig==null){
-            bdFaceCheckConfig=FaceUtils.getInstance().getBDFaceCheckConfig();
-        }
+        bdFaceCheckConfig=FaceUtils.getInstance().getBDFaceCheckConfig();
         bdFaceCheckConfig.setFeatureCheckMode(3);
         AppHandler.getHandler().removeCallbacks(mPersonCardTimeoutRunnable);
     }

+ 11 - 0
app/src/main/java/com/hanghui/senic/bean/AuthenticationBean.java

@@ -496,6 +496,17 @@ public class AuthenticationBean {
         List<Integer> setPersonalList; //设置——人员列表”【控制设置页里的人员数据的信息】 1-照片,2-证件号,3-手机号
         @SerializedName("successShowPersonalInfoList")
         List<Integer> successShowPersonalInfoList;//成功显示人员信息列表1-照片,2-姓名,3-证件号,4-手机号
+        @SerializedName("showPersonalNumSwitch")
+        private boolean showPersonalNumSwitch;//预览页是否显示人员数量 默认-true
+
+
+        public boolean getShowPersonalNumSwitch() {
+            return showPersonalNumSwitch;
+        }
+
+        public void setShowPersonalNumSwitch(boolean showPersonalNumSwitch) {
+            this.showPersonalNumSwitch = showPersonalNumSwitch;
+        }
 
         public List<Integer> getSuccessShowPersonalInfoList() {
             return successShowPersonalInfoList;

+ 29 - 0
app/src/main/res/layout/layout_bottom.xml

@@ -146,6 +146,7 @@
         </RelativeLayout>
 
         <TextView
+            android:id="@+id/tv_support"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_below="@id/rl_version_sn"
@@ -157,6 +158,34 @@
             android:textSize="@dimen/sp_20" />
 
 
+        <LinearLayout
+            android:id="@+id/ll_num_people"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginRight="@dimen/dp_20"
+            android:gravity="center_vertical"
+            android:visibility="invisible"
+            android:layout_alignBottom="@+id/tv_support"
+            android:layout_alignParentRight="true">
+
+            <TextView
+                android:id="@+id/tv_num_people"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textColor="@color/white"
+                android:text="0"
+                android:layout_marginRight="@dimen/dp_5"
+                android:textSize="@dimen/sp_20"/>
+
+            <ImageView
+                android:layout_width="@dimen/dp_32"
+                android:layout_height="@dimen/dp_32"
+                android:src="@mipmap/ic_number_people"/>
+
+
+        </LinearLayout>
+
+
     </RelativeLayout>
 
 </com.hanghui.senic.baiduface.BottomInfoView>

BIN
app/src/main/res/mipmap-xhdpi/ic_number_people.png