|  |  |  | 
|---|
|  |  |  | import com.doumee.keyCabinet.base.MyBaseActivity; | 
|---|
|  |  |  | import com.doumee.keyCabinet.databinding.FaceActivityBinding; | 
|---|
|  |  |  | import com.doumee.keyCabinet.event.FaceStatusChangeEvent; | 
|---|
|  |  |  | import com.doumee.keyCabinet.event.HttpEvent; | 
|---|
|  |  |  | import com.doumee.keyCabinet.event.JiujinBeginEvent; | 
|---|
|  |  |  | import com.doumee.keyCabinet.event.JiujinResultEvent; | 
|---|
|  |  |  | import com.doumee.keyCabinet.event.TimeClockEvent; | 
|---|
|  |  |  | 
|---|
|  |  |  | private void statusFsm(int toStatus){ | 
|---|
|  |  |  | status = toStatus; | 
|---|
|  |  |  | isToChose = false; | 
|---|
|  |  |  | getDB().etEwm.requestFocus(); | 
|---|
|  |  |  | switch (toStatus){ | 
|---|
|  |  |  | case 0: | 
|---|
|  |  |  | //取-管理员人脸验证 | 
|---|
|  |  |  | 
|---|
|  |  |  | case 1: | 
|---|
|  |  |  | //取-管理员刷卡验证 | 
|---|
|  |  |  | getDB().etEwm.setText(""); | 
|---|
|  |  |  | getDB().etEwm.requestFocus(); | 
|---|
|  |  |  | getDB().tvTitle.setText("管理员身份验证"); | 
|---|
|  |  |  | getDB().clFace.setVisibility(View.GONE); | 
|---|
|  |  |  | getDB().clCard.setVisibility(View.VISIBLE); | 
|---|
|  |  |  | 
|---|
|  |  |  | //取-司机酒精检测失败 | 
|---|
|  |  |  | //Toast.makeText(mContext, "司机酒精检测失败", Toast.LENGTH_SHORT).show(); | 
|---|
|  |  |  | getDB().clJiu.setVisibility(View.GONE); | 
|---|
|  |  |  | getDB().tvJg1.setText("酒精检测异常,请重新检测"); | 
|---|
|  |  |  | getDB().tvJg1.setText("酒精检测操作不当,请重新检测"); | 
|---|
|  |  |  | getDB().clTip1.setVisibility(View.VISIBLE); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 7: | 
|---|
|  |  |  | 
|---|
|  |  |  | finish(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 8: | 
|---|
|  |  |  | getDB().message.setText(data.getData().get("obj").toString()); | 
|---|
|  |  |  | getDB().message.setVisibility(View.VISIBLE); | 
|---|
|  |  |  | handler.sendEmptyMessageDelayed(6,2000); | 
|---|
|  |  |  | getDB().message.invalidate(); | 
|---|
|  |  |  | getDB().message.requestLayout(); | 
|---|
|  |  |  | EventBus.getDefault().post(new HttpEvent("ic卡+++++++"+data.getData().get("type").toString())); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | default: | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | //ic卡读取 | 
|---|
|  |  |  | getDB().etEwm.requestFocus(); | 
|---|
|  |  |  | getDB().etEwm.setFocusable(true); | 
|---|
|  |  |  | getDB().etEwm.setShowSoftInputOnFocus(true); | 
|---|
|  |  |  | getDB().etEwm.setShowSoftInputOnFocus(false); | 
|---|
|  |  |  | hideSoftKeyboard(getDB().etEwm); | 
|---|
|  |  |  | getDB().etEwm.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | hideSoftKeyboard(getDB().etEwm); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | getDB().etEwm.addTextChangedListener(new TextWatcher() { | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | 
|---|
|  |  |  | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(status!=1&&status!=3&&status!=8){ | 
|---|
|  |  |  | getDB().etEwm.setText(""); | 
|---|
|  |  |  | getDB().etEwm.requestFocus(); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(handler.hasMessages(5)){ | 
|---|
|  |  |  | 
|---|
|  |  |  | getVM().alcoholTestAlarm(resultEvent.getConcentration().toString()); | 
|---|
|  |  |  | //Toast.makeText(mContext, "酒精检测超标", Toast.LENGTH_SHORT).show(); | 
|---|
|  |  |  | statusFsm(9); | 
|---|
|  |  |  | //再检测,将声音关闭 | 
|---|
|  |  |  | EventBus.getDefault().post(new JiujinBeginEvent()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 4: | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | getDB().etEwm.setText(""); | 
|---|
|  |  |  | getDB().etEwm.requestFocus(); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 6: | 
|---|
|  |  |  | getDB().message.setVisibility(View.GONE); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | default: | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | 
|---|
|  |  |  | User user = livenessModel.getUser(); | 
|---|
|  |  |  | if (user == null) { | 
|---|
|  |  |  | mUser = null; | 
|---|
|  |  |  | //EventBus.getDefault().post(new HttpEvent("人脸用户检测失败------->"+(status==0?"管理员人脸检测:":"司机人脸检测:"))); | 
|---|
|  |  |  | if (isCompareCheck) { | 
|---|
|  |  |  | /*getDB().clFail.setVisibility(View.VISIBLE); | 
|---|
|  |  |  | getDB().tv4.setText(getString(R.string.face_tip2)); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | mUser = user; | 
|---|
|  |  |  | /*EventBus.getDefault().post(new HttpEvent("人脸用户------->"+(status==0?"管理员人脸检测:":"司机人脸检测:") | 
|---|
|  |  |  | +(user.getGroupId().equals("0")?"管理员":"司机")));*/ | 
|---|
|  |  |  | if (isCompareCheck) { | 
|---|
|  |  |  | getDB().clFail.setVisibility(View.GONE); | 
|---|
|  |  |  | if(handler.hasMessages(0)) { | 
|---|
|  |  |  | 
|---|
|  |  |  | @Subscribe(threadMode = ThreadMode.MAIN) | 
|---|
|  |  |  | public void JiujinResultEvent(JiujinResultEvent e){ | 
|---|
|  |  |  | if(!isFinishing()){ | 
|---|
|  |  |  | if(status!=4&&status!=6){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //Toast.makeText(mContext, "酒精检测返回:"+e.isOk(), Toast.LENGTH_SHORT).show(); | 
|---|
|  |  |  | if(!e.isOk()){ | 
|---|
|  |  |  | getDB().clJiujinProgress.setVisibility(View.GONE); | 
|---|