app/src/main/assets/rtk_config.json | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/Constant.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/DB/failitems/FailedProj.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/app.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/util/FileUtil.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
app/src/main/assets/rtk_config.json
New file @@ -0,0 +1,15 @@ { "ip":"47.93.80.84", "port": 12125, "province":23, "city":1, "model":"123", "sn":"2019101500000001", "imei":"460123874561", "phone":"2019101500000001", "password":"123456789", "registered":1, "interval":1 } app/src/main/java/safeluck/drive/evaluation/Constant.java
@@ -44,4 +44,7 @@ //17.评判信息[{"wrong_id":0},{"wrong_id":3}] public static final int JUDGE_INFO = 0x000c; public static final String RTK_CONFIG_JSON = "rtk_config.json"; public static final String BIND_DRIVING_TOPIC = "driving"; public static final long TEST_STU_ID = 1001; } app/src/main/java/safeluck/drive/evaluation/DB/failitems/FailedProj.java
@@ -30,6 +30,7 @@ @ColumnInfo(name = "stu_id") private long stu_id; // =1 I类考场 ==2 II类考场 @ColumnInfo(name = "subject") private int subject; app/src/main/java/safeluck/drive/evaluation/app.java
@@ -2,6 +2,7 @@ import android.app.Application; import android.util.Log; import android.widget.Toast; import androidx.annotation.NonNull; @@ -14,8 +15,13 @@ import com.anyun.exam.lib.MyLog; import com.anyun.exam.lib.crash.CrashHandler; import com.facebook.stetho.Stetho; import com.google.gson.Gson; import safeluck.drive.evaluation.DB.failitems.FailedProj; import safeluck.drive.evaluation.DB.failitems.FailedProjRepository; import safeluck.drive.evaluation.cEventCenter.CEventCenter; import safeluck.drive.evaluation.util.FileUtil; import safeluck.drive.evaluation.util.SystemUtil; /** @@ -27,6 +33,7 @@ public class app extends Application implements IAYExamListener { private static final String TAG = "app"; private Gson gson; @Override public void onCreate() { @@ -68,9 +75,24 @@ @Override public void callBackMsg(int cmd, String json) { MyLog.d(TAG, "收到==" + json); CEventCenter.dispatchEvent("train",0,0,json); MyLog.d(TAG, String.format("收到命令[%d],Json内容为%s",cmd,json)); switch (cmd){ case Constant.NDK_START: Toast.makeText(this, "NDK start", Toast.LENGTH_SHORT).show(); break; case Constant.FETCH_RTK_PLATFORM_INFO: StringBuffer stringBuffer = FileUtil.readAssetTxtFile(getApplicationContext(),Constant.RTK_CONFIG_JSON); MyLog.i(TAG, "RTK配置信息:"+stringBuffer.toString()); AYSdk.getInstance().sendCmd(Constant.PUSH_RTK_PLATFORM_INFO,stringBuffer.toString()); break; case Constant.JUDGE_INFO: FailedProjRepository failedProjRepository = new FailedProjRepository(this); failedProjRepository.insert(new FailedProj(1,cmd,Constant.TEST_STU_ID)); break; } } } app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java
@@ -21,9 +21,9 @@ import java.util.List; import me.yokeyword.fragmentation.SupportFragment; import safeluck.drive.evaluation.Constant; import safeluck.drive.evaluation.DB.Student; import safeluck.drive.evaluation.DB.WokViewModel; import safeluck.drive.evaluation.DB.WorkRoomDataBase; import safeluck.drive.evaluation.DB.failitems.FailedProjViewModel; import safeluck.drive.evaluation.DB.failitems.FailedProj_select; import safeluck.drive.evaluation.R; @@ -91,7 +91,7 @@ FailedProjViewModel failedProjViewModel =ViewModelProviders.of(this).get(FailedProjViewModel.class); failedProjViewModel.getFailedProjectsForI(1001).observe(this, new Observer<List<FailedProj_select>>() { failedProjViewModel.getFailedProjectsForI(Constant.TEST_STU_ID).observe(this, new Observer<List<FailedProj_select>>() { @Override public void onChanged(List<FailedProj_select> failedProj_selects) { item_id = 0; app/src/main/java/safeluck/drive/evaluation/util/FileUtil.java
New file @@ -0,0 +1,46 @@ package safeluck.drive.evaluation.util; import android.app.Application; import android.content.Context; import android.content.res.Resources; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class FileUtil { /** * 读取assert目录下 txt文本文件内容 * @param context * @param assetFileName * @return */ public static StringBuffer readAssetTxtFile(Context context, String assetFileName) { String lineTxt = null; StringBuffer stringBuffer = new StringBuffer(); try { InputStream inputStream = null; try { inputStream = context.getAssets() .open(assetFileName); } catch (IOException e) { e.printStackTrace(); } InputStreamReader inputStreamReader = new InputStreamReader(inputStream); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); while((lineTxt = bufferedReader.readLine()) != null){ System.out.println(lineTxt); stringBuffer.append(lineTxt); } inputStreamReader.close(); bufferedReader.close(); } catch (IOException e) { e.printStackTrace(); } return stringBuffer; } }