From f680d40e5519c02e4357fd94dfa184b9beff815f Mon Sep 17 00:00:00 2001
From: lizhanwei <Dana_Lee1016@126.com>
Date: 星期四, 07 五月 2020 16:45:18 +0800
Subject: [PATCH] 编码、调试根据协议格式生成一个二维码,采用des加密、然后Base64编码,调试通过
---
app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java | 46 +++++++++++++++++++++++++++++++++++-----------
1 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java b/app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java
index b48e1f5..b16bf92 100644
--- a/app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java
+++ b/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;//杩斿洖鐨刬c鍗′俊鎭� 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();
--
Gitblit v1.8.0