|
@@ -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);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
}
|