| | |
| | | package safeluck.drive.evaluation.fragment; |
| | | |
| | | import android.content.Context; |
| | | import android.graphics.Color; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.os.Bundle; |
| | | |
| | | import android.os.Handler; |
| | | import android.os.Message; |
| | | import android.text.SpannableString; |
| | | import android.text.Spanned; |
| | | import android.text.TextUtils; |
| | | import android.text.style.AbsoluteSizeSpan; |
| | | import android.text.style.ForegroundColorSpan; |
| | | import android.util.Base64; |
| | | import android.util.Log; |
| | | import android.view.LayoutInflater; |
| | | import android.view.MotionEvent; |
| | |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.fragment.app.DialogFragment; |
| | | import androidx.lifecycle.Observer; |
| | | import androidx.lifecycle.ViewModelProviders; |
| | | import androidx.work.OneTimeWorkRequest; |
| | |
| | | |
| | | import com.anyun.exam.lib.AYSdk; |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.google.gson.Gson; |
| | | import com.squareup.picasso.Picasso; |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | |
| | | import safeluck.drive.evaluation.Constant; |
| | | import safeluck.drive.evaluation.DB.Student; |
| | | import safeluck.drive.evaluation.DB.WokViewModel; |
| | | import safeluck.drive.evaluation.DB.appstatusdb.AppStatus; |
| | | import safeluck.drive.evaluation.DB.appstatusdb.AppStatusViewModel; |
| | | import safeluck.drive.evaluation.DB.exam_status.ExamStatusInitWorker; |
| | | import safeluck.drive.evaluation.DB.exam_status.ExamStatusViewModel; |
| | | import safeluck.drive.evaluation.DB.failitems.FailedProjViewModel; |
| | | import safeluck.drive.evaluation.DB.failitems.FailedProj_select; |
| | | import safeluck.drive.evaluation.MainActivity; |
| | | import safeluck.drive.evaluation.R; |
| | | import safeluck.drive.evaluation.adapter.ScoreAdapter; |
| | | import safeluck.drive.evaluation.DB.exam_status.ExamStatus; |
| | | import safeluck.drive.evaluation.bean.ExamPlatformData; |
| | | import safeluck.drive.evaluation.bean.ScoreBean; |
| | | import safeluck.drive.evaluation.bean.SimulateNightBean; |
| | | import safeluck.drive.evaluation.cEventCenter.CEventCenter; |
| | | import safeluck.drive.evaluation.cEventCenter.ICEventListener; |
| | | import safeluck.drive.evaluation.customview.ArrowView; |
| | | import safeluck.drive.evaluation.customview.HouseView; |
| | | import safeluck.drive.evaluation.customview.LoadProgressDialog; |
| | | import safeluck.drive.evaluation.customview.MyDialogFragment; |
| | | import safeluck.drive.evaluation.customview.QRCodeDialog; |
| | | import safeluck.drive.evaluation.httpmodule.RetrofitCreator; |
| | | import safeluck.drive.evaluation.customview.SelectDialog; |
| | | import safeluck.drive.evaluation.im.MessageProcessor; |
| | | import safeluck.drive.evaluation.platformMessage.JKMessage0201; |
| | | import safeluck.drive.evaluation.platformMessage.JKMessage0202; |
| | | import safeluck.drive.evaluation.platformMessage.JKMessage0204; |
| | | import safeluck.drive.evaluation.platformMessage.PlatFormConstant; |
| | | import safeluck.drive.evaluation.util.Utils; |
| | | import safeluck.drive.evaluation.viewmodels.TimeViewModel; |
| | | |
| | | /** |
| | | * 联网训练UI |
| | |
| | | private ListView mListView; |
| | | private Button btn_start_exam; |
| | | private TextView tv_stop;//呼叫请求(结束考试) |
| | | private Gson gson = new Gson(); |
| | | private ScoreAdapter mScoreAdapter; |
| | | private ArrowView av_zhijiao, av_curve, av_park, av_podao; |
| | | private HouseView houseView; |
| | | private Button av_zhijiao, av_curve, av_park, av_podao; |
| | | private Button houseView; |
| | | private List<ExamStatus> examStatusList = new ArrayList<>(); |
| | | private List<String> item_conents = new ArrayList<>();//坡道定点停车和起步 |
| | | private int changKaoCount=0; |
| | |
| | | private int item_id;//扣分分数总和 |
| | | private ExamStatusViewModel examStatusViewModel; |
| | | private static final int ADD_DATA = 1; |
| | | private TextView tv_speed,tv_total_score,tv_sat_num,tv_name,tv_id,tv_work_platform,tv_network_time, |
| | | tv_qf,tv_start_time,tv_sex; |
| | | private TextView tv_speed,tv_total_score,tv_name, |
| | | tv_start_time,tv_coach_name; |
| | | private double speed=0.0; |
| | | private ImageView iv_rtk_status,iv_head; |
| | | private ImageView iv_head,iv_coach_head; |
| | | |
| | | private int currTotalScore = 100; |
| | | private List<ScoreBean> mArrayList = new ArrayList<>(); |
| | |
| | | public boolean handleMessage(Message msg) { |
| | | if (msg.what == ADD_DATA){ |
| | | MyLog.i("handler add_data totalScore="+currTotalScore); |
| | | tv_total_score.setText(getResources().getString(R.string.total_score,currTotalScore)); |
| | | houseView.setColor(aaa(safeluck.drive.evaluation.DB.Constant.EXAM_MAP_TYPE_REVERSE));//倒车入库 type =1 |
| | | av_podao.setColor(aaa(safeluck.drive.evaluation.DB.Constant.EXAM_MAP_TYPE_RAMP)); |
| | | av_park.setColor(aaa(safeluck.drive.evaluation.DB.Constant.EXAM_MAP_TYPE_PARK)); |
| | | av_curve.setColor(aaa(safeluck.drive.evaluation.DB.Constant.EXAM_MAP_TYPE_CURVE)); |
| | | av_zhijiao.setColor(aaa(safeluck.drive.evaluation.DB.Constant.EXAM_MAP_TYPE_ANGLE)); |
| | | setTotalScoreText(); |
| | | houseView.setBackground(aaa(safeluck.drive.evaluation.DB.Constant.EXAM_MAP_TYPE_REVERSE));//倒车入库 type =1 |
| | | av_podao.setBackground(aaa(safeluck.drive.evaluation.DB.Constant.EXAM_MAP_TYPE_RAMP)); |
| | | av_park.setBackground(aaa(safeluck.drive.evaluation.DB.Constant.EXAM_MAP_TYPE_PARK)); |
| | | av_curve.setBackground(aaa(safeluck.drive.evaluation.DB.Constant.EXAM_MAP_TYPE_CURVE)); |
| | | av_zhijiao.setBackground(aaa(safeluck.drive.evaluation.DB.Constant.EXAM_MAP_TYPE_ANGLE)); |
| | | |
| | | for (int i = 0; i < btn_ids.size(); i++) { |
| | | int viewId = getResources().getIdentifier(String.valueOf(btn_ids.get(i)),"id",_mActivity.getPackageName()); |
| | |
| | | } |
| | | }); |
| | | |
| | | private int aaa(int type) { |
| | | private Drawable aaa(int type) { |
| | | if (examStatusList!=null &&examStatusList.size()>0){ |
| | | for (ExamStatus examStatus: |
| | | examStatusList) { |
| | | examStatusList) { |
| | | if (type == examStatus.getMap_item()){ |
| | | if (examStatus.getEnter() == safeluck.drive.evaluation.DB.Constant.BEGIN_ITEM){ |
| | | //进入考场 |
| | | if (examStatusList.get(0).getStartExam() == Constant.NONE_BEEN_START_EXAM){ |
| | | //结束考试了 |
| | | MyLog.i("进入考场结束考试,startexam="+examStatus.getStartExam()); |
| | | return getResources().getColor(R.color.colorAccent); |
| | | return getResources().getDrawable(R.drawable.ic_btn_fail); |
| | | }else{ |
| | | MyLog.i("进入考场,type="+type); |
| | | return getResources().getColor(R.color.pink); |
| | | return getResources().getDrawable(R.drawable.ic_btn_examing); |
| | | } |
| | | |
| | | |
| | | }else if (examStatus.getEnter() == safeluck.drive.evaluation.DB.Constant.FINISH_ITEM){ |
| | | |
| | | if (examStatusList.get(0).getStartExam()==Constant.NONE_BEEN_START_EXAM){ |
| | | return getResources().getColor(R.color.examing); |
| | | return getResources().getDrawable(R.drawable.ic_btn_daikao); |
| | | } |
| | | |
| | | switch (type) { |
| | |
| | | if (item_conents.contains("倒车入库")) { |
| | | MyLog.i("该项考试失败,type="+type); |
| | | |
| | | return getResources().getColor(R.color.colorAccent); |
| | | return getResources().getDrawable(R.drawable.ic_btn_fail); |
| | | }else{ |
| | | if (examStatus.getResult() ==1){ |
| | | MyLog.i("已经播放过倒车入库合格"); |
| | |
| | | examStatusViewModel.updateItemExamResult(1,examStatus.getMap_id()); |
| | | } |
| | | |
| | | return getResources().getColor(R.color.train_btn_return); |
| | | return getResources().getDrawable(R.drawable.ic_btn_succ); |
| | | } |
| | | case 2: |
| | | if (item_conents.contains("坡道定点停车和起步")) { |
| | | MyLog.i("该项考试失败,type="+type); |
| | | return getResources().getColor(R.color.colorAccent); |
| | | return getResources().getDrawable(R.drawable.ic_btn_fail); |
| | | }else{ |
| | | if (examStatus.getResult() ==1){ |
| | | MyLog.i("已经播放过坡道定点停车和起步合格合格"); |
| | |
| | | examStatusViewModel.updateItemExamResult(1,examStatus.getMap_id()); |
| | | } |
| | | |
| | | return getResources().getColor(R.color.train_btn_return); |
| | | return getResources().getDrawable(R.drawable.ic_btn_succ); |
| | | } |
| | | case 3: |
| | | if (item_conents.contains("侧方停车")) { |
| | | MyLog.i("该项考试失败,type="+type); |
| | | return getResources().getColor(R.color.colorAccent); |
| | | return getResources().getDrawable(R.drawable.ic_btn_fail); |
| | | }else{ |
| | | if (examStatus.getResult() ==1){ |
| | | MyLog.i("已经播放过侧方停车合格"); |
| | |
| | | ExamPlatformData.getInstance().getTTS().speak("侧方停车合格"); |
| | | examStatusViewModel.updateItemExamResult(1,examStatus.getMap_id()); |
| | | } |
| | | return getResources().getColor(R.color.train_btn_return); |
| | | return getResources().getDrawable(R.drawable.ic_btn_succ); |
| | | } |
| | | case 4: |
| | | if (item_conents.contains("曲线行驶")) { |
| | | MyLog.i("该项考试失败,type="+type); |
| | | return getResources().getColor(R.color.colorAccent); |
| | | return getResources().getDrawable(R.drawable.ic_btn_fail); |
| | | }else{ |
| | | if (examStatus.getResult() ==1){ |
| | | MyLog.i("已经播放过曲线行驶合格"); |
| | |
| | | ExamPlatformData.getInstance().getTTS().speak("曲线行驶合格"); |
| | | examStatusViewModel.updateItemExamResult(1,examStatus.getMap_id()); |
| | | } |
| | | return getResources().getColor(R.color.train_btn_return); |
| | | return getResources().getDrawable(R.drawable.ic_btn_succ); |
| | | } |
| | | case 5: |
| | | if (item_conents.contains("直角转弯")) { |
| | | MyLog.i("该项考试失败,type="+type); |
| | | return getResources().getColor(R.color.colorAccent); |
| | | return getResources().getDrawable(R.drawable.ic_btn_fail); |
| | | }else{ |
| | | if (examStatus.getResult() ==1){ |
| | | MyLog.i("已经播放过直角转弯合格"); |
| | |
| | | examStatusViewModel.updateItemExamResult(1,examStatus.getMap_id()); |
| | | } |
| | | |
| | | return getResources().getColor(R.color.train_btn_return); |
| | | return getResources().getDrawable(R.drawable.ic_btn_succ); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | }else{ |
| | | return getResources().getColor(R.color.examing); |
| | | return getResources().getDrawable(R.drawable.ic_btn_daikao); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return getResources().getColor(R.color.examing); |
| | | return getResources().getDrawable(R.drawable.ic_btn_daikao); |
| | | } |
| | | |
| | | /** |
| | | * 路考项目 每个项目的颜色变化 |
| | | * @param type |
| | |
| | | examStatusList.addAll(examStatus); |
| | | mHandler.obtainMessage(ADD_DATA).sendToTarget(); |
| | | if (examStatus.get(0).getStartExam() != Constant.NONE_BEEN_START_EXAM){ |
| | | btn_start_exam.setEnabled(false); |
| | | tv_stop.setEnabled(true); |
| | | iv_head.getDrawable().setLevel(1); |
| | | btn_start_exam.setText("结束考试"); |
| | | }else{ |
| | | btn_start_exam.setEnabled(true); |
| | | tv_stop.setEnabled(false); |
| | | iv_head.getDrawable().setLevel(0); |
| | | btn_start_exam.setText("开始考试"); |
| | | } |
| | | exam_type = examStatus.get(0).getStartExam(); |
| | | } |
| | |
| | | for (Student student : |
| | | students) { |
| | | MyLog.i(TAG, "onChanged: " + student.toString()); |
| | | if (!TextUtils.isEmpty(student.getName())&&student.getStu_id()==ExamPlatformData.STU_ID){ |
| | | |
| | | tv_name.setText(getString(R.string.name)+student.getName()); |
| | | tv_id.setText(getString(R.string.user_id)+student.getID()); |
| | | ExamPlatformData.getInstance().setId(student.getID()); |
| | | tv_sex.setText(getString(R.string.sex)+(student.getSex()==2?"女":"男")); |
| | | tv_start_time.setText(getString(R.string.begin_time)+Utils.formatTimeYYMMDDHHmmSS(student.getBegin_time())); |
| | | }else if (!TextUtils.isEmpty(student.getName())&&student.getStu_id()==ExamPlatformData.COACH_ID){ |
| | | ExamPlatformData.getInstance().setCoachID(student.getID()); |
| | | if (ExamPlatformData.getInstance().getSign_mode()==ExamPlatformData.SIGN_MODE_EXAM){ |
| | | if (!TextUtils.isEmpty(student.getName())&&student.getStu_id()==ExamPlatformData.STU_ID){ |
| | | tv_name.setText(getNameColor(student.getName())); |
| | | Picasso.with(_mActivity).load(student.getHead_url()).into(iv_head); |
| | | ExamPlatformData.getInstance().setId(student.getID()); |
| | | tv_start_time.setText(getString(R.string.begin_time)+Utils.formatTimeYYMMDDHHmmSS(student.getBegin_time())); |
| | | }else if (!TextUtils.isEmpty(student.getName())&&student.getStu_id()==ExamPlatformData.COACH_ID){ |
| | | ExamPlatformData.getInstance().setCoachID(student.getID()); |
| | | tv_coach_name.setText(getNameColor(student.getName())); |
| | | Picasso.with(_mActivity).load(student.getHead_url()).into(iv_coach_head); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | AppStatusViewModel appStatusViewModel = ViewModelProviders.of(this).get(AppStatusViewModel.class); |
| | | appStatusViewModel.getAppStatus().observe(this, new Observer<AppStatus>() { |
| | | @Override |
| | | public void onChanged(AppStatus appStatus) { |
| | | if (appStatus != null){ |
| | | Log.i(TAG, "onChanged: "+appStatus.toString()); |
| | | iv_rtk_status.getDrawable().setLevel(appStatus.getRtk_connect_status()); |
| | | tv_work_platform.setText(getString(R.string.platform_status,ExamPlatformData.getInstance().getExamplatformStatusStr( |
| | | ExamPlatformData.getInstance().getExamplatformStatus()))); |
| | | tv_sat_num.setText(String.valueOf(appStatus.getSat_num()).length()==1?"0"+appStatus.getSat_num():String.valueOf(appStatus.getSat_num())); |
| | | tv_qf.setText(getResources().getStringArray(R.array.qf_status)[appStatus.getQf()]); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | TimeViewModel timeViewModel = ViewModelProviders.of(this).get(TimeViewModel.class); |
| | | timeViewModel.getLiveDataTime().observe(this, new Observer<String>() { |
| | | @Override |
| | | public void onChanged(String s) { |
| | | tv_network_time.setText(s); |
| | | } |
| | | }); |
| | | |
| | | return view; |
| | | } |
| | | |
| | | private SpannableString getNameColor(String str) { |
| | | SpannableString spannableString = new SpannableString(str); |
| | | spannableString.setSpan(new ForegroundColorSpan(Color.parseColor("#60FFFF")),0, |
| | | str.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); |
| | | |
| | | return spannableString; |
| | | } |
| | | |
| | | |
| | | private void initView(View view) { |
| | | Log.i(TAG,"currTopFragment="+getTopFragment().getClass().getSimpleName()); |
| | | if (HomeFragment.class.getSimpleName().equals(getTopFragment().getClass().getSimpleName())){ |
| | | ((MainActivity)_mActivity).viewtitle.setVisibility(View.GONE); |
| | | ((MainActivity)_mActivity).btn_return.setVisibility(View.GONE); |
| | | }else{ |
| | | ((MainActivity)_mActivity).viewtitle.setVisibility(View.VISIBLE); |
| | | ((MainActivity)_mActivity).btn_return.setVisibility(View.VISIBLE); |
| | | } |
| | | btn_ids.add(R.id.btn_1); |
| | | btn_ids.add(R.id.btn_2); |
| | | btn_ids.add(R.id.btn_3); |
| | |
| | | btn_ids.add(R.id.btn_9); |
| | | btn_ids.add(R.id.btn_10); |
| | | |
| | | view.findViewById(R.id.iv_head).setOnClickListener(this); |
| | | ((TextView)view.findViewById(R.id.tv_score_tip)).setText("当前考试得分"); |
| | | av_curve = view.findViewById(R.id.av3); |
| | | av_park = view.findViewById(R.id.av2); |
| | | av_podao = view.findViewById(R.id.av1); |
| | | av_zhijiao = view.findViewById(R.id.av4); |
| | | houseView = view.findViewById(R.id.hv); |
| | | tv_name = view.findViewById(R.id.tv_name); |
| | | tv_id = view.findViewById(R.id.tv_ID); |
| | | tv_coach_name = view.findViewById(R.id.tv_coach_name); |
| | | tv_start_time = view.findViewById(R.id.tv_start_time); |
| | | tv_sex = view.findViewById(R.id.tv_sex); |
| | | tv_work_platform = view.findViewById(R.id.platform); |
| | | |
| | | iv_rtk_status = view.findViewById(R.id.iv_rtk_connect); |
| | | iv_rtk_status.getDrawable().setLevel(0); |
| | | |
| | | iv_head = view.findViewById(R.id.iv_head); |
| | | tv_sat_num = view.findViewById(R.id.tv_sat_num_instatus); |
| | | tv_qf = view.findViewById(R.id.tv_qf); |
| | | iv_head.setOnClickListener(this); |
| | | iv_coach_head = view.findViewById(R.id.iv_coach_head); |
| | | iv_coach_head.setOnClickListener(this); |
| | | tv_speed = view.findViewById(R.id.tv_speed); |
| | | tv_total_score = view.findViewById(R.id.tv_total_score); |
| | | tv_network_time = view.findViewById(R.id.network_time); |
| | | |
| | | tv_network_time.setText(Utils.getHHmm()); |
| | | |
| | | tv_speed.setText(getResources().getString(R.string.speed,speed)); |
| | | |
| | | view.findViewById(R.id.btn_return).setOnClickListener(this); |
| | | mListView = view.findViewById(R.id.lv); |
| | | mListView.setFocusable(false); |
| | | mListView.setOnTouchListener((v, ev) -> { |
| | |
| | | btn_start_exam.setOnClickListener(this); |
| | | tv_stop = view.findViewById(R.id.tv_stop); |
| | | tv_stop.setOnClickListener(this); |
| | | mListView.addHeaderView(LayoutInflater.from(_mActivity).inflate(R.layout.layout_score_item, null)); |
| | | |
| | | } |
| | | |
| | | private LoadProgressDialog loadProgressDialog; |
| | | MyDialogFragment myDialogFragment; |
| | | @Override |
| | | public void onClick(View v) { |
| | | switch (v.getId()) { |
| | | case R.id.btn_start: |
| | | |
| | | clearArrayListResetTotalScore(); |
| | | if (btn_start_exam.getText().toString().equalsIgnoreCase("开始考试")){ |
| | | clearArrayListResetTotalScore(); |
| | | |
| | | |
| | | if (myDialogFragment == null){ |
| | | myDialogFragment = new MyDialogFragment(); |
| | | |
| | | |
| | | |
| | | SelectDialog selectDialog = SelectDialog.newInstance("进行场地考试","进行道路考试"); |
| | | selectDialog.setSelectedListener((int res)->{ |
| | | if (res != SelectDialog.SELECT_NONE){ |
| | | if (res== SelectDialog.FIRST){ |
| | | sendJK0202(2); |
| | | }else{ |
| | | sendJK0202(3); |
| | | } |
| | | } |
| | | }); |
| | | selectDialog.show(getFragmentManager(),"selectdialog"); |
| | | |
| | | }else{ |
| | | stopExam(); |
| | | } |
| | | myDialogFragment.show(getFragmentManager(),"dialog"); |
| | | myDialogFragment.setCallback(new MyDialogFragment.Callback() { |
| | | @Override |
| | | public void changKao() { |
| | | sendJK0202(2); |
| | | } |
| | | |
| | | @Override |
| | | public void luKao() { |
| | | sendJK0202(3); |
| | | |
| | | } |
| | | }); |
| | | |
| | | |
| | | |
| | | |
| | | break; |
| | | case R.id.tv_stop: |
| | | Toast.makeText(_mActivity, "结束考试", Toast.LENGTH_SHORT).show(); |
| | | stopExam(); |
| | | |
| | | break; |
| | | |
| | | case R.id.view_map: |
| | | if (ExamPlatformData.getInstance().getExamType()>ExamPlatformData.EXAM_TYPE_ChangKAO){ |
| | | RoadDriveMapFragmentaa mapFragment = findFragment(RoadDriveMapFragmentaa.class); |
| | |
| | | } |
| | | |
| | | break; |
| | | case R.id.btn_return: |
| | | _mActivity.onBackPressed(); |
| | | break; |
| | | case R.id.iv_head: |
| | | MyLog.i(PlatFormConstant.HTTPTAG,"签到"); |
| | | loadProgressDialog = LoadProgressDialog.newInstance("请稍后..."); |
| | | loadProgressDialog.setStyle(DialogFragment.STYLE_NORMAL,R.style.Dialog_FullScreen); |
| | | loadProgressDialog.showNow(getFragmentManager(),"loadingdiaolog"); |
| | | |
| | | //从服务器获取用于生成签到二维码的url |
| | | case R.id.iv_head: |
| | | MyLog.i(TAG,"学员签到"); |
| | | if (ExamPlatformData.getInstance().getSign_mode() == ExamPlatformData.SIGN_MODE_TRAIN){ |
| | | Toast.makeText(_mActivity, "您已经在\"单机训练\"页面下签到", Toast.LENGTH_SHORT).show(); |
| | | return; |
| | | } |
| | | if (ExamPlatformData.getInstance().IsStuSign()){ |
| | | |
| | | ExamPlatformData.getInstance().setStuSign(false); |
| | | qrcode(1,false); |
| | | |
| | | }else{ |
| | | ExamPlatformData.getInstance().setStuSign(true); |
| | | qrcode(1,true); |
| | | ExamPlatformData.getInstance().setSingnMode(ExamPlatformData.SIGN_MODE_EXAM); |
| | | } |
| | | break; |
| | | case R.id.iv_coach_head: |
| | | MyLog.i(PlatFormConstant.HTTPTAG,"教练签到"); |
| | | if (ExamPlatformData.getInstance().getSign_mode() == ExamPlatformData.SIGN_MODE_TRAIN){ |
| | | Toast.makeText(_mActivity, "您已经在\"单机训练\"页面下签到", Toast.LENGTH_SHORT).show(); |
| | | return; |
| | | } |
| | | if (ExamPlatformData.getInstance().IsCoachSign()){ |
| | | ExamPlatformData.getInstance().setCoachSign(false); |
| | | qrcode(0,false); |
| | | }else{ |
| | | ExamPlatformData.getInstance().setCoachSign(true); |
| | | qrcode(0,true); |
| | | ExamPlatformData.getInstance().setSingnMode(ExamPlatformData.SIGN_MODE_EXAM); |
| | | } |
| | | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | private void qrcode(int type,boolean isSign) { |
| | | content = "87,"+String.valueOf(type)+ ","+ExamPlatformData.getInstance().getPhone() |
| | | +(isSign?",signin":",signout"); |
| | | Log.i(TAG,String.format("二维码内容:%s",content)); |
| | | byte[] bytes = Utils.qrencrypt(content.getBytes(),"safeluck"); |
| | | String str = Base64.encodeToString(bytes,Base64.DEFAULT); |
| | | Log.i(TAG,"base64加密后的字符串="+str); |
| | | QRCodeDialog qrCodeDialog = QRCodeDialog.newInstance(str); |
| | | qrCodeDialog.show(getFragmentManager(),"qrdialog" ); |
| | | } |
| | | private void sendJK0202(int type) { |
| | | |
| | | final JKMessage0202 jkMessage0202 = new JKMessage0202(); |
| | |
| | | item_id = 0; |
| | | |
| | | failedProjViewModel.deleteAll(); |
| | | tv_total_score.setText(String.valueOf(currTotalScore)); |
| | | setTotalScoreText(); |
| | | |
| | | |
| | | ExamPlatformData.getInstance().getTTS().speak("结束考试"); |
| | |
| | | public void onAttach(Context context) { |
| | | super.onAttach(context); |
| | | CEventCenter.onBindEvent(true,icEventListener,Constant.BIND_SPEED_TOPIC); |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | CEventCenter.onBindEvent(false,icEventListener,Constant.BIND_SPEED_TOPIC); |
| | | } |
| | | |
| | | private void setTotalScoreText() { |
| | | String totalstr=String.format(getString(R.string.total_score),currTotalScore); |
| | | SpannableString msp = new SpannableString(totalstr); |
| | | msp.setSpan(new ForegroundColorSpan(Color.parseColor("#A1A1A3")),totalstr.length()-1,totalstr.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); |
| | | msp.setSpan(new AbsoluteSizeSpan(13),totalstr.length()-1,totalstr.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); |
| | | |
| | | |
| | | tv_total_score.setText(msp); |
| | | } |
| | | |
| | | @Override |
| | | public void onDestroyView() { |
| | | super.onDestroyView(); |
| | | ((MainActivity)_mActivity).viewtitle.setVisibility(View.GONE); |
| | | ((MainActivity)_mActivity).btn_return.setVisibility(View.GONE); |
| | | } |
| | | } |