app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java
@@ -21,6 +21,7 @@
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;
@@ -41,6 +42,7 @@
import org.json.JSONException;
import org.json.JSONObject;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
@@ -62,19 +64,16 @@
import safeluck.drive.evaluation.adapter.ScoreAdapter;
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.QRCodeDialog;
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.util.DimenUtil;
import safeluck.drive.evaluation.platformMessage.PlatFormConstant;
import safeluck.drive.evaluation.util.Utils;
import safeluck.drive.evaluation.viewmodels.TimeViewModel;
/**单机训练UI
 * MyApplication2
@@ -107,7 +106,7 @@
    private TextView tv_speed,tv_total_score,tv_name
            ,tv_start_time,tv_coach_name;
    private double speed=0.0;
    private ImageView iv_head;
    private ImageView iv_head,iv_coach_head;
    WokViewModel wokViewModel;
    private int currTotalScore = 100;
@@ -117,7 +116,6 @@
    String icson;//返回的ic卡信息 json
    private String content;//用以生成二维码的内容
    private LoadProgressDialog loadProgressDialog;
private List<Integer> btn_ids = new ArrayList<Integer>();
@@ -517,6 +515,7 @@
        view.findViewById(R.id.iv_head).setOnClickListener(this);
        view.findViewById(R.id.iv_coach_head).setOnClickListener(this);
        av_curve = view.findViewById(R.id.av3);
        av_park = view.findViewById(R.id.av2);
        av_podao = view.findViewById(R.id.av1);
@@ -610,14 +609,39 @@
                }
                break;
            case R.id.iv_head:
                MyLog.i(TAG,"签到,获取身份证物理卡号");
                loadProgressDialog = LoadProgressDialog.newInstance("请稍后...");
                loadProgressDialog.setStyle(DialogFragment.STYLE_NORMAL,R.style.Dialog_FullScreen);
                loadProgressDialog.showNow(getFragmentManager(),"loadingdiaolog");
                MyLog.i(TAG,"学员签到");
                if (ExamPlatformData.getInstance().IsStuSign()){
                    ExamPlatformData.getInstance().setStuSign(false);
                    qrcode(1,false);
                }else{
                    ExamPlatformData.getInstance().setStuSign(true);
                    qrcode(1,true);
                }
                break;
            case R.id.iv_coach_head:
                MyLog.i(PlatFormConstant.HTTPTAG,"教练签到");
                if (ExamPlatformData.getInstance().IsCoachSign()){
                    ExamPlatformData.getInstance().setCoachSign(false);
                    qrcode(0,false);
                }else{
                    ExamPlatformData.getInstance().setCoachSign(true);
                    qrcode(0,true);
                }
                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(Charset.forName("utf-8")),"safeluck");
        String str = Base64.encodeToString(bytes,Base64.DEFAULT);
        QRCodeDialog qrCodeDialog = QRCodeDialog.newInstance(str);
        qrCodeDialog.show(getFragmentManager(),"qrdialog" );
    }
    private void sendJK0202(int type) {
        final JKMessage0202 jkMessage0202 = new JKMessage0202();