8 Commits 4f6751e642 ... fc45994992

Author SHA1 Message Date
  ifengouy fc45994992 增加无证登记身份证信息输入界面 2 years ago
  ifengouy e60eff168b Merge branch 'master' of http://git.siwill.com/ifengouy/VisitorApp 2 years ago
  ifengouy 03e2edf508 Merge remote-tracking branch 'origin/master' 2 years ago
  ifengouy e202c38c02 删除support包 2 years ago
  ifengouy 15701eca11 完成访客签到、访客登记、访客签离功能 2 years ago
  ifengouy e35c32d9f8 Merge branch 'master' of http://git.siwill.com/ifengouy/VisitorApp 2 years ago
  ifengouy 79210d5808 ic卡图片 2 years ago
  ifengouy fd90c6aec8 home页布局修改 2 years ago
27 changed files with 562 additions and 130 deletions
  1. 2 2
      app/build.gradle
  2. 1 0
      app/src/main/AndroidManifest.xml
  3. 5 2
      app/src/main/java/com/sunwin/visitorapp/BaseActivity.java
  4. 10 1
      app/src/main/java/com/sunwin/visitorapp/LoginActivity.java
  5. 2 1
      app/src/main/java/com/sunwin/visitorapp/SplashActivity.java
  6. 63 16
      app/src/main/java/com/sunwin/visitorapp/activity/HomeAc.java
  7. 64 0
      app/src/main/java/com/sunwin/visitorapp/activity/VisitInputActivity.java
  8. 42 16
      app/src/main/java/com/sunwin/visitorapp/activity/VisitSignActivity.java
  9. 20 20
      app/src/main/java/com/sunwin/visitorapp/activity/VisitorRegActivity.java
  10. 39 11
      app/src/main/java/com/sunwin/visitorapp/activity/VisitorRegisterAc.java
  11. 1 1
      app/src/main/java/com/sunwin/visitorapp/adapter/VisitSignAdapter.java
  12. 8 3
      app/src/main/java/com/sunwin/visitorapp/db/DatabaseManager.java
  13. 14 1
      app/src/main/java/com/sunwin/visitorapp/db/UserInfoModel.java
  14. 11 0
      app/src/main/java/com/sunwin/visitorapp/face/DetectResult.java
  15. 81 4
      app/src/main/java/com/sunwin/visitorapp/face/SwFaceLoop.java
  16. 12 3
      app/src/main/java/com/sunwin/visitorapp/fragment/HomeFr.java
  17. 1 0
      app/src/main/java/com/sunwin/visitorapp/fragment/IdcardRegFragment.java
  18. 2 1
      app/src/main/java/com/sunwin/visitorapp/fragment/NoCardRegFragment.java
  19. 36 5
      app/src/main/java/com/sunwin/visitorapp/fragment/VisitSignFragment.java
  20. 10 0
      app/src/main/java/com/sunwin/visitorapp/model/OpenDoorByFaceNetResultInfo.java
  21. 3 2
      app/src/main/java/com/sunwin/visitorapp/utils/BitmapUtils.java
  22. 6 2
      app/src/main/java/com/sunwin/visitorapp/utils/Constant.java
  23. 3 1
      app/src/main/java/com/sunwin/visitorapp/view/FaceDetecterView.java
  24. 54 38
      app/src/main/res/layout/activity_home.xml
  25. 71 0
      app/src/main/res/layout/activity_visit_input.xml
  26. 1 0
      app/src/main/res/layout/fragment_visit_sign.xml
  27. BIN
      app/src/main/res/mipmap-xhdpi/visit_sign_iccard.png

+ 2 - 2
app/build.gradle

@@ -83,6 +83,6 @@ dependencies {
     implementation 'com.github.gzu-liyujiang.AndroidPicker:Common:4.1.9'
     implementation 'com.github.gzu-liyujiang.AndroidPicker:FilePicker:4.1.9'
     implementation 'com.github.gzu-liyujiang.AndroidPicker:ImagePicker:4.1.9'
-    implementation 'com.github.gzu-liyujiang.AndroidPicker:CalendarPicker:4.1.9' 
-    implementation 'com.github.gzu-liyujiang.AndroidPicker:WheelPicker:4.1.9' 
+    implementation 'com.github.gzu-liyujiang.AndroidPicker:CalendarPicker:4.1.9'
+    implementation 'com.github.gzu-liyujiang.AndroidPicker:WheelPicker:4.1.9'
 }

+ 1 - 0
app/src/main/AndroidManifest.xml

@@ -37,6 +37,7 @@
         <activity android:name=".activity.SettingAc" />
         <activity android:name=".activity.NoCardRegActivity" />
         <activity android:name=".activity.VisitSignActivity" />
+        <activity android:name=".activity.VisitInputActivity" />
 
         <service
             android:name=".service.PullDataService"

+ 5 - 2
app/src/main/java/com/sunwin/visitorapp/BaseActivity.java

@@ -1,14 +1,14 @@
 package com.sunwin.visitorapp;
 
-import android.content.Context;
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.os.Bundle;
 
-
 import androidx.appcompat.app.AppCompatActivity;
 
 import com.sunwin.visitorapp.utils.AppManager;
+import com.sunwin.visitorapp.utils.Constant;
+import com.sunwin.visitorapp.utils.SharePrefenceUtils;
 import com.sunwin.visitorapp.view.LoadingDialog;
 
 public class BaseActivity extends AppCompatActivity {
@@ -17,6 +17,8 @@ public class BaseActivity extends AppCompatActivity {
     protected AppCompatActivity mContext;
     protected LoadingDialog loadingDialog;
 
+    protected boolean isLogin;
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -24,6 +26,7 @@ public class BaseActivity extends AppCompatActivity {
         TAG = getClass().getSimpleName();
         mContext = this;
         loadingDialog = new LoadingDialog(this, "");
+        isLogin = SharePrefenceUtils.getBoolean(Constant.ISharePrefence.LOGINTAG, false);
     }
 
 

+ 10 - 1
app/src/main/java/com/sunwin/visitorapp/LoginActivity.java

@@ -9,6 +9,7 @@ import android.widget.EditText;
 import com.sunwin.visitorapp.activity.HomeAc;
 import com.sunwin.visitorapp.activity.VisitorRegActivity;
 import com.sunwin.visitorapp.utils.Constant;
+import com.sunwin.visitorapp.utils.SharePrefenceUtils;
 
 public class LoginActivity extends BaseActivity implements View.OnClickListener {
     private EditText mEtUserName;
@@ -28,8 +29,9 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
         mEtPwd = (EditText) findViewById(R.id.et_pwd);
         mBtnLogin = (Button) findViewById(R.id.btn_login);
         findViewById(R.id.btn_login_by_self).setOnClickListener(this);
+        findViewById(R.id.btn_login).setOnClickListener(this);
 
-        findViewById(R.id.btn_login).setOnClickListener(v -> startActivity(new Intent(LoginActivity.this, HomeAc.class)));
+//        findViewById(R.id.btn_login).setOnClickListener(v -> startActivity(new Intent(LoginActivity.this, HomeAc.class)));
 
     }
 
@@ -37,10 +39,17 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
     public void onClick(View view) {
         switch (view.getId()) {
             case R.id.btn_login_by_self:
+                SharePrefenceUtils.putBoolean(Constant.ISharePrefence.LOGINTAG, false);
                 Intent intent = new Intent(this, VisitorRegActivity.class);
                 intent.putExtra(Constant.IIntentValue.ISLOGINUSER, false);
                 startActivity(intent);
                 break;
+            case R.id.btn_login:
+                SharePrefenceUtils.putBoolean(Constant.ISharePrefence.LOGINTAG, true);
+                Intent intent2 = new Intent(this, HomeAc.class);
+                intent2.putExtra(Constant.IIntentValue.ISLOGINUSER, true);
+                startActivity(intent2);
+                break;
         }
     }
 }

+ 2 - 1
app/src/main/java/com/sunwin/visitorapp/SplashActivity.java

@@ -23,6 +23,7 @@ import androidx.core.app.ActivityCompat;
 import com.srp.AuthApi.AuthApi;
 import com.srp.AuthApi.AuthApplyResponse;
 import com.srp.AuthApi.ErrorCodeConfig;
+import com.sunwin.visitorapp.activity.HomeAc;
 import com.sunwin.visitorapp.face.FRAbsLoopFactory;
 import com.sunwin.visitorapp.utils.AppManager;
 import com.sunwin.visitorapp.utils.Constant;
@@ -217,7 +218,7 @@ public class SplashActivity extends AppCompatActivity {
     }
 
     private void gotoMain() {
-        Intent intent = new Intent(this, MainActivity.class);
+        Intent intent = new Intent(this, HomeAc.class);
         startActivity(intent);
         finish();
     }

+ 63 - 16
app/src/main/java/com/sunwin/visitorapp/activity/HomeAc.java

@@ -3,25 +3,33 @@ package com.sunwin.visitorapp.activity;
 import android.content.Intent;
 import android.os.Bundle;
 import android.view.View;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
 
+import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentManager;
 import androidx.fragment.app.FragmentTransaction;
 
 import com.sunwin.visitorapp.BaseActivity;
 import com.sunwin.visitorapp.R;
 import com.sunwin.visitorapp.fragment.HomeFr;
+import com.sunwin.visitorapp.fragment.VisitSignFragment;
 import com.sunwin.visitorapp.utils.Constant;
+import com.sunwin.visitorapp.utils.ToastUtils;
+import com.sunwin.visitorapp.view.UINav;
 
 public class HomeAc extends BaseActivity implements View.OnClickListener {
 
+    private UINav mUINav;
+    private RelativeLayout mLlHomeTitle;
+    private TextView mTextTitle;
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_home);
 
 
-        findViewById(R.id.ImageSetting).setOnClickListener(v -> startActivity(new Intent(mContext, SettingAc.class)));
-
         FragmentManager fragmentManager = getSupportFragmentManager();
         FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
         //添加fragment
@@ -30,15 +38,8 @@ public class HomeAc extends BaseActivity implements View.OnClickListener {
         fragmentTransaction.commit();
         fragmentManager.executePendingTransactions();
 
-        findViewById(R.id.MenuItemRegister).setOnClickListener(this);
-
-        findViewById(R.id.MenuItemRegister).setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-            }
-        });
-
 
+        initView();
     }
 
     @Override
@@ -48,15 +49,26 @@ public class HomeAc extends BaseActivity implements View.OnClickListener {
     }
 
     @Override
+    public void onBackPressed() {
+        moveTaskToBack(true);
+    }
+
+    private void replaceFragment(Fragment fragment) {
+        getSupportFragmentManager().beginTransaction().replace(R.id.FragmentView,
+                fragment).commitAllowingStateLoss();
+    }
+
+    @Override
     public void onClick(View view) {
         Intent intent = null;
         switch (view.getId()) {
             case R.id.MenuItemRecord://记录
+                replaceFragment(new HomeFr());
                 break;
             case R.id.MenuItemSign://签到
-                intent = new Intent(this, VisitSignActivity.class);
-                intent.putExtra(Constant.IIntentValue.VISIT_TYPE, 1);
-                startActivity(intent);
+                showHome(false);
+                updateTitle("访客签到");
+                replaceFragment(VisitSignFragment.newInstance(1));
                 break;
             case R.id.MenuItemRegister://登记
                 intent = new Intent(this, VisitorRegActivity.class);
@@ -64,12 +76,47 @@ public class HomeAc extends BaseActivity implements View.OnClickListener {
                 startActivity(intent);
                 break;
             case R.id.MenuItemLeave://签离
-                intent = new Intent(this, VisitSignActivity.class);
-                intent.putExtra(Constant.IIntentValue.VISIT_TYPE, 2);
-                startActivity(intent);
+                showHome(false);
+                updateTitle("访客签离");
+                replaceFragment(VisitSignFragment.newInstance(2));
                 break;
             case R.id.MenuItemCheck://核验
+                ToastUtils.showToast("开发中...");
+                break;
+            case R.id.ImageSetting:
+                startActivity(new Intent(mContext, SettingAc.class));
                 break;
         }
     }
+
+    private void initView() {
+        mUINav = (UINav) findViewById(R.id.UINav);
+        mLlHomeTitle = (RelativeLayout) findViewById(R.id.ll_home_title);
+        mTextTitle =  findViewById(R.id.TextTitle);
+
+        findViewById(R.id.MenuItemRecord).setOnClickListener(this);
+        findViewById(R.id.MenuItemSign).setOnClickListener(this);
+        findViewById(R.id.MenuItemRegister).setOnClickListener(this);
+        findViewById(R.id.MenuItemLeave).setOnClickListener(this);
+        findViewById(R.id.MenuItemCheck).setOnClickListener(this);
+        findViewById(R.id.ImageSetting).setOnClickListener(this);
+        showHome(true);
+
+
+    }
+
+    private void showHome(boolean showHome) {
+        mLlHomeTitle.setVisibility(showHome ? View.VISIBLE : View.GONE);
+        mUINav.setVisibility(showHome ? View.GONE : View.VISIBLE);
+    }
+
+    private void updateTitle(String title){
+        mUINav.setMainData(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                showHome(true);
+                replaceFragment(new HomeFr());
+            }
+        }, title);
+    }
 }

+ 64 - 0
app/src/main/java/com/sunwin/visitorapp/activity/VisitInputActivity.java

@@ -0,0 +1,64 @@
+package com.sunwin.visitorapp.activity;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+
+import com.sunwin.visitorapp.BaseActivity;
+import com.sunwin.visitorapp.R;
+import com.sunwin.visitorapp.model.OpenDoorByFaceNetResultInfo;
+import com.sunwin.visitorapp.utils.Constant;
+import com.sunwin.visitorapp.utils.ToastUtils;
+import com.sunwin.visitorapp.view.UINav;
+
+public class VisitInputActivity extends BaseActivity implements View.OnClickListener {
+    private UINav mUINav;
+    private EditText mEditName;
+    private EditText mEditICCode;
+    private Button mBtnNext;
+    private String currentFacePath;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_visit_input);
+        currentFacePath = getIntent().getStringExtra(Constant.IIntentValue.CURRENTFACEPATH);
+        initView();
+    }
+
+    private void initView() {
+        mUINav = findViewById(R.id.UINav);
+        mEditName = findViewById(R.id.EditName);
+        mEditICCode = findViewById(R.id.EditICCode);
+        mBtnNext = findViewById(R.id.btn_next);
+        mBtnNext.setOnClickListener(this);
+
+        mUINav.setData(this, "无证登记-输入身份证信息");
+    }
+
+    @Override
+    public void onClick(View view) {
+        submit();
+    }
+
+    private void submit() {
+        String name = mEditName.getText().toString().trim();
+        String idNum = mEditICCode.getText().toString().trim();
+        if (TextUtils.isEmpty(name)) {
+            ToastUtils.showToast("请输入姓名");
+            return;
+        }
+        if (TextUtils.isEmpty(idNum)) {
+            ToastUtils.showToast("请输入身份证");
+            return;
+        }
+        OpenDoorByFaceNetResultInfo info = new OpenDoorByFaceNetResultInfo();
+        Intent intent = new Intent(mContext, VisitorRegisterAc.class);
+        intent.putExtra(Constant.IIntentValue.CURRENTFACEPATH,currentFacePath);
+        intent.putExtra(Constant.IIntentValue.RECOGNIZE_INFO,info);
+        startActivity(intent);
+    }
+}

+ 42 - 16
app/src/main/java/com/sunwin/visitorapp/activity/VisitSignActivity.java

@@ -18,6 +18,7 @@ import com.sunwin.visitorapp.model.OpenDoorByFaceNetResultInfo;
 import com.sunwin.visitorapp.service.PullDataService;
 import com.sunwin.visitorapp.utils.Constant;
 import com.sunwin.visitorapp.utils.LogUtil;
+import com.sunwin.visitorapp.utils.ToastUtils;
 import com.sunwin.visitorapp.view.FaceDetecterView;
 
 import java.util.List;
@@ -31,6 +32,7 @@ public class VisitSignActivity extends BaseActivity implements IdCardReadCallbac
     private FaceDetecterView mFaceDetecterView;
 
     private int visitSignType;
+    private int visitType;
     private IDCardReaderUtil idCardReaderUtil;
 
     @Override
@@ -42,8 +44,19 @@ public class VisitSignActivity extends BaseActivity implements IdCardReadCallbac
         PullDataService.enqueueWork(this, new Intent());
     }
 
+    @Override
+    public void onPause() {
+        super.onPause();
+        LogUtil.e(TAG, "=======onPause = ");
+        if (idCardReaderUtil != null) {
+            idCardReaderUtil.stopRead();
+        }
+        mFaceDetecterView.onDestroy();
+    }
+
     private void initialData() {
         visitSignType = getIntent().getIntExtra(Constant.IIntentValue.VISIT_SIGN_TYPE, 1);
+        visitType = getIntent().getIntExtra(Constant.IIntentValue.VISIT_TYPE, 1);
     }
 
     private void initView() {
@@ -73,12 +86,7 @@ public class VisitSignActivity extends BaseActivity implements IdCardReadCallbac
 
     private void updataUserInfoByIdNum(String idNum) {
         List<UserInfoModel> userInfoModels = DatabaseManager.getInstance().query(UserInfoModel.class, "idNum", idNum);
-        if (userInfoModels.size() > 0) {
-            UserInfoModel infoModel = userInfoModels.get(0);
-            infoModel.setState(2);
-            int update = DatabaseManager.getInstance().update(infoModel);
-            LogUtil.e(TAG, "update = " + update);
-        }
+        updateUserInfo(userInfoModels);
     }
 
     /**
@@ -91,17 +99,10 @@ public class VisitSignActivity extends BaseActivity implements IdCardReadCallbac
 
     @Override
     public void detectedUser(OpenDoorByFaceNetResultInfo openDoorByFaceNetResultInfo) {
+        LogUtil.e(TAG, "-------------detectedUser--------------");
         BaseApplication.getSystemTTS().playText("识别成功");
-        String person_code = openDoorByFaceNetResultInfo.getPerson_code();
-        List<UserInfoModel> userInfoModels = DatabaseManager.getInstance().query(UserInfoModel.class, "personCode", person_code);
-        if (userInfoModels.size() > 0) {
-            UserInfoModel infoModel = userInfoModels.get(0);
-            infoModel.setState(2);
-            int update = DatabaseManager.getInstance().update(infoModel);
-            LogUtil.e(TAG, "update = " + update);
-        } else {
-
-        }
+        String idNum = openDoorByFaceNetResultInfo.getIdNum();
+        updataUserInfoByIdNum(idNum);
     }
 
     @Override
@@ -113,4 +114,29 @@ public class VisitSignActivity extends BaseActivity implements IdCardReadCallbac
     public void takePic(CameraPreviewData data) {
 
     }
+
+    /**
+     * 更改用户签到/签离状态
+     */
+    private void updateUserInfo(List<UserInfoModel> userInfoModels) {
+        if (userInfoModels.size() > 0) {
+            UserInfoModel infoModel = userInfoModels.get(0);
+            infoModel.setState(visitType == 1 ? 2 : 3);
+            long update = DatabaseManager.getInstance().update(infoModel);
+            LogUtil.e(TAG, "update = " + update);
+            runOnUiThread(new Runnable() {
+                @Override
+                public void run() {
+                    finish();
+                }
+            });
+        } else {
+            runOnUiThread(new Runnable() {
+                @Override
+                public void run() {
+                    ToastUtils.showToast("用户不存在!");
+                }
+            });
+        }
+    }
 }

+ 20 - 20
app/src/main/java/com/sunwin/visitorapp/activity/VisitorRegActivity.java

@@ -27,7 +27,7 @@ import java.util.List;
 /**
  * 访客登记页面
  */
-public class VisitorRegActivity extends BaseActivity implements View.OnClickListener, AdapterView.OnItemClickListener, RegTypeFragment.Listener {
+public class VisitorRegActivity extends BaseActivity implements View.OnClickListener, RegTypeFragment.Listener {
 
     private TextView mTvHeadTitle;
     //    private MyGridView mGridview;
@@ -95,25 +95,25 @@ public class VisitorRegActivity extends BaseActivity implements View.OnClickList
         switch (view.getId()) {
         }
     }
-
-    @Override
-    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
-        if (adapterView.getId() == R.id.gridview) {
-            switch (i) {
-                case 0:
-                    replaceFragment(new IdcardRegFragment());
-                    break;
-                case 1:
-                    startActivity(new Intent(this, NoCardRegActivity.class));
-                    break;
-                case 2:
-                    ToastUtils.showToast("开发中...");
-                    break;
-            }
-        } else {
-
-        }
-    }
+//
+//    @Override
+//    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
+//        if (adapterView.getId() == R.id.gridview) {
+//            switch (i) {
+//                case 0:
+//                    replaceFragment(new IdcardRegFragment());
+//                    break;
+//                case 1:
+//                    startActivity(new Intent(this, NoCardRegActivity.class));
+//                    break;
+//                case 2:
+//                    ToastUtils.showToast("开发中...");
+//                    break;
+//            }
+//        } else {
+//
+//        }
+//    }
 
     private void replaceFragment(Fragment fragment) {
         getSupportFragmentManager().beginTransaction().replace(R.id.fl_content,

+ 39 - 11
app/src/main/java/com/sunwin/visitorapp/activity/VisitorRegisterAc.java

@@ -21,8 +21,10 @@ import com.sunwin.visitorapp.adapter.DepartmentAdapter;
 import com.sunwin.visitorapp.adapter.NetInfoAdapter;
 import com.sunwin.visitorapp.db.DatabaseManager;
 import com.sunwin.visitorapp.db.UserInfoModel;
+import com.sunwin.visitorapp.face.SwFaceLoop;
 import com.sunwin.visitorapp.model.DepartmentResult;
 import com.sunwin.visitorapp.model.NetInfo;
+import com.sunwin.visitorapp.model.OpenDoorByFaceNetResultInfo;
 import com.sunwin.visitorapp.net.ApiService;
 import com.sunwin.visitorapp.net.BaseRsult;
 import com.sunwin.visitorapp.net.CommonRequest;
@@ -64,12 +66,13 @@ public class VisitorRegisterAc extends BaseActivity implements View.OnClickListe
     private EditText mEditByVisitPeople;
     private Spinner mEditByVisitDepartment;
     private TextView mTextButtonSure;
+    private Spinner sp_net;
     private TimePickerDialog timePickerDialog;
     private long tenYears = 10L * 365 * 1000 * 60 * 60 * 24L;
     private int dateLabel;
     private List<DepartmentResult> mDepartmentList;
     private List<NetInfo> mNetInfoList;
-    private Spinner sp_net;
+    private OpenDoorByFaceNetResultInfo userInfo;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -77,9 +80,8 @@ public class VisitorRegisterAc extends BaseActivity implements View.OnClickListe
         setContentView(R.layout.ac_visitor_register);
         mDepartmentList = DatabaseManager.getInstance().getQueryAll(DepartmentResult.class);
         mNetInfoList = DatabaseManager.getInstance().getQueryAll(NetInfo.class);
-
-
         currentFacePath = getIntent().getStringExtra(Constant.IIntentValue.CURRENTFACEPATH);
+        userInfo = (OpenDoorByFaceNetResultInfo) getIntent().getSerializableExtra(Constant.IIntentValue.RECOGNIZE_INFO);
         UINav uiNav = findViewById(R.id.UINav);
         uiNav.setData(this, "访客登记");
         initView();
@@ -131,8 +133,8 @@ public class VisitorRegisterAc extends BaseActivity implements View.OnClickListe
         mComeReason = findViewById(R.id.comeReason);
         mEditCompany = (EditText) findViewById(R.id.EditCompany);
         mEditCarPlate = (EditText) findViewById(R.id.EditCarPlate);
-        mEditVisitTimeBegin =  findViewById(R.id.EditVisitTimeBegin);
-        mEditVisitTimeEnd =  findViewById(R.id.EditVisitTimeEnd);
+        mEditVisitTimeBegin = findViewById(R.id.EditVisitTimeBegin);
+        mEditVisitTimeEnd = findViewById(R.id.EditVisitTimeEnd);
         mEditVisitNumber = (EditText) findViewById(R.id.EditVisitNumber);
         mEditVisitPeopleCount = (EditText) findViewById(R.id.EditVisitPeopleCount);
         mEditICCode = (EditText) findViewById(R.id.EditICCode);
@@ -144,8 +146,16 @@ public class VisitorRegisterAc extends BaseActivity implements View.OnClickListe
         mEditVisitTimeBegin.setOnClickListener(this);
         mEditVisitTimeEnd.setOnClickListener(this);
 
-        showHead(currentFacePath, mImageVisitorPhoto);
         sp_net = findViewById(R.id.sp_net);
+        initViewInfo();
+
+    }
+
+    private void initViewInfo() {
+        //
+        showHead(currentFacePath, mImageVisitorPhoto);
+        mTextVisitorIdCode.setText(userInfo.getIdNum());
+        mTextVisitorName.setText(userInfo.getPerson_name());
     }
 
     private void showHead(String path, ImageView iv_head) {
@@ -172,6 +182,7 @@ public class VisitorRegisterAc extends BaseActivity implements View.OnClickListe
     }
 
     private void submit() {
+        UserInfoModel oldUserinfo = null;
         loadingDialog.showLoadingDialog("");
 
         String phone = mEditPhone.getText().toString().trim();
@@ -189,7 +200,6 @@ public class VisitorRegisterAc extends BaseActivity implements View.OnClickListe
         String comeReason = mComeReason.getText().toString().trim();
         String company = mEditCompany.getText().toString().trim();
 
-        idNum = "330101199011112580";
         UserInfoModel infoModel = new UserInfoModel();
         infoModel.setPhone(phone);
         infoModel.setVisitorLpCode(carPlate);
@@ -197,17 +207,27 @@ public class VisitorRegisterAc extends BaseActivity implements View.OnClickListe
         infoModel.setLostDate(endTime);
         infoModel.setCardNo(cardNum);
         infoModel.setIdNum(idNum);
-        infoModel.setStatus(-2);
+        if (isLogin) {
+            infoModel.setStatus(0);
+        } else {
+            infoModel.setStatus(-2);
+        }
         infoModel.setType(2);
         infoModel.setPersonName(name);
-        infoModel.setDeptId(deptNo+"");
+        infoModel.setDeptId(deptNo + "");
         infoModel.setCategoryId(categoryId);
 
+        List<UserInfoModel> userInfoModels = DatabaseManager.getInstance().query(UserInfoModel.class, "idNum", idNum);
+        if (userInfoModels.size() != 0) {
+            oldUserinfo = userInfoModels.get(0);
+            infoModel.setPersonId(oldUserinfo.getPersonId());
+        }
 
         ApiService apiService = RetrofitUtil.getApiService();
         MediaType textType = MediaType.parse("text/plain");
         final RequestBody requestBody = RequestBody.create(textType, RetrofitUtil.bean2Json(infoModel));
         Call<BaseRsult<String>> call = apiService.saveOrUpdatePersonInfo(requestBody);
+        UserInfoModel finalOldUserinfo = oldUserinfo;
         call.enqueue(new Callback<BaseRsult<String>>() {
             @Override
             public void onResponse(Call<BaseRsult<String>> call, Response<BaseRsult<String>> response) {
@@ -220,8 +240,16 @@ public class VisitorRegisterAc extends BaseActivity implements View.OnClickListe
                     int code = response.body().getCode();
                     LogUtil.e(TAG, "--code--" + code);
                     if (code == 0) {
-                        String result = response.body().getResult();
-                        addFace(currentFacePath, result);
+                        String personId = response.body().getResult();
+                        String faceToken = SwFaceLoop.getInstance().addFace(currentFacePath);
+
+                        infoModel.setInsetTime(TimeUtils.stampToDate(System.currentTimeMillis()));
+                        infoModel.setFaceToken(faceToken);
+                        infoModel.setPersonId(personId);
+                        addFace(currentFacePath, personId);
+                        if (finalOldUserinfo != null) {
+                            DatabaseManager.getInstance().delete(finalOldUserinfo);
+                        }
                         //存入数据库
                         long insert = DatabaseManager.getInstance().insert(infoModel);
                         LogUtil.e(TAG, "存入用户" + insert);

+ 1 - 1
app/src/main/java/com/sunwin/visitorapp/adapter/VisitSignAdapter.java

@@ -43,7 +43,7 @@ public class VisitSignAdapter extends BaseAdapter {
     public View getView(int position, View convertView, ViewGroup parent) {
         ViewHolder holder = null;
         if (convertView == null) {
-            convertView = inflater.inflate(R.layout.adapter_card, parent, false);
+            convertView = inflater.inflate(R.layout.adapter_visit_sign, parent, false);
             holder = new ViewHolder(convertView);
             convertView.setTag(holder);
         } else {

+ 8 - 3
app/src/main/java/com/sunwin/visitorapp/db/DatabaseManager.java

@@ -26,7 +26,7 @@ public class DatabaseManager {
      *
      * @param t
      */
-    public  <T> long insert(T t) {
+    public <T> long insert(T t) {
         return liteOrm.save(t);
     }
 
@@ -96,8 +96,8 @@ public class DatabaseManager {
      * @param t
      * @param <T>
      */
-    public <T> void delete(T t) {
-        liteOrm.delete(t);
+    public <T> int delete(T t) {
+      return   liteOrm.delete(t);
     }
 
     /**
@@ -142,4 +142,9 @@ public class DatabaseManager {
         return liteOrm.query(new QueryBuilder<T>(cla)
                 .whereEquals(key, value));
     }
+
+    public <T> List<T> queryUnion(Class<T> cla, String key, String value, String key2, String value2) {
+        return liteOrm.query(new QueryBuilder<T>(cla).whereEquals(key, value).whereAppendAnd().whereEquals(key2, value2));
+
+    }
 }

+ 14 - 1
app/src/main/java/com/sunwin/visitorapp/db/UserInfoModel.java

@@ -6,8 +6,22 @@ import com.litesuits.orm.db.enums.AssignType;
 
 @Table("user_table")
 public class UserInfoModel {
+
     @PrimaryKey(AssignType.BY_MYSELF)
+    private String idNum;
+
+
     private String personId;
+
+    public String getFaceToken() {
+        return faceToken;
+    }
+
+    public void setFaceToken(String faceToken) {
+        this.faceToken = faceToken;
+    }
+
+    private String faceToken;
     private String openid;// 绑定微信公众号的openid
     private String proOpenid;// 绑定微信小程序的openid
 
@@ -39,7 +53,6 @@ public class UserInfoModel {
 
     private long updateTime;
 
-    private String idNum;
     private int sex; //0女,1男
     private String birthday;
     private String phone;

+ 11 - 0
app/src/main/java/com/sunwin/visitorapp/face/DetectResult.java

@@ -1,9 +1,20 @@
 package com.sunwin.visitorapp.face;
 
+import mcv.facepass.types.FacePassTrackOptions;
+
 public class DetectResult {
     byte[] detectResult;
     CameraPreviewData cameraPreviewData;
 
+    public FacePassTrackOptions[] getTrackOpt() {
+        return trackOpt;
+    }
+
+    public void setTrackOpt(FacePassTrackOptions[] trackOpt) {
+        this.trackOpt = trackOpt;
+    }
+
+    FacePassTrackOptions[] trackOpt;
     public byte[] getDetectResult() {
         return detectResult;
     }

+ 81 - 4
app/src/main/java/com/sunwin/visitorapp/face/SwFaceLoop.java

@@ -11,6 +11,8 @@ import android.os.Environment;
 import com.guo.android_extend.java.ExtByteArrayOutputStream;
 import com.nostra13.universalimageloader.core.ImageLoader;
 import com.sunwin.visitorapp.BaseApplication;
+import com.sunwin.visitorapp.db.DatabaseManager;
+import com.sunwin.visitorapp.db.UserInfoModel;
 import com.sunwin.visitorapp.model.FacesModel;
 import com.sunwin.visitorapp.model.OpenDoorByFaceNetResultInfo;
 import com.sunwin.visitorapp.model.UserModel;
@@ -32,6 +34,7 @@ import java.util.concurrent.ArrayBlockingQueue;
 
 import mcv.facepass.FacePassException;
 import mcv.facepass.FacePassHandler;
+import mcv.facepass.types.FacePassAddFaceResult;
 import mcv.facepass.types.FacePassCompareResult;
 import mcv.facepass.types.FacePassConfig;
 import mcv.facepass.types.FacePassDetectionResult;
@@ -40,6 +43,8 @@ import mcv.facepass.types.FacePassImageType;
 import mcv.facepass.types.FacePassModel;
 import mcv.facepass.types.FacePassPose;
 import mcv.facepass.types.FacePassRCAttribute;
+import mcv.facepass.types.FacePassRecognitionResult;
+import mcv.facepass.types.FacePassRecognitionState;
 import mcv.facepass.types.FacePassTrackOptions;
 
 
@@ -369,6 +374,7 @@ public class SwFaceLoop extends FRAbsLoop {
                 DetectResult detectResult = new DetectResult();
                 detectResult.setCameraPreviewData(cameraPreviewData);
                 detectResult.setDetectResult(detectionResult.message);
+                detectResult.setTrackOpt(trackOpts);
                 mDetectResultQueue.offer(detectResult);
             } else {
 //                Log.e(DEBUG_TAG, "null");
@@ -422,7 +428,6 @@ public class SwFaceLoop extends FRAbsLoop {
                     isRecognized = true;
                     LogUtil.d(DEBUG_TAG, "take");
                     DetectResult detectResult = mDetectResultQueue.take();
-                    byte[] detectionResult = detectResult.getDetectResult();
 
                     if (isLocalGroupExist) {
 
@@ -430,7 +435,7 @@ public class SwFaceLoop extends FRAbsLoop {
                             idCardRecognite(detectResult);
 
                         } else {
-//                            userRecognite(detectResult, detectionResult);
+                            userRecognite(detectResult);
                         }
                     } else {
                         isLocalGroupExist = mFacePassHandler.createLocalGroup(group_name);
@@ -450,6 +455,57 @@ public class SwFaceLoop extends FRAbsLoop {
         }
     }
 
+    private void userRecognite(DetectResult detectResult) {
+        try {
+            FacePassRecognitionResult[][] recognizeArray = mFacePassHandler.recognize(group_name, detectResult.getDetectResult(), 1, detectResult.getTrackOpt());
+            if (recognizeArray != null && recognizeArray.length > 0) {
+                for (FacePassRecognitionResult[] recognizeResult : recognizeArray) {
+                    for (FacePassRecognitionResult result : recognizeResult) {
+                        String faceToken = new String(result.faceToken);
+                        LogUtil.e(TAG, "userRecognite():-------------------faceToken=" + faceToken);
+                        if (FacePassRecognitionState.RECOGNITION_PASS == result.recognitionState ||
+                                FacePassRecognitionState.RECOGNITION_RETRY_EXPIRED == result.recognitionState) {
+                            //根据facetoken查询对应的用户
+                            List<UserInfoModel> userInfoModels = DatabaseManager.getInstance().query(UserInfoModel.class, "faceToken", faceToken);
+                            if (userInfoModels.size() > 0) {
+                                UserInfoModel infoModel = userInfoModels.get(0);
+                                OpenDoorByFaceNetResultInfo openDoorByFaceNetResultInfo = new OpenDoorByFaceNetResultInfo();
+                                openDoorByFaceNetResultInfo.setCode(0);
+                                openDoorByFaceNetResultInfo.setSimilarity(result.detail.searchScore);
+                                openDoorByFaceNetResultInfo.setPerson_code(infoModel.getPersonId());
+                                openDoorByFaceNetResultInfo.setIdNum(infoModel.getIdNum());
+                                openDoorByFaceNetResultInfo.setPerson_name(infoModel.getPersonName());
+                                EventBus.getDefault().post(new DescEvent().setDesc(DescEvent.DESC_FR_SUCC).setOpenDoorByFaceNetResultInfo(openDoorByFaceNetResultInfo));
+
+                            } else {
+                                //未匹配到用户
+                                recognizeNoUser();
+                            }
+
+                        } else {
+                            recognizeFail();
+
+                        }
+                    }
+                }
+            } else {
+                recognizeFail();
+            }
+
+        } catch (FacePassException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    private void recognizeNoUser() {
+        LogUtil.e(TAG, "---------recognizeNoUser---------");
+    }
+
+    private void recognizeFail() {
+        LogUtil.e(TAG, "---------recognizeFail---------");
+    }
+
     private void idCardRecognite(DetectResult detectResult) {
 
         OpenDoorByFaceNetResultInfo openDoorByFaceNetResultInfo = new OpenDoorByFaceNetResultInfo();
@@ -490,7 +546,7 @@ public class SwFaceLoop extends FRAbsLoop {
                     openDoorByFaceNetResultInfo.setCode(0);
                     openDoorByFaceNetResultInfo.setSimilarity(facePassCompareResult1.score);
                     openDoorByFaceNetResultInfo.setCurrentFace(currentFacePath);
-                    openDoorByFaceNetResultInfo.setPerson_code(idCardInfo.getId());
+                    openDoorByFaceNetResultInfo.setIdNum(idCardInfo.getId());
                     openDoorByFaceNetResultInfo.setPerson_name(idCardInfo.getName());
                     ArrayList<FacesModel> arrayList = new ArrayList<>();
                     FacesModel facesModel = new FacesModel();
@@ -501,7 +557,7 @@ public class SwFaceLoop extends FRAbsLoop {
                     recognizeTime = 0;
                     LogUtil.e("step", "6");
                 } else {
-                    LogUtil.e(TAG, "人证识别时间:"+recognizeTime);
+                    LogUtil.e(TAG, "人证识别时间:" + recognizeTime);
                     recognizeTime++;
                     if (recognizeTime == Constant.COMPARSION_FREQUENCY) {
                         EventBus.getDefault().post(new DescEvent().setDesc(DescEvent.DESC_FR_NO_BODY));
@@ -513,4 +569,25 @@ public class SwFaceLoop extends FRAbsLoop {
             }
         }
     }
+
+
+    public String addFace(String currentFacePath) {
+        if (mFacePassHandler == null) {
+            return "";
+        }
+        Bitmap bitmap = BitmapFactory.decodeFile(currentFacePath);
+        try {
+            FacePassAddFaceResult result = mFacePassHandler.addFace(bitmap);
+            if (result != null) {
+                if (result.result == 0) {
+                    boolean b = mFacePassHandler.bindGroup(group_name, result.faceToken);
+                    LogUtil.e(TAG, "bindGroup: " + currentFacePath + ":" + b);
+                    return new String(result.faceToken);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "";
+    }
 }

+ 12 - 3
app/src/main/java/com/sunwin/visitorapp/fragment/HomeFr.java

@@ -14,6 +14,7 @@ import com.sunwin.visitorapp.BaseFragment;
 import com.sunwin.visitorapp.R;
 import com.sunwin.visitorapp.db.DatabaseManager;
 import com.sunwin.visitorapp.db.UserInfoModel;
+import com.sunwin.visitorapp.utils.TimeUtils;
 
 import org.jetbrains.annotations.NotNull;
 
@@ -46,9 +47,17 @@ public class HomeFr extends BaseFragment {
     }
 
     private void initData() {
-        List<UserInfoModel> userInfoModels = DatabaseManager.getInstance().getQueryAll(UserInfoModel.class);
-        if (userInfoModels != null & userInfoModels.size() > 0) {
-
+        List<UserInfoModel> userInfoModels = DatabaseManager.getInstance().query(UserInfoModel.class, "insetTime", TimeUtils.stampToDate(System.currentTimeMillis()));
+        if (userInfoModels != null) {
+            mTvTodayReg.setText(userInfoModels.size() + "");
+        }
+        List<UserInfoModel> onVisitModels = DatabaseManager.getInstance().query(UserInfoModel.class, "state", 2 + "");
+        if (onVisitModels != null) {
+            mTvOnVisit.setText(onVisitModels.size() + "");
+        }
+        List<UserInfoModel> leaveModels = DatabaseManager.getInstance().query(UserInfoModel.class, "state", 3 + "");
+        if (leaveModels != null) {
+            mTvLeave.setText(leaveModels.size() + "");
         }
     }
 

+ 1 - 0
app/src/main/java/com/sunwin/visitorapp/fragment/IdcardRegFragment.java

@@ -100,6 +100,7 @@ public class IdcardRegFragment extends BaseFragment implements IdCardReadCallbac
         BaseApplication.getSystemTTS().playText("识别成功");
         Intent intent = new Intent(mContext, VisitorRegisterAc.class);
         intent.putExtra(Constant.IIntentValue.CURRENTFACEPATH,info.getCurrentFace());
+        intent.putExtra(Constant.IIntentValue.RECOGNIZE_INFO,info);
         startActivity(intent);
     }
 

+ 2 - 1
app/src/main/java/com/sunwin/visitorapp/fragment/NoCardRegFragment.java

@@ -13,6 +13,7 @@ import androidx.annotation.Nullable;
 import com.sunwin.visitorapp.BaseApplication;
 import com.sunwin.visitorapp.BaseFragment;
 import com.sunwin.visitorapp.R;
+import com.sunwin.visitorapp.activity.VisitInputActivity;
 import com.sunwin.visitorapp.activity.VisitorRegisterAc;
 import com.sunwin.visitorapp.face.CameraPreviewData;
 import com.sunwin.visitorapp.model.OpenDoorByFaceNetResultInfo;
@@ -98,7 +99,7 @@ public class NoCardRegFragment extends BaseFragment implements FaceDetecterView.
                 new Handler().postDelayed(new Runnable() {
                     @Override
                     public void run() {
-                        Intent intent = new Intent(mContext, VisitorRegisterAc.class);
+                        Intent intent = new Intent(mContext, VisitInputActivity.class);
                         intent.putExtra(Constant.IIntentValue.CURRENTFACEPATH, saveFilePath);
                         startActivity(intent);
                     }

+ 36 - 5
app/src/main/java/com/sunwin/visitorapp/fragment/VisitSignFragment.java

@@ -1,5 +1,6 @@
 package com.sunwin.visitorapp.fragment;
 
+import android.content.Intent;
 import android.os.Bundle;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -11,7 +12,10 @@ import androidx.annotation.Nullable;
 
 import com.sunwin.visitorapp.BaseFragment;
 import com.sunwin.visitorapp.R;
+import com.sunwin.visitorapp.activity.VisitSignActivity;
 import com.sunwin.visitorapp.adapter.VisitSignAdapter;
+import com.sunwin.visitorapp.utils.Constant;
+import com.sunwin.visitorapp.utils.ToastUtils;
 import com.sunwin.visitorapp.view.MyGridView;
 
 import org.jetbrains.annotations.NotNull;
@@ -23,6 +27,16 @@ public class VisitSignFragment extends BaseFragment implements AdapterView.OnIte
     private ArrayList<String> itemList;
     private ArrayList<Integer> iconList;
 
+    public static VisitSignFragment newInstance(int visitType) {
+        VisitSignFragment fragment = new VisitSignFragment();
+
+        Bundle bundle = new Bundle();
+        bundle.putInt(Constant.IIntentValue.VISIT_TYPE, visitType);
+        fragment.setArguments(bundle);
+
+        return fragment;
+    }
+
     @Nullable
     @Override
     public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
@@ -35,12 +49,16 @@ public class VisitSignFragment extends BaseFragment implements AdapterView.OnIte
     @Override
     public void onViewCreated(@NonNull @NotNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
-        initView(view);
         initData();
+        initView(view);
     }
 
 
+    int visitType;
+
     private void initData() {
+        Bundle arguments = getArguments();
+        visitType = arguments.getInt(Constant.IIntentValue.VISIT_TYPE);
         itemList = new ArrayList<>();
         iconList = new ArrayList<>();
         itemList.add("身份证");
@@ -49,14 +67,15 @@ public class VisitSignFragment extends BaseFragment implements AdapterView.OnIte
         iconList.add(R.mipmap.visit_sign_idcard);
         iconList.add(R.mipmap.visit_sign_face);
         iconList.add(R.mipmap.visit_sign_qrcode);
-       /* if (isLoginUser) {
-            itemList.add("驾驶证");
-            iconList.add(R.mipmap.visitor_reg_default);
-        }*/
+        if (visitType == 2) {
+            itemList.add("IC卡");
+            iconList.add(R.mipmap.visit_sign_iccard);
+        }
     }
 
     private void initView(@NotNull View view) {
         mGridview = view.findViewById(R.id.gridview);
+        mGridview.setNumColumns(visitType == 2 ? 4 : 3);
         VisitSignAdapter mAdapter = new VisitSignAdapter(itemList, iconList);
         mGridview.setAdapter(mAdapter);
         mGridview.setOnItemClickListener(this);
@@ -64,13 +83,25 @@ public class VisitSignFragment extends BaseFragment implements AdapterView.OnIte
 
     @Override
     public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
+
         switch (i) {
             case 0:
+                startVisitSign(visitType, 1);
                 break;
             case 1:
+                startVisitSign(visitType, 2);
                 break;
             case 2:
+            case 3:
+                ToastUtils.showToast("开发中...");
                 break;
         }
     }
+
+    private void startVisitSign(int visitType, int visitSignType) {
+        Intent intent = new Intent(mContext, VisitSignActivity.class);
+        intent.putExtra(Constant.IIntentValue.VISIT_TYPE, visitType);
+        intent.putExtra(Constant.IIntentValue.VISIT_SIGN_TYPE, visitSignType);
+        startActivity(intent);
+    }
 }

+ 10 - 0
app/src/main/java/com/sunwin/visitorapp/model/OpenDoorByFaceNetResultInfo.java

@@ -8,6 +8,16 @@ public class OpenDoorByFaceNetResultInfo extends NetResultInfo{
     private String message = "";
     private String person_name = "";
     private String person_code = "";
+
+    public String getIdNum() {
+        return idNum;
+    }
+
+    public void setIdNum(String idNum) {
+        this.idNum = idNum;
+    }
+
+    private String idNum = "";
     private String person_id_card = "";
     private String currentFace ="";
     private double similarity;

+ 3 - 2
app/src/main/java/com/sunwin/visitorapp/utils/BitmapUtils.java

@@ -1576,7 +1576,8 @@ public class BitmapUtils {
         }
 
         bitmap = BitmapUtils.scaleBitmap(bitmap, bitmap.getWidth(), bitmap.getHeight());
-        File file = new File(dirPath + fileName + ".jpg");
+        String filePath = dirPath + fileName + ".jpg";
+        File file = new File(filePath);
         FileOutputStream out = null;
         try {
             out = new FileOutputStream(file);
@@ -1591,7 +1592,7 @@ public class BitmapUtils {
             e.printStackTrace();
         }
 
-        return "file://" + dirPath + fileName + ".jpg";
+        return filePath;
     }
     public static String scaleBitmap(String screenShotPath) {
         Bitmap bitmap = decodeImage(screenShotPath);

+ 6 - 2
app/src/main/java/com/sunwin/visitorapp/utils/Constant.java

@@ -1,6 +1,9 @@
 package com.sunwin.visitorapp.utils;
 
 
+import android.app.usage.ExternalStorageStats;
+import android.os.Environment;
+
 public class Constant {
 
     final public static int rotate = SharePrefenceUtils.getInt("cameraRotate", 0);
@@ -21,7 +24,7 @@ public class Constant {
     public static final String SWBINDIR = "/sdcard/models";
     public static final String SWRECODE = "/sdcard/swRecode";
 
-    public static final String RecognitionDir = "/sdcard/faceRecognition/"; //记录图片存储位置
+    public static final String RecognitionDir = Environment.getExternalStorageDirectory()+"/faceRecognition/"; //记录图片存储位置
 
     public static volatile boolean isReConnectUsb = false;//是否重新连接
 
@@ -34,7 +37,7 @@ public class Constant {
     public interface ISharePrefence {
 
         String BASEURL = "baseurl";
-        String LOGINTAG = "logintag";
+        String LOGINTAG = "loginTag";
         String ISINIT = "isInit";
     }
 
@@ -47,6 +50,7 @@ public class Constant {
         String ISLOGINUSER = "isLoginUser";
         String VISIT_SIGN_TYPE = "visitSignType";//1,身份证,2 人脸
         String VISIT_TYPE = "visitType";//1,签到,2 签离
+        String RECOGNIZE_INFO = "recognizeInfo";
     }
 
     public interface NumerValue {

+ 3 - 1
app/src/main/java/com/sunwin/visitorapp/view/FaceDetecterView.java

@@ -115,7 +115,9 @@ public class FaceDetecterView extends RelativeLayout {
     }
 
     public void onDestroy() {
-        mFRAbsLoop.shutdown();
+        if (mFRAbsLoop!= null){
+            mFRAbsLoop.shutdown();
+        }
         BaseApplication.getSystemTTS().stopSpeak();
         EventBus.getDefault().unregister(this);
     }

+ 54 - 38
app/src/main/res/layout/activity_home.xml

@@ -1,19 +1,70 @@
 <?xml version="1.0" encoding="utf-8"?>
 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tool="http://schemas.android.com/tools"
-    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@drawable/login_button_normal"
     android:orientation="vertical">
 
     <FrameLayout
+        android:id="@+id/fl_title"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent">
+
+        <com.sunwin.visitorapp.view.UINav
+            android:id="@+id/UINav"
+            android:visibility="gone"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content" />
+
+        <RelativeLayout
+            android:id="@+id/ll_home_title"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+            <TextView
+                android:id="@+id/TextTitle"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_centerInParent="true"
+                android:padding="15dp"
+                android:text="@string/app_name"
+                android:textColor="@color/black"
+                android:textSize="@dimen/sp_25" />
+
+            <ImageView
+                android:id="@+id/ImageStatus"
+                android:layout_width="60dp"
+                android:layout_height="60dp"
+                android:layout_toLeftOf="@+id/ImageSetting"
+                android:padding="10dp"
+                android:scaleType="fitCenter"
+                android:src="@drawable/ui_vector_status" />
+
+            <ImageView
+                android:id="@+id/ImageSetting"
+                android:layout_width="60dp"
+                android:layout_height="60dp"
+                android:layout_alignParentRight="true"
+                android:layout_marginLeft="20dp"
+                android:padding="10dp"
+                android:scaleType="fitCenter"
+                android:src="@drawable/ui_vector_setting" />
+        </RelativeLayout>
+    </FrameLayout>
+
+
+    <FrameLayout
         android:id="@+id/FragmentView"
         android:layout_width="0dp"
         android:layout_height="0dp"
         android:layout_marginStart="10dp"
         android:layout_marginEnd="40dp"
+        android:background="@drawable/card_white"
         app:layout_constraintBottom_toBottomOf="@id/ViewClock"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintHorizontal_weight="5"
@@ -28,29 +79,6 @@
 
     </FrameLayout>
 
-    <ImageView
-        android:id="@+id/ImageStatus"
-        android:layout_width="0dp"
-        android:layout_height="0dp"
-        android:padding="10dp"
-        android:scaleType="fitCenter"
-        android:src="@drawable/ui_vector_status"
-        app:layout_constraintBottom_toBottomOf="@id/TextTitle"
-        app:layout_constraintDimensionRatio="1.2:1"
-        app:layout_constraintEnd_toStartOf="@id/ImageSetting"
-        app:layout_constraintTop_toTopOf="@id/TextTitle" />
-
-    <ImageView
-        android:id="@+id/ImageSetting"
-        android:layout_width="0dp"
-        android:layout_height="0dp"
-        android:padding="10dp"
-        android:scaleType="fitCenter"
-        android:src="@drawable/ui_vector_setting"
-        app:layout_constraintBottom_toBottomOf="@id/TextTitle"
-        app:layout_constraintDimensionRatio="1.2:1"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="@id/TextTitle" />
 
     <LinearLayout
         android:id="@+id/ViewClock"
@@ -67,7 +95,7 @@
         app:layout_constraintHorizontal_weight="2"
         app:layout_constraintStart_toStartOf="parent"
 
-        app:layout_constraintTop_toBottomOf="@id/TextTitle"
+        app:layout_constraintTop_toBottomOf="@id/fl_title"
 
         >
 
@@ -158,17 +186,5 @@
         </LinearLayout>
     </LinearLayout>
 
-    <TextView
-        android:id="@+id/TextTitle"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:padding="15dp"
-        android:text="@string/app_name"
-        android:textColor="@color/black"
-        android:textSize="@dimen/sp_25"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
-
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 71 - 0
app/src/main/res/layout/activity_visit_input.xml

@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@mipmap/bg_app"
+    android:orientation="vertical">
+
+    <com.sunwin.visitorapp.view.UINav
+        android:id="@+id/UINav"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content" />
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_marginStart="40dp"
+        android:layout_marginTop="10dp"
+        android:layout_marginEnd="40dp"
+        android:paddingTop="30dp"
+        android:layout_marginBottom="30dp"
+        android:background="@drawable/card_white"
+        android:orientation="vertical">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginVertical="10dp"
+            android:orientation="horizontal">
+
+            <TextView
+                style="@style/StyleTextContent"
+                android:layout_width="150dp"
+                android:text="人员姓名" />
+
+            <EditText
+                android:id="@+id/EditName"
+                style="@style/StyleInputContent"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1" />
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginVertical="10dp"
+            android:orientation="horizontal">
+
+            <TextView
+                style="@style/StyleTextContent"
+                android:layout_width="150dp"
+                android:text="身份证号" />
+
+            <EditText
+                android:id="@+id/EditICCode"
+                style="@style/StyleInputContent"
+                android:layout_width="0dp"
+                android:inputType="text"
+                android:layout_height="wrap_content"
+                android:layout_weight="1" />
+        </LinearLayout>
+
+        <Button
+            android:layout_marginTop="30dp"
+            android:layout_gravity="center_horizontal"
+            android:id="@+id/btn_next"
+            android:layout_width="150dp"
+            android:layout_height="40dp"
+            android:text="下一步" />
+    </LinearLayout>
+</LinearLayout>

+ 1 - 0
app/src/main/res/layout/fragment_visit_sign.xml

@@ -3,6 +3,7 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:gravity="center_vertical"
     android:orientation="vertical">
 
     <com.sunwin.visitorapp.view.MyGridView

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