Merge branch 'master' of https://gitee.com/endian11/DriveJudge
1个文件已删除
66个文件已修改
4个文件已添加
1 文件已重命名
New file |
| | |
| | | apply plugin: 'com.android.library' |
| | | |
| | | android { |
| | | compileSdkVersion 30 |
| | | |
| | | defaultConfig { |
| | | minSdkVersion 21 |
| | | targetSdkVersion 30 |
| | | versionCode 1 |
| | | versionName "1.0" |
| | | |
| | | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
| | | consumerProguardFiles "consumer-rules.pro" |
| | | } |
| | | |
| | | buildTypes { |
| | | release { |
| | | minifyEnabled false |
| | | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
| | | } |
| | | } |
| | | } |
| | | |
| | | dependencies { |
| | | implementation fileTree(dir: "libs", include: ["*.jar"]) |
| | | implementation 'androidx.appcompat:appcompat:1.1.0' |
| | | testImplementation 'junit:junit:4.12' |
| | | androidTestImplementation 'androidx.test.ext:junit:1.1.1' |
| | | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' |
| | | |
| | | } |
New file |
| | |
| | | package com.anyun.basecommonlib; |
| | | |
| | | import android.content.Context; |
| | | |
| | | import androidx.test.platform.app.InstrumentationRegistry; |
| | | import androidx.test.ext.junit.runners.AndroidJUnit4; |
| | | |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | |
| | | import static org.junit.Assert.*; |
| | | |
| | | /** |
| | | * Instrumented test, which will execute on an Android device. |
| | | * |
| | | * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> |
| | | */ |
| | | @RunWith(AndroidJUnit4.class) |
| | | public class ExampleInstrumentedTest { |
| | | @Test |
| | | public void useAppContext() { |
| | | // Context of the app under test. |
| | | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); |
| | | assertEquals("com.anyun.basecommonlib.test", appContext.getPackageName()); |
| | | } |
| | | } |
New file |
| | |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| | | package="com.anyun.basecommonlib"> |
| | | |
| | | / |
| | | </manifest> |
File was renamed from im_lib/src/main/java/com/anyun/im_lib/util/MyLog.java |
| | |
| | | package com.anyun.im_lib.util; |
| | | package com.anyun.basecommonlib; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | public class MyLog { |
| | | |
| | | private static final String TAG = "AYJiaKao"; |
| | | private static final String TAG = "AYJiaKao"; |
| | | |
| | | |
| | | // 日志文件在sdcard中的路径 |
| | |
| | | |
| | | private static Boolean MYLOG_SWITCH = true; // 日志文件总开关 |
| | | |
| | | private static Boolean MYLOG_WRITE_TO_FILE = true;// 日志写入文件开关 |
| | | private static Boolean MYLOG_WRITE_TO_FILE = false;// 日志写入文件开关 |
| | | private static File file; |
| | | |
| | | // 输入日志类型,w代表只输出告警信息等,v代表输出所有信息 |
| | |
| | | * @param text |
| | | */ |
| | | static int count=0; |
| | | private static void writeLogtoFile( final String tag, final String text) {// 新建或打开日志文件 |
| | | private static synchronized void writeLogtoFile( final String tag, final String text) {// 新建或打开日志文件 |
| | | |
| | | String needWriteMessage = myLogSdf.format(System.currentTimeMillis()) + " " + tag + " " + text; |
| | | |
| | |
| | | File tempFile = null; |
| | | for (int j = 0; j < 5; j++) { |
| | | tempFile = new File(dirPath,PREFREIX+j+".txt"); |
| | | Log.i(TAG,"tempFIle Name= "+tempFile.getName()); |
| | | |
| | | if (tempFile.length()>20*1024*1024) { |
| | | if (j==4){ |
| | |
| | | |
| | | |
| | | }else{ |
| | | Log.i(TAG,String.format("返回文件%s",tempFile.getName())); |
| | | // Log.i(TAG,String.format("返回文件%s",tempFile.getName())); |
| | | break; |
| | | } |
| | | |
New file |
| | |
| | | package com.anyun.basecommonlib; |
| | | |
| | | import org.junit.Test; |
| | | |
| | | import static org.junit.Assert.*; |
| | | |
| | | /** |
| | | * Example local unit test, which will execute on the development machine (host). |
| | | * |
| | | * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> |
| | | */ |
| | | public class ExampleUnitTest { |
| | | @Test |
| | | public void addition_isCorrect() { |
| | | assertEquals(4, 2 + 2); |
| | | } |
| | | } |
| | |
| | | applicationId "safeluck.drive.evaluation" |
| | | minSdkVersion 21 |
| | | targetSdkVersion 28 |
| | | versionCode 1 |
| | | versionName "1.0" |
| | | versionCode 3 |
| | | versionName "1.3" |
| | | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" |
| | | |
| | | ndk { |
| | |
| | | implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.lifecycleVersion" |
| | | implementation 'com.android.support.constraint:constraint-layout:1.1.3' |
| | | // To get SwipeBack feature, rely on both fragmentation & fragmentation-swipeback |
| | | implementation 'me.yokeyword:fragmentation:1.3.6' |
| | | implementation 'me.yokeyword:fragmentationx:1.0.1' |
| | | // Swipeback is based on fragmentation. Refer to SwipeBackActivity/Fragment for your Customized SupportActivity/Fragment |
| | | implementation 'me.yokeyword:fragmentation-swipeback:1.3.6' |
| | | |
| | |
| | | implementation 'com.google.code.gson:gson:2.8.6' |
| | | implementation 'com.facebook.stetho:stetho:1.5.0' |
| | | implementation project(path: ':im_lib') |
| | | implementation project(path: ':BaseCommonLib') |
| | | implementation "androidx.core:core-ktx:+" |
| | | implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0" |
| | | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" |
| | |
| | | [ |
| | | |
| | | { |
| | | "signalName": "雾灯", |
| | | "index":1, |
| | | "func_id":21, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "三档", |
| | | "index":15, |
| | | "func_id":11, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "手刹", |
| | | "index":3, |
| | | "func_id":3, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "一档", |
| | | "index":8, |
| | | "func_id":9, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "副刹", |
| | | "index":16, |
| | | "func_id":16, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "安全带", |
| | | "index":6, |
| | | "func_id":0, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "二档", |
| | | "index":7, |
| | | "func_id":10, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "脚刹", |
| | | "index":4, |
| | | "func_id":4, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "空挡", |
| | | "index":9, |
| | | "func_id":8, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "门锁", |
| | | "func_id":7, |
| | | "index":10, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "START位", |
| | | "func_id":15, |
| | | "highLevel":1, |
| | | "index":11, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "远光", |
| | | "index":12, |
| | | "func_id":6, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "绕车一", |
| | | "index":13, |
| | | "func_id":17, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "近光", |
| | | "index":14, |
| | | "func_id":5, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "手刹", |
| | | "index":3, |
| | | "func_id":3, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "脚刹", |
| | | "index":4, |
| | | "func_id":4, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "近光", |
| | | "index":14, |
| | | "func_id":5, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "远光", |
| | | "index":12, |
| | | "func_id":6, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | } |
| | | , { |
| | | "signalName": "门锁", |
| | | "index":22, |
| | | "func_id":7, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | |
| | | { |
| | | "signalName": "空挡", |
| | | "index":9, |
| | | "func_id":8, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "雾灯", |
| | | "index":1, |
| | | "func_id":21, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "三档", |
| | | "index":15, |
| | | "func_id":11, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "一档", |
| | | "index":8, |
| | | "func_id":9, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | { |
| | | "signalName": "副刹", |
| | | "index":16, |
| | | "func_id":16, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | |
| | | { |
| | | "signalName": "二档", |
| | | "index":10, |
| | | "func_id":10, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | |
| | | { |
| | | "signalName": "START位", |
| | | "func_id":15, |
| | | "highLevel":1, |
| | | "index":11, |
| | | "mainBoard":2 |
| | | }, |
| | | |
| | | { |
| | | "signalName": "绕车一", |
| | | "index":13, |
| | | "func_id":17, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, |
| | | |
| | | |
| | | { |
| | | "signalName": "绕车二", |
| | | "index":17, |
| | |
| | | "func_id":22, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, { |
| | | "signalName": "四档", |
| | | "index":21, |
| | | "func_id":12, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, { |
| | | "signalName": "五档", |
| | | "index":23, |
| | | "func_id":13, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | }, { |
| | | "signalName": "倒档", |
| | | "index":7, |
| | | "func_id":14, |
| | | "highLevel":1, |
| | | "mainBoard":2 |
| | | } |
| | | ] |
| | |
| | | public static final int EXAM_MAP_TYPE_ANGLE = 5; |
| | | public static final int FINISH_ITEM = 0;//该项场地考试结束(出场地) |
| | | public static final int BEGIN_ITEM = 1;//该项考试开始进入场地 |
| | | public static final int EXAM_STATUS_MAP_ID = -1; |
| | | } |
| | |
| | | import androidx.work.Worker; |
| | | import androidx.work.WorkerParameters; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | |
| | | import androidx.work.Worker; |
| | | import androidx.work.WorkerParameters; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.lang.reflect.Type; |
| | | |
| | | import safeluck.drive.evaluation.Constant; |
| | | import safeluck.drive.evaluation.DB.WorkRoomDataBase; |
| | | import safeluck.drive.evaluation.platformMessage.PlatFormConstant; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | */ |
| | | public class AppStatusWorker extends Worker { |
| | | |
| | | private static final String TAG = "AppStatusWorker"; |
| | |
| | | import androidx.work.Worker; |
| | | import androidx.work.WorkerParameters; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.google.gson.stream.JsonReader; |
| | |
| | | import androidx.work.Worker; |
| | | import androidx.work.WorkerParameters; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.google.gson.stream.JsonReader; |
| | |
| | | import androidx.work.Worker; |
| | | import androidx.work.WorkerParameters; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.google.gson.stream.JsonReader; |
| | |
| | | @Query("select startExam from exam_status where map_id=1") |
| | | int getStartExamInt(); |
| | | |
| | | @Query("delete from exam_status") |
| | | @Query("delete from exam_status where map_id >-1") |
| | | void deleteAll(); |
| | | } |
| | |
| | | import androidx.work.Worker; |
| | | import androidx.work.WorkerParameters; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | |
| | | import java.util.Random; |
| | | |
| | | import safeluck.drive.evaluation.DB.Constant; |
| | | import safeluck.drive.evaluation.DB.WorkRoomDataBase; |
| | | |
| | | public class ExamStatusInitWorker extends Worker { |
| | |
| | | |
| | | public ExamStatusInitWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) { |
| | | super(context, workerParams); |
| | | Log.i(TAG,"ExamStatusInitWOrker"); |
| | | examStatus = new ExamStatus(); |
| | | } |
| | | |
| | |
| | | for (int i = 0; i < 1; i++) { |
| | | examStatus.setEnter(2);//默认待考项目 |
| | | examStatus.setStartExam(0);//默认没有开始考试 |
| | | examStatus.setMap_id(1); |
| | | examStatus.setMap_id(Constant.EXAM_STATUS_MAP_ID); |
| | | |
| | | WorkRoomDataBase.getWorkRoomDataBase(getApplicationContext()).getExamStatusDao().insert(examStatus); |
| | | } |
| | |
| | | import androidx.work.Data |
| | | import androidx.work.Worker |
| | | import androidx.work.WorkerParameters |
| | | import com.anyun.basecommonlib.MyLog |
| | | import com.anyun.exam.lib.AYSdk |
| | | import com.anyun.exam.lib.MyLog |
| | | import com.google.gson.Gson |
| | | import com.google.gson.reflect.TypeToken |
| | | import com.google.gson.stream.JsonReader |
| | |
| | | public void updateItemExamResult(int i, int map_id) { |
| | | examStatusWorkRepo.updateItemResult(i,map_id); |
| | | } |
| | | |
| | | public void deleteAll() { |
| | | |
| | | examStatusWorkRepo.deleteAll(); |
| | | } |
| | | } |
| | |
| | | import androidx.work.Worker; |
| | | import androidx.work.WorkerParameters; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | public void deleteAll() { |
| | | WorkRoomDataBase.dataBaseWriteExecutor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | examStatusDao.deleteAll(); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | |
| | | |
| | | import androidx.lifecycle.LiveData; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | |
| | | import java.util.List; |
| | | |
| | | import safeluck.drive.evaluation.Constant; |
| | | import safeluck.drive.evaluation.DB.WorkRoomDataBase; |
| | | |
| | | /** |
| | |
| | | import androidx.work.Worker; |
| | | import androidx.work.WorkerParameters; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | |
| | | import safeluck.drive.evaluation.DB.WorkRoomDataBase; |
| | | |
| | | /** |
| | | * MyApplication2 |
| | |
| | | import android.widget.Toast |
| | | import androidx.work.Worker |
| | | import androidx.work.WorkerParameters |
| | | import com.anyun.basecommonlib.MyLog |
| | | import com.anyun.exam.lib.AYSdk |
| | | import com.anyun.exam.lib.MyLog |
| | | import com.google.gson.Gson |
| | | import okhttp3.ResponseBody |
| | | import org.json.JSONException |
| | |
| | | MyLog.i(PlatFormConstant.HTTPTAG,"科三场地地图保存成功") |
| | | str = gson.toJson(yard.data.map_json) |
| | | FileUtil.writeTxtFileToSD(applicationContext,fileName,str,"") |
| | | // sendMapInfo() |
| | | sendMapInfo() |
| | | }) |
| | | } |
| | | } |
| | |
| | | str = gson.toJson(car.data.map_json) |
| | | MyLog.i(PlatFormConstant.HTTPTAG,"车辆模型保存成功") |
| | | FileUtil.writeTxtFileToSD(applicationContext,fileName,str,"") |
| | | // sendVehicleInfo() |
| | | sendVehicleInfo() |
| | | }) |
| | | |
| | | } |
| | |
| | | }) |
| | | |
| | | }else{ |
| | | // MyLog.i(PlatFormConstant.HTTPTAG,"已存在直接发送车辆和地图"+fileName) |
| | | // when(type){ |
| | | // "road" -> sendRoadMapInfo() |
| | | // "yard" -> sendMapInfo() |
| | | // else -> sendVehicleInfo() |
| | | // } |
| | | MyLog.i(PlatFormConstant.HTTPTAG,"已存在直接发送车辆和地图"+fileName) |
| | | when(type){ |
| | | "road" -> sendRoadMapInfo() |
| | | "yard" -> sendMapInfo() |
| | | else -> sendVehicleInfo() |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | import androidx.lifecycle.LiveData; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | |
| | | import safeluck.drive.evaluation.DB.WorkRoomDataBase; |
| | | |
| | |
| | | int getSignalName2Index(String signame); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //查询所有信号对应的物理所引 |
| | | @Query("select `index` from signal_config") |
| | | List<Integer> getAllIndexs(); |
| | |
| | | import androidx.work.WorkerParameters; |
| | | |
| | | import com.anyun.exam.lib.AYSdk; |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.google.gson.stream.JsonReader; |
| | |
| | | public void setMainBoard(int mainBoard) { |
| | | this.mainBoard = mainBoard; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "SingalConfig{" + |
| | | "signalName='" + signalName + '\'' + |
| | | ", index=" + index + |
| | | ", highLevel=" + highLevel + |
| | | ", mainBoard=" + mainBoard + |
| | | ", func_id=" + func_id + |
| | | '}'; |
| | | } |
| | | } |
| | |
| | | |
| | | import android.Manifest; |
| | | import android.app.AlertDialog; |
| | | |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import android.content.DialogInterface; |
| | | import android.os.AsyncTask; |
| | | import android.os.Build; |
| | |
| | | import androidx.annotation.Nullable; |
| | | import androidx.lifecycle.Observer; |
| | | import androidx.lifecycle.ViewModelProviders; |
| | | import androidx.work.OneTimeWorkRequest; |
| | | import androidx.work.WorkManager; |
| | | |
| | | |
| | | import me.yokeyword.fragmentation.SupportActivity; |
| | | import safeluck.drive.evaluation.DB.appstatusdb.AppStatus; |
| | | import safeluck.drive.evaluation.DB.appstatusdb.AppStatusViewModel; |
| | | import safeluck.drive.evaluation.DB.exam_status.ExamStatusViewModel; |
| | | import safeluck.drive.evaluation.DB.rtktb.RTKConfig; |
| | | import safeluck.drive.evaluation.DB.rtktb.RTKConfigViewModel; |
| | | import safeluck.drive.evaluation.DB.signalConfigdb.SignalConfigViewModel; |
| | | import safeluck.drive.evaluation.DB.signalConfigdb.SingalConfig; |
| | | import safeluck.drive.evaluation.bean.ExamPlatformData; |
| | | import safeluck.drive.evaluation.bean.SignalConfigRemote; |
| | | import safeluck.drive.evaluation.cEventCenter.CEventCenter; |
| | | import safeluck.drive.evaluation.cEventCenter.ICEventListener; |
| | | import safeluck.drive.evaluation.fragment.HomeFragment; |
| | | |
| | | import com.anyun.exam.lib.AYSdk; |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.im_lib.listener.IMSConnectStatusCallback; |
| | | import com.google.gson.Gson; |
| | | import com.safeluck.aykj.utils.BytesUtils; |
| | |
| | | |
| | | import android.content.Context; |
| | | import android.util.AttributeSet; |
| | | import android.util.Log; |
| | | |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | |
| | | import safeluck.drive.evaluation.fragment.BaseDatasFragment; |
| | | |
| | | public class WrapContentLinearLayoutManager extends LinearLayoutManager { |
| | | private static final String TAG = "WrapContentLinearLayoutManager"; |
| | |
| | | import me.yokeyword.fragmentation.Fragmentation; |
| | | import me.yokeyword.fragmentation.helper.ExceptionHandler; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.anyun.exam.lib.crash.CrashHandler; |
| | | import com.facebook.stetho.Stetho; |
| | | import com.google.gson.JsonArray; |
| | |
| | | import safeluck.drive.evaluation.DB.appstatusdb.AppStatusWorker; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaForI; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaForIII; |
| | | import safeluck.drive.evaluation.DB.exam_status.ExamStatus; |
| | | import safeluck.drive.evaluation.DB.exam_status.ExamStatusOutWorker; |
| | | import safeluck.drive.evaluation.DB.exam_status.ExamStatusWoker; |
| | | import safeluck.drive.evaluation.DB.failitems.FailedProj; |
| | |
| | | import safeluck.drive.evaluation.util.FileUtil; |
| | | import safeluck.drive.evaluation.util.SystemUtil; |
| | | import safeluck.drive.evaluation.util.Utils; |
| | | import safeluck.drive.evaluation.worker.MCUUpgradeWorker; |
| | | |
| | | /** |
| | | * MyApplication2 |
| | |
| | | crashHandler.init(getApplicationContext()); |
| | | AYSdk.getInstance().init(getApplicationContext()); |
| | | AYSdk.getInstance().registListener(this); |
| | | MyLog.createIfNotExist(); |
| | | Stetho.initializeWithDefaults(this); |
| | | |
| | | appContext = this; |
| | |
| | | |
| | | private String lastStr; |
| | | private String lastSn; |
| | | private int mapId = 0; |
| | | int type = 0; |
| | | int enter_status = -1; |
| | | @Override |
| | | public void callBackMsg(final int cmd, String json) { |
| | | String strConent = String.format("收到命令[%d],Json内容为%s", cmd, json); |
| | |
| | | if(!TextUtils.isEmpty(json)){ |
| | | final JKMessage0203 jkMessage0203 = new JKMessage0203(); |
| | | |
| | | // Data judgeData = new Data.Builder().putString(Constant.TTS,json).build(); |
| | | final JsonArray jsonArray = (JsonArray) JsonParser.parseString(json); |
| | | // |
| | | // OneTimeWorkRequest ttswoker = new OneTimeWorkRequest.Builder(TTSWorker.class).setInputData(judgeData).build(); |
| | | // WorkManager.getInstance(getAppContext()).enqueue(ttswoker); |
| | | |
| | | CThreadPoolExecutor.runInBackground(new Runnable() { |
| | | @Override |
| | |
| | | WorkManager.getInstance(getApplicationContext()).enqueue(gpsinfoWorkRequest); |
| | | break; |
| | | case Constant.ENTER_OR_EXIT_ITEM: |
| | | int type = 0; |
| | | int enter_status = -1; |
| | | |
| | | try { |
| | | JSONObject rtkConfigUpdtea = new JSONObject(json); |
| | | type = rtkConfigUpdtea.getInt("type"); |
| | | enter_status = rtkConfigUpdtea.getInt("enter"); |
| | | mapId = rtkConfigUpdtea.getInt("map_id"); |
| | | |
| | | String itemstr=ExamPlatformData.getInstance().getItemStatusStr(type); |
| | | MyLog.i(PlatFormConstant.LUKAO,String.format("%s",itemstr+(enter_status==Constant.EXIT_CURRENT_ITEM?"结束":"开始"))); |
| | | if (ExamPlatformData.getInstance().getTrainingMode()== ExamPlatformData.TRAINING_MODE){ |
| | |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | Data exam_enter_exitdata = new Data.Builder().putString(Constant.exam_enter_exitdata,json).build(); |
| | | OneTimeWorkRequest examStatusWorker = new OneTimeWorkRequest.Builder(ExamStatusWoker.class).setInputData(exam_enter_exitdata).build(); |
| | | WorkManager.getInstance(getApplicationContext()).enqueue(examStatusWorker); |
| | | |
| | | MyLog.i("收到命令13="+json); |
| | | CThreadPoolExecutor.runInBackground(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | ExamStatus examStatus = new ExamStatus(); |
| | | examStatus.setEnter(enter_status); |
| | | examStatus.setMap_id(mapId); |
| | | examStatus.setMap_item(type); |
| | | WorkRoomDataBase.getWorkRoomDataBase(getApplicationContext()).getExamStatusDao().insert(examStatus); |
| | | } |
| | | }); |
| | | // Data exam_enter_exitdata = new Data.Builder().putString(Constant.exam_enter_exitdata,json).build(); |
| | | // OneTimeWorkRequest examStatusWorker = new OneTimeWorkRequest.Builder(ExamStatusWoker.class).setInputData(exam_enter_exitdata).build(); |
| | | // WorkManager.getInstance(getApplicationContext()).enqueue(examStatusWorker); |
| | | break; |
| | | case Constant.REAL_TIME_CAR_POS: |
| | | try { |
| | |
| | | import androidx.work.OneTimeWorkRequest; |
| | | import androidx.work.WorkManager; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.anyun.exam.lib.util.Speaker; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | package safeluck.drive.evaluation.bean; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | |
| | | import safeluck.drive.evaluation.util.Utils; |
| | | |
| | |
| | | lateinit var onClick:MyOnClickListener |
| | | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
| | | if(dialog!=null){ |
| | | var windown = dialog.window; |
| | | windown.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) |
| | | windown.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) |
| | | dialog.setOnShowListener { windown.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) |
| | | var windown = dialog!!.window; |
| | | windown?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) |
| | | windown?.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) |
| | | dialog?.setOnShowListener { windown?.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) |
| | | hideBottomUIMenu()} |
| | | } |
| | | var view = inflater.inflate(R.layout.layout_dlg,container,false) |
| | |
| | | */ |
| | | protected fun hideBottomUIMenu() { //隐藏虚拟按键,并且全屏 |
| | | if (Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) { // lower api |
| | | val v = this.dialog.window.decorView |
| | | v.systemUiVisibility = View.GONE |
| | | val v = this.dialog?.window?.decorView |
| | | v?.systemUiVisibility = View.GONE |
| | | } else if (Build.VERSION.SDK_INT >= 19) { //for new api versions. |
| | | val decorView = dialog.window.decorView |
| | | val decorView = dialog?.window?.decorView |
| | | val uiOptions = (View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
| | | or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or View.SYSTEM_UI_FLAG_FULLSCREEN) |
| | | decorView.systemUiVisibility = uiOptions |
| | | decorView?.systemUiVisibility = uiOptions |
| | | } |
| | | } |
| | | |
| | |
| | | import android.widget.Toast; |
| | | |
| | | import com.anyun.exam.lib.AYSdk; |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.anyun.exam.lib.util.ByteUtil; |
| | | import com.google.gson.Gson; |
| | | import com.safeluck.aykj.utils.BytesUtils; |
| | |
| | | import androidx.lifecycle.ViewModelProviders; |
| | | |
| | | import com.anyun.exam.lib.AYSdk; |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | |
| | | import androidx.annotation.Nullable; |
| | | import androidx.appcompat.widget.Toolbar; |
| | | import androidx.databinding.DataBindingUtil; |
| | | import androidx.lifecycle.ViewModelProviders; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.anyun.im_lib.util.ByteUtil; |
| | | import com.google.gson.Gson; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | |
| | | import me.yokeyword.fragmentation.SupportFragment; |
| | | import safeluck.drive.evaluation.Constant; |
| | | import safeluck.drive.evaluation.DB.signalConfigdb.SignalConfigViewModel; |
| | | import safeluck.drive.evaluation.DB.signalConfigdb.SingalConfig; |
| | | import safeluck.drive.evaluation.MainActivity; |
| | | import safeluck.drive.evaluation.R; |
| | | import safeluck.drive.evaluation.bean.MCUInfo; |
| | |
| | | Drawable leftGray ; |
| | | private int index =0 ; |
| | | private Object object = new Object(); |
| | | private int fun_id = 0; |
| | | private ICEventListener icEventListener = new ICEventListener() { |
| | | @Override |
| | | public void onCEvent(String topic, int msgCode, int resultCode, Object obj) { |
| | |
| | | MyLog.i(TAG, "run: gpio["+i+"]="+gpios.get(i)); |
| | | } |
| | | MyLog.i("gpios.size="+gpios.size()); |
| | | bingding.inpsetSignalSlice.tvSeatBelt.setCompoundDrawablesWithIntrinsicBounds(gpios.get(5)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvTrunLeft.setCompoundDrawablesWithIntrinsicBounds(gpios.get(14)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvTurnRight.setCompoundDrawablesWithIntrinsicBounds(gpios.get(15)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvParkingBrake.setCompoundDrawablesWithIntrinsicBounds(gpios.get(2)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvFootBrake.setCompoundDrawablesWithIntrinsicBounds(gpios.get(7)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvLowLamp.setCompoundDrawablesWithIntrinsicBounds(gpios.get(13)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvHighBeam.setCompoundDrawablesWithIntrinsicBounds(gpios.get(11)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | |
| | | bingding.inpsetSignalSlice.tvGateLock.setCompoundDrawablesWithIntrinsicBounds(gpios.get(9)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvNullEngine.setCompoundDrawablesWithIntrinsicBounds(gpios.get(8)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearOne.setCompoundDrawablesWithIntrinsicBounds(gpios.get(3)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearTwo.setCompoundDrawablesWithIntrinsicBounds(gpios.get(6)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearThree.setCompoundDrawablesWithIntrinsicBounds(gpios.get(1)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearFour.setCompoundDrawablesWithIntrinsicBounds(gpios.get(4)==VALIAD_NUM?leftGreen:leftGray,null,null,null);//副刹 |
| | | bingding.inpsetSignalSlice.tvWindingOne.setCompoundDrawablesWithIntrinsicBounds(gpios.get(12)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvWindingTwo.setCompoundDrawablesWithIntrinsicBounds(gpios.get(10)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | fun_id = 0; |
| | | //安全带 |
| | | bingding.inpsetSignalSlice.tvSeatBelt.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | Log.i(TAG,"安全带之后,Fun_ID="+fun_id); |
| | | //左转 |
| | | bingding.inpsetSignalSlice.tvTrunLeft.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | //右转 |
| | | bingding.inpsetSignalSlice.tvTurnRight.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvParkingBrake.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvFootBrake.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvLowLamp.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvHighBeam.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | |
| | | bingding.inpsetSignalSlice.tvGateLock.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvNullEngine.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearOne.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearTwo.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearThree.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearFour.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearFive.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvReverseGear.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | Log.i(TAG,"三挡之后,Fun_ID="+fun_id); |
| | | |
| | | //副刹 |
| | | bingding.inpsetSignalSlice.tvSecondaryBrake.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null);//副刹 |
| | | bingding.inpsetSignalSlice.tvWindingOne.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvWindingTwo.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvWindingThree.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvWindingFour.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | |
| | | bingding.inpsetSignalSlice.tvFoglight.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | //示宽灯 |
| | | bingding.inpsetSignalSlice.tvWidthLamp.setCompoundDrawablesWithIntrinsicBounds(getGpioBitValue()==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | } |
| | | }); |
| | | } |
| | |
| | | |
| | | } |
| | | }; |
| | | private int getGpioBitValue(){ |
| | | |
| | | int index = singalConfigList.get(fun_id++).getIndex(); |
| | | Log.i(TAG,"fun_id"+(fun_id-1)+"对应index="+index); |
| | | if (index<gpios.size()){ |
| | | |
| | | int value = gpios.get(index-1); |
| | | return value; |
| | | }else{ |
| | | Log.i(TAG,"索引超出,所以值返回0,默认灰色信号"); |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | | public static SupportFragment newInstance(){ |
| | | return new InspectSignalFragment(); |
| | | } |
| | | |
| | | private List<SingalConfig> singalConfigList = new ArrayList<>(); |
| | | @Nullable |
| | | @Override |
| | | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| | | |
| | | bingding = DataBindingUtil.inflate(inflater,R.layout.layout_check_signal,container,false); |
| | | initView(); |
| | | |
| | | SignalConfigViewModel signalConfigViewModel = ViewModelProviders.of(this).get(SignalConfigViewModel.class); |
| | | signalConfigViewModel.getSignalConfigs().observe(this, singalConfigs -> { |
| | | if (singalConfigs != null && singalConfigs.size()>0){ |
| | | singalConfigList.clear(); |
| | | singalConfigList = singalConfigs; |
| | | sortSigalConfigList(); |
| | | } |
| | | }); |
| | | leftGreen = getResources().getDrawable(R.drawable.green_light,null); |
| | | leftGray = getResources().getDrawable(R.drawable.gray_light,null); |
| | | |
| | |
| | | return bingding.getRoot(); |
| | | } |
| | | |
| | | private void sortSigalConfigList() { |
| | | Collections.sort(singalConfigList, new Comparator<SingalConfig>() { |
| | | @Override |
| | | public int compare(SingalConfig o1, SingalConfig o2) { |
| | | return o1.getFunc_id()-o2.getFunc_id(); |
| | | } |
| | | }); |
| | | Log.i(TAG,"根据fun_id 升序排列"); |
| | | for (int j = 0; j < singalConfigList.size(); j++) { |
| | | Log.i(TAG,singalConfigList.get(j).toString()); |
| | | } |
| | | } |
| | | |
| | | private void initView() { |
| | | Log.i(TAG,"currTopFragment="+getTopFragment().getClass().getSimpleName()); |
| | | if (HomeFragment.class.getSimpleName().equals(getTopFragment().getClass().getSimpleName())){ |
| | |
| | | import androidx.appcompat.widget.Toolbar; |
| | | |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | |
| | |
| | | String newmap = null; |
| | | String mapPath = ExamPlatformData.getInstance().getMapPath(); |
| | | if (!TextUtils.isEmpty(mapPath)){ |
| | | MyLog.i("调用更新Map路径后的地图"+mapPath); |
| | | // MyLog.i("调用更新Map路径后的地图"+mapPath); |
| | | byte[] fileContent = FileUtil.readFile(mapPath); |
| | | if (fileContent != null){ |
| | | newmap= new String(fileContent); |
| | |
| | | import androidx.work.WorkManager; |
| | | |
| | | import com.anyun.exam.lib.AYSdk; |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.squareup.picasso.Picasso; |
| | | |
| | | import org.json.JSONException; |
| | |
| | | //设置模式为NONE 0 |
| | | ExamPlatformData.getInstance().setTrainingMode(ExamPlatformData.MODE_NONE); |
| | | //恢复初始数据 |
| | | OneTimeWorkRequest examStatusInitWork = OneTimeWorkRequest.from(ExamStatusInitWorker.class); |
| | | WorkManager.getInstance(_mActivity).enqueue(examStatusInitWork); |
| | | // OneTimeWorkRequest examStatusInitWork = OneTimeWorkRequest.from(ExamStatusInitWorker.class); |
| | | // WorkManager.getInstance(_mActivity).enqueue(examStatusInitWork); |
| | | //恢复初始数据exam_status表 |
| | | examStatusViewModel.deleteAll(); |
| | | examStatusViewModel.updateItemExamResult(1, safeluck.drive.evaluation.DB.Constant.EXAM_STATUS_MAP_ID); |
| | | examStatusViewModel.updateStartExam(0); |
| | | examStatusViewModel.updateExamStatus(2, safeluck.drive.evaluation.DB.Constant.EXAM_STATUS_MAP_ID); |
| | | |
| | | item_id = 0; |
| | | |
| | |
| | | import android.widget.EditText; |
| | | import android.widget.TextView; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.google.gson.Gson; |
| | | |
| | | import me.yokeyword.fragmentation.SupportFragment; |
| | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | |
| | |
| | | import androidx.annotation.Nullable; |
| | | import androidx.appcompat.widget.Toolbar; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | |
| | |
| | | import androidx.work.WorkManager; |
| | | |
| | | import com.anyun.exam.lib.AYSdk; |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.anyun.exam.lib.util.ByteUtil; |
| | | import com.google.gson.Gson; |
| | | import com.safeluck.aykj.utils.BytesUtils; |
| | |
| | | import android.widget.LinearLayout; |
| | | import android.widget.ListView; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | |
| | | import androidx.appcompat.widget.Toolbar; |
| | | import androidx.lifecycle.ViewModelProviders; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | |
| | | import safeluck.drive.evaluation.DB.signalConfigdb.SignalConfigViewModel; |
| | | import safeluck.drive.evaluation.DB.signalConfigdb.SingalConfig; |
| | | import safeluck.drive.evaluation.R; |
| | | import safeluck.drive.evaluation.app; |
| | | import safeluck.drive.evaluation.bean.SignalConfigBean; |
| | | import safeluck.drive.evaluation.util.CThreadPoolExecutor; |
| | | import safeluck.drive.evaluation.util.DataInitKt; |
| | | |
| | | |
| | | /** |
| | |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | public class SignalConfigFragment extends SupportFragment { |
| | | public class SignalConfigFragment extends SupportFragment implements View.OnClickListener { |
| | | |
| | | |
| | | private static final int INDEX = 1; |
| | |
| | | |
| | | linearLayout = view.findViewById(R.id.ll_container); |
| | | listView =view.findViewById(R.id.lv_signalconf); |
| | | view.findViewById(R.id.btn_save_signals).setOnClickListener(this); |
| | | listView.setDivider(null); |
| | | final MySignalsAdapter mySignalsAdapter = new MySignalsAdapter(_mActivity); |
| | | |
| | |
| | | signalConfigViewModel.getSignalConfigs().observe(this, singalConfigs -> { |
| | | list.clear(); |
| | | signalConfiglist.clear(); |
| | | MyLog.i(TAG,"信号配置发生变化"); |
| | | |
| | | |
| | | MyLog.i(TAG,"信号配置发生变化"+singalConfigs.size()); |
| | | for (int i = 0; i < singalConfigs.size(); i++) { |
| | | SingalConfig singalConfig = singalConfigs.get(i); |
| | | i++; |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | switch (v.getId()){ |
| | | case R.id.btn_save_signals: |
| | | Toast.makeText(_mActivity, "发送信号配置", Toast.LENGTH_SHORT).show(); |
| | | CThreadPoolExecutor.runInBackground(()->{ |
| | | MyLog.i("click时间,发送信号"); |
| | | DataInitKt.sendSignalConfigToRemote(app.getAppContext()); |
| | | }); |
| | | |
| | | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | private class MySignalsAdapter extends BaseAdapter{ |
| | |
| | | @Override |
| | | public void run() { |
| | | Log.i(TAG,"CThreadPoolExecutor position="+position+ " s1="+signName1+" s2="+s2); |
| | | viewHolder.editText1.setSelection(getSigal2Pos(signName1)); |
| | | viewHolder.editText2.setSelection(getSigal2Pos(s2)); |
| | | viewHolder.editText1.setSelection(getSigal2Pos(signName1),true); |
| | | viewHolder.editText2.setSelection(getSigal2Pos(s2),true); |
| | | } |
| | | }); |
| | | |
| | |
| | | import me.yokeyword.fragmentation.SupportFragment; |
| | | import safeluck.drive.evaluation.R; |
| | | import safeluck.drive.evaluation.customview.AutoFitTextureView; |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | |
| | | /** |
| | | * MyApplication2 |
| | |
| | | import android.widget.Toast; |
| | | |
| | | import com.anyun.exam.lib.AYSdk; |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.google.gson.Gson; |
| | | |
| | | import org.json.JSONException; |
| | |
| | | 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.ExamStatus; |
| | | 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.bean.ScoreBean; |
| | | import safeluck.drive.evaluation.cEventCenter.CEventCenter; |
| | | import safeluck.drive.evaluation.cEventCenter.ICEventListener; |
| | | import safeluck.drive.evaluation.customview.LoadProgressDialog; |
| | | import safeluck.drive.evaluation.customview.MyDialog; |
| | | |
| | | 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.platformMessage.JKMessage0204; |
| | | import safeluck.drive.evaluation.platformMessage.PlatFormConstant; |
| | | import safeluck.drive.evaluation.util.Utils; |
| | | |
| | |
| | | |
| | | private void stopExam() { |
| | | MyLog.i(TAG,"结束训练"); |
| | | |
| | | JKMessage0204 jkMessage0204 = new JKMessage0204(); |
| | | jkMessage0204.timeBCD = new Date(); |
| | | jkMessage0204.score = currTotalScore<0?0:currTotalScore; |
| | | jkMessage0204.stop = JKMessage0204.SUCC_STOP; |
| | | jkMessage0204.exam_id = ExamPlatformData.getInstance().getExam_id(); |
| | | MessageProcessor.getInstance().sendMessage(jkMessage0204); |
| | | //设置模式为NONE 0 |
| | | ExamPlatformData.getInstance().setTrainingMode(ExamPlatformData.MODE_NONE); |
| | | |
| | | //恢复初始数据 |
| | | OneTimeWorkRequest examStatusInitWork = OneTimeWorkRequest.from(ExamStatusInitWorker.class); |
| | | WorkManager.getInstance(_mActivity).enqueue(examStatusInitWork); |
| | | //恢复初始数据exam_status表 |
| | | examStatusViewModel.deleteAll(); |
| | | examStatusViewModel.updateItemExamResult(1, safeluck.drive.evaluation.DB.Constant.EXAM_STATUS_MAP_ID); |
| | | examStatusViewModel.updateStartExam(0); |
| | | examStatusViewModel.updateExamStatus(2, safeluck.drive.evaluation.DB.Constant.EXAM_STATUS_MAP_ID); |
| | | |
| | | item_id = 0; |
| | | currTotalScore = 100; |
| | | failedProjViewModel.deleteAll(); |
| | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | |
| | | import java.lang.reflect.Constructor; |
| | | import java.lang.reflect.Field; |
| | |
| | | import android.net.ConnectivityManager; |
| | | import android.net.NetworkInfo; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.anyun.im_lib.listener.OnEventListener; |
| | | |
| | | import safeluck.drive.evaluation.app; |
| | |
| | | import androidx.work.OneTimeWorkRequest; |
| | | import androidx.work.WorkManager; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.anyun.im_lib.interf.IMSClientInteface; |
| | | import com.anyun.im_lib.util.ByteUtil; |
| | | import com.google.gson.Gson; |
| | |
| | | sendMessage(jkMessage0101); |
| | | ExamPlatformData.getInstance().setExamplatformStatus(ExamPlatformData.DEV_REGISTERED); |
| | | }else{ |
| | | ExamPlatformData.getInstance().setExamplatformStatus(ExamPlatformData.DEV_REGISTERED); |
| | | ExamPlatformData.getInstance().setExamplatformStatus(ExamPlatformData.DEV_NOT_REGISTERED); |
| | | } |
| | | }else if (jk2019MessageBase instanceof JKMessage8001){ |
| | | JKMessage8001 jkMessage8001 = (JKMessage8001) jk2019MessageBase; |
| | |
| | | case "0101": |
| | | return true; |
| | | default: |
| | | return false; |
| | | return true; |
| | | } |
| | | |
| | | }else{ |
| | |
| | | import android.content.Intent; |
| | | import android.content.pm.PackageManager; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | |
| | | import safeluck.drive.evaluation.MainActivity; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | */ |
| | | public class BootFinishReceiver extends BroadcastReceiver { |
| | | |
| | | private static final String TAG = "BootFinishReceiver"; |
| | |
| | | public void onReceive(Context context, Intent intent) { |
| | | if (intent.getAction().equals(ACTION)) { |
| | | MyLog.i(TAG,"开机启动完成"); |
| | | Intent first= new Intent(); //启动指定页面 |
| | | //启动指定页面 |
| | | Intent first= new Intent(); |
| | | PackageManager packageManager = context.getPackageManager(); |
| | | first.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | first.setClass(context,MainActivity.class); |
| | |
| | | import android.content.Intent; |
| | | |
| | | import com.anyun.exam.lib.AYSdk; |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.google.gson.Gson; |
| | | |
| | | import safeluck.drive.evaluation.Constant; |
| | | import safeluck.drive.evaluation.bean.DeviceWorkMCU; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | */ |
| | | public class ReBootBroadcastReceiver extends BroadcastReceiver { |
| | | |
| | | private static final String TAG = "ReBootBroadcastReceiver"; |
| | |
| | | import android.content.Intent; |
| | | |
| | | import com.anyun.exam.lib.AYSdk; |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.google.gson.Gson; |
| | | |
| | | import safeluck.drive.evaluation.Constant; |
| | |
| | | import android.os.Looper; |
| | | import android.util.Log; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | |
| | | import androidx.work.Data |
| | | import androidx.work.ListenableWorker |
| | | import com.anyun.exam.lib.AYSdk |
| | | import com.anyun.exam.lib.MyLog |
| | | import com.anyun.basecommonlib.MyLog |
| | | import com.google.gson.Gson |
| | | import com.google.gson.reflect.TypeToken |
| | | import com.google.gson.stream.JsonReader |
| | |
| | | } |
| | | } |
| | | |
| | | private var singalConfigs :List<SingalConfig> = ArrayList() |
| | | private var singalConfigs :MutableList<SingalConfig> = mutableListOf() |
| | | |
| | | fun sendSignalConfigToRemote(applicationContext: Context){ |
| | | |
| | | MyLog.i("sendSignalConfigToRemote") |
| | | singalConfigs.clear() |
| | | signalConfiglist.clear() |
| | | singalConfigs = WorkRoomDataBase.getWorkRoomDataBase(applicationContext).signalConfigDao._getSignalConfigs() |
| | | if (singalConfigs ==null){ |
| | | MyLog.i("读文件发送信号配置") |
| | |
| | | val gson = Gson() |
| | | val type = object : TypeToken<List<SingalConfig?>?>() {}.type |
| | | val mstus = gson.fromJson<List<SingalConfig>>(jsonReader, type) |
| | | singalConfigs = mstus |
| | | for (j in mstus.indices){ |
| | | singalConfigs[j] = mstus[j] |
| | | } |
| | | } catch (e: IOException) { |
| | | e.printStackTrace() |
| | | } |
| | | }else{ |
| | | |
| | | MyLog.i("读到数据库里面的信号配置"+ signalConfiglist.size); |
| | | } |
| | | |
| | | for (i in singalConfigs.indices) { |
| | | val signalConfigRemote = SignalConfigRemote() |
| | | signalConfigRemote.func_id = singalConfigs.get(i).func_id |
| | |
| | | if (listContainsSameValue(indexs)) { |
| | | MyLog.i("sendSignalConfigsToRemote: 有相同的index,不能发送" + gson.toJson(signalConfiglist)) |
| | | } else { |
| | | MyLog.i("调用发送命令接口发送信号配置") |
| | | AYSdk.getInstance().sendCmd(safeluck.drive.evaluation.Constant.SEND_CONFIG_SIGNAL, gson.toJson(signalConfiglist)) |
| | | } |
| | | } |
| | |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.anyun.exam.lib.util.ByteUtil; |
| | | |
| | | import java.io.BufferedOutputStream; |
| | |
| | | import android.util.Log; |
| | | import android.util.TypedValue; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.anyun.exam.lib.util.ByteUtil; |
| | | import com.google.gson.Gson; |
| | | import com.safeluck.aykj.utils.BytesUtils; |
| | |
| | | import androidx.lifecycle.MutableLiveData; |
| | | import androidx.lifecycle.ViewModel; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | |
| | | |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | |
| | | public class MainViewModel extends ViewModel { |
| | | private static final String TAG = "MainViewModel"; |
| | |
| | | import androidx.work.Data |
| | | import androidx.work.Worker |
| | | import androidx.work.WorkerParameters |
| | | import com.anyun.basecommonlib.MyLog |
| | | import com.anyun.exam.lib.AYSdk |
| | | import com.anyun.exam.lib.MyLog |
| | | import safeluck.drive.evaluation.Constant |
| | | import safeluck.drive.evaluation.util.FileUtil |
| | | import java.io.IOException |
| | |
| | | import androidx.work.Data |
| | | import androidx.work.Worker |
| | | import androidx.work.WorkerParameters |
| | | import com.anyun.exam.lib.MyLog |
| | | import com.anyun.basecommonlib.MyLog |
| | | import safeluck.drive.evaluation.Constant |
| | | import safeluck.drive.evaluation.util.Utils |
| | | |
| | |
| | | xmlns:lee="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/ic_bground" |
| | | android:layout_marginTop="@dimen/ui_margin_20dp"> |
| | | <TextView |
| | | android:layout_width="114dp" |
| | |
| | | xmlns:lee="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/ic_bground" |
| | | android:orientation="vertical" |
| | | > |
| | | <TextView |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:orientation="vertical" android:layout_width="match_parent" |
| | | android:background="@drawable/ic_bground" |
| | | android:layout_height="match_parent"> |
| | | <ListView |
| | | android:layout_width="match_parent" |
| | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="喇叭" |
| | | android:id="@+id/tv_loudspeaker" |
| | | android:text="雾灯" |
| | | android:id="@+id/tv_foglight" |
| | | android:drawableLeft="@drawable/gray_light" |
| | | android:drawablePadding="5dp" |
| | | android:textSize="@dimen/network_train_textsize22px" |
| | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="双闪" |
| | | android:text="档位四" |
| | | android:textSize="@dimen/network_train_textsize22px" |
| | | android:layout_marginLeft="30dp" |
| | | android:id="@+id/tv_emergency_flasher" |
| | | android:id="@+id/tv_gear_four" |
| | | android:drawableLeft="@drawable/gray_light" |
| | | android:drawablePadding="5dp" |
| | | android:textColor="@android:color/white"/> |
| | |
| | | android:layout_height="wrap_content" |
| | | android:text="副刹" |
| | | android:layout_marginLeft="30dp" |
| | | android:id="@+id/tv_gear_four" |
| | | android:id="@+id/tv_secondary_brake" |
| | | |
| | | android:textSize="@dimen/network_train_textsize22px" |
| | | android:drawableLeft="@drawable/gray_light" |
| | | android:drawablePadding="5dp" |
| | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="Signal3-6" |
| | | android:text="绕车二" |
| | | android:layout_marginLeft="30dp" |
| | | android:id="@+id/tv_signal3_6" |
| | | android:visibility="gone" |
| | | android:textSize="@dimen/network_train_textsize22px" |
| | | android:drawableLeft="@drawable/gray_light" |
| | | android:drawablePadding="5dp" |
| | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="Signal3-7" |
| | | android:id="@+id/tv_signal3_7" |
| | | android:text="绕车三" |
| | | android:id="@+id/tv_winding_three" |
| | | android:textSize="@dimen/network_train_textsize22px" |
| | | android:visibility="gone" |
| | | android:layout_marginLeft="30dp" |
| | | android:drawableLeft="@drawable/gray_light" |
| | | android:drawablePadding="5dp" |
| | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="离合" |
| | | android:text="倒挡" |
| | | android:layout_marginLeft="30dp" |
| | | android:id="@+id/tv_clutch_pedal" |
| | | android:id="@+id/tv_reverse_gear" |
| | | android:textSize="@dimen/network_train_textsize22px" |
| | | android:drawableLeft="@drawable/gray_light" |
| | | android:drawablePadding="5dp" |
| | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="Signal3-8" |
| | | android:visibility="gone" |
| | | android:text="绕车四" |
| | | android:layout_marginLeft="30dp" |
| | | android:id="@+id/tv_signal3_8" |
| | | android:id="@+id/tv_winding_four" |
| | | android:drawableLeft="@drawable/gray_light" |
| | | android:drawablePadding="5dp" |
| | | android:textSize="@dimen/network_train_textsize22px" |
| | |
| | | <LinearLayout |
| | | xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/ic_bground" |
| | | android:orientation="vertical"> |
| | | |
| | | <android.support.design.widget.AppBarLayout |
| | |
| | | <LinearLayout |
| | | xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/ic_bground" |
| | | android:orientation="vertical" |
| | | style="@style/ui_margin" |
| | | > |
| | |
| | | <item>一档</item> |
| | | <item>二档</item> |
| | | <item>三档</item> |
| | | <!-- <item>四档</item> |
| | | <item>四档</item> |
| | | <item>五档</item> |
| | | <item>倒档</item>--> |
| | | <item>倒档</item> |
| | | <item>START位</item> |
| | | <item>副刹</item> |
| | | <item>绕车一</item> |
| | |
| | | <!-- Customize your theme here. --> |
| | | <item name="windowActionBar">false</item> |
| | | <item name="windowNoTitle">true</item> |
| | | <item name="android:windowBackground">@null</item> |
| | | <item name="android:windowBackground">@drawable/ic_bground</item> |
| | | |
| | | <item name="android:windowContentOverlay">@null</item> |
| | | <item name="colorPrimary">@color/colorPrimary</item> |
| | |
| | | |
| | | dependencies { |
| | | implementation fileTree(dir: 'libs', include: ['*.jar']) |
| | | |
| | | implementation project(path: ':BaseCommonLib') |
| | | implementation 'androidx.appcompat:appcompat:1.0.2' |
| | | testImplementation 'junit:junit:4.12' |
| | | androidTestImplementation 'androidx.test.ext:junit:1.1.1' |
| | |
| | | package com.anyun.im_lib; |
| | | |
| | | import com.anyun.im_lib.netty.NettyTcpClient; |
| | | import com.anyun.im_lib.util.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.safeluck.aykj.utils.BytesUtils; |
| | | |
| | | import io.netty.channel.ChannelHandlerContext; |
| | |
| | | import com.anyun.im_lib.listener.IMSConnectStatusCallback; |
| | | import com.anyun.im_lib.listener.OnEventListener; |
| | | import com.anyun.im_lib.util.ByteUtil; |
| | | import com.anyun.im_lib.util.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | import com.anyun.im_lib.util.PlatFormConstant; |
| | | import com.safeluck.aykj.utils.BytesUtils; |
| | | |
| | |
| | | |
| | | dependencies { |
| | | implementation fileTree(dir: 'libs', include: ['*.jar']) |
| | | |
| | | implementation project(path: ':BaseCommonLib') |
| | | implementation 'com.android.support:appcompat-v7:28.0.0' |
| | | testImplementation 'junit:junit:4.12' |
| | | androidTestImplementation 'com.android.support.test:runner:1.0.2' |
| | |
| | | include ':BaseCommonLib' |
| | | include ':app', ':lib', ':im_lib' |