3个文件已删除
10个文件已修改
40个文件已添加
New file |
| | |
| | | [ |
| | | |
| | | { |
| | | |
| | | "id":0, |
| | | "question": "请开启前照灯", |
| | | "flag":1 |
| | | |
| | | }, |
| | | { |
| | | "id":1, |
| | | "question": "夜间在没有路灯,照明不良条件下行驶", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":2, |
| | | "question": "请将前照灯变换成远光", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | |
| | | "id":3, |
| | | "question": "夜间在窄路与非机动车会车", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | |
| | | "id":4, |
| | | "question": "夜间同方向近距离跟车行驶", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":5, |
| | | "question": "夜间在道路上发生故障,妨碍交通又难以移动", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":6, |
| | | "question": "夜间在窄桥与非机动车会车", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":7, |
| | | "question": "雾天行驶", |
| | | "flag":0 |
| | | }, |
| | | |
| | | { |
| | | "id":8, |
| | | "question": "夜间与机动车会车", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":9, |
| | | "question": "夜间通过没有交通信号灯控制的路口", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | |
| | | "id":10, |
| | | "question": "夜间通过急弯、坡路", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":11, |
| | | "question": "夜间超越前方车辆", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":12, |
| | | "question": "在路边临时停车", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":13, |
| | | "question": "夜间路口左转弯", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":14, |
| | | "question": "夜间路口右转弯", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":15, |
| | | "question": "夜间在照明良好的道路上行驶", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":16, |
| | | "question": "夜间直行通过路口", |
| | | "flag":0 |
| | | } |
| | | ] |
New file |
| | |
| | | [ |
| | | |
| | | { |
| | | "id":0, |
| | | "question_id":0, |
| | | "answer": "开启大灯,注意是近光", |
| | | "choose":1 |
| | | }, |
| | | { |
| | | "id":1, |
| | | "question_id":0, |
| | | "answer": "开启大灯,远近光灯都可以", |
| | | "choose":0 |
| | | }, |
| | | { |
| | | "id":2, |
| | | "question_id":1, |
| | | "answer": "开启远光灯", |
| | | "choose":1 |
| | | }, |
| | | { |
| | | "id":3, |
| | | "question_id":2, |
| | | "answer": "开启远光灯", |
| | | "choose":1 |
| | | }, |
| | | { |
| | | "id":4, |
| | | "question_id":3, |
| | | "answer": "开启近光灯", |
| | | "choose":1 |
| | | }, |
| | | { |
| | | "id":5, |
| | | "question_id":4, |
| | | "answer": "开启近光灯", |
| | | "choose":1 |
| | | }, |
| | | { |
| | | "id":6, |
| | | "question_id":5, |
| | | "answer": "开启示宽灯和危险警示灯", |
| | | "choose":1 |
| | | }, |
| | | { |
| | | "id":7, |
| | | "question_id":5, |
| | | "answer": "开启危险警示灯", |
| | | "choose":0 |
| | | }, |
| | | { |
| | | "id":8, |
| | | "question_id":6, |
| | | "answer": "开启近光灯", |
| | | "choose":1 |
| | | }, |
| | | { |
| | | "id":9, |
| | | "question_id":7, |
| | | "answer": "大灯(近光灯)+危险警示灯+雾灯", |
| | | "choose":1 |
| | | }, |
| | | { |
| | | "id":10, |
| | | "question_id":7, |
| | | "answer": "小灯(示宽灯)+危险警示灯+雾灯", |
| | | "choose":0 |
| | | }, |
| | | |
| | | { |
| | | "id":11, |
| | | "question_id":8, |
| | | "answer": "开启近光灯", |
| | | "choose":1 |
| | | }, |
| | | { |
| | | "id":12, |
| | | "question_id":9, |
| | | "answer": "变换远近光灯,完成操作后仍为近光", |
| | | "choose":1 |
| | | }, |
| | | { |
| | | "id":13, |
| | | "question_id":10, |
| | | "answer": "变换远近光灯,完成操作后仍为近光", |
| | | "choose":1 |
| | | }, |
| | | { |
| | | "id":14, |
| | | "question_id":11, |
| | | "answer": "变换远近光灯,完成操作后仍为近光", |
| | | "choose":1 |
| | | }, |
| | | { |
| | | "id":15, |
| | | "question_id":11, |
| | | "answer": "先开左转向灯,后变换远近光灯", |
| | | "choose":0 |
| | | }, |
| | | { |
| | | "id":16, |
| | | "question_id":12, |
| | | "answer": "开启小灯(示宽灯)+危险警示灯", |
| | | "choose":1 |
| | | }, |
| | | { |
| | | "id":17, |
| | | "question_id":13, |
| | | "answer": "开启小灯(示宽灯)+左转向灯", |
| | | "choose":1 |
| | | }, |
| | | { |
| | | "id":18, |
| | | "question_id":13, |
| | | "answer": "开启近光灯", |
| | | "choose":0 |
| | | }, |
| | | { |
| | | "id":19, |
| | | "question_id":14, |
| | | "answer": "开启小灯(示宽灯)+右转向灯", |
| | | "choose":1 |
| | | }, |
| | | { |
| | | "id":20, |
| | | "question_id":14, |
| | | "answer": "开启近光灯", |
| | | "choose":0 |
| | | }, |
| | | { |
| | | "id":21, |
| | | "question_id":15, |
| | | "answer": "开启近光灯", |
| | | "choose":1 |
| | | }, |
| | | { |
| | | "id":22, |
| | | "question_id":16, |
| | | "answer": "开启近光灯", |
| | | "choose":1 |
| | | }, |
| | | { |
| | | "id":23, |
| | | "question_id":16, |
| | | "answer": "变换远近光灯,完成操作后仍为近光", |
| | | "choose":0 |
| | | } |
| | | |
| | | ] |
New file |
| | |
| | | [ |
| | | |
| | | { |
| | | |
| | | "id":0, |
| | | "question": "请开启前照灯", |
| | | "answer": "开启大灯,注意是近光", |
| | | "flag":1 |
| | | |
| | | }, |
| | | { |
| | | "id":1, |
| | | "question": "夜间在没有路灯,照明不良条件下行驶", |
| | | "answer": "开启远光灯", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":2, |
| | | "question": "请将前照灯变换成远光", |
| | | "answer": "开启远光灯", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | |
| | | "id":3, |
| | | "question": "夜间在窄路与非机动车会车", |
| | | "answer": "开启近光灯", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | |
| | | "id":4, |
| | | "question": "夜间同方向近距离跟车行驶", |
| | | "answer": "开启近光灯", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":5, |
| | | "question": "夜间在道路上发生故障,妨碍交通又难以移动", |
| | | "answer": "开启示宽灯和危险警示灯", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":6, |
| | | "question": "夜间在窄桥与非机动车会车", |
| | | "answer": "开启近光灯", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":7, |
| | | "question": "雾天行驶", |
| | | "answer": "大灯(近光灯)+危险警示灯+雾灯", |
| | | "flag":0 |
| | | }, |
| | | |
| | | { |
| | | "id":8, |
| | | "question": "夜间与机动车会车", |
| | | "answer": "开启近光灯", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":9, |
| | | "question": "夜间通过没有交通信号灯控制的路口", |
| | | "answer": "变换远近光灯,完成操作后仍为近光", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | |
| | | "id":10, |
| | | "question": "夜间通过急弯、坡路", |
| | | "answer": "变换远近光灯,完成操作后仍为近光", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":11, |
| | | "question": "夜间超越前方车辆", |
| | | "answer": "变换远近光灯,完成操作后仍为近光", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":12, |
| | | "question": "在路边临时停车", |
| | | "answer": "开启小灯(示宽灯)+危险警示灯", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":13, |
| | | "question": "夜间路口左转弯", |
| | | "answer": "开启小灯(示宽灯)+左转向灯", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":14, |
| | | "question": "夜间路口右转弯", |
| | | "answer": "开启小灯(示宽灯)+右转向灯", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":15, |
| | | "question": "夜间在照明良好的道路上行驶", |
| | | "answer": "开启近光灯", |
| | | "flag":0 |
| | | }, |
| | | { |
| | | "id":16, |
| | | "question": "夜间直行通过路口", |
| | | "answer": "开启近光灯", |
| | | "flag":0 |
| | | } |
| | | ] |
| | |
| | | public static final Integer BLUETOOTH_CONNECT = 3; |
| | | public static final String OUR_SYS_IMAGE = "qcom/msm8909/msm8909:7.1.2/N2G47H/yy"; |
| | | public static final String BIND_EXAM_STATUS_TOPIC = "BIND_EXAM_STATUS_TOPIC"; |
| | | public static final String LIGHT_DEFAULT_JSON = "lightdefault.json"; |
| | | public static final String LIGHT_ALL_ANSWER_JSON = "lightallanswers.json"; |
| | | public static final String LIGHT_ALL_DEFAULT_JSON = "lightAlldefault.json"; |
| | | public static String exam_enter_exitdata="exam_enter_exitdata"; |
| | | public static int Chang_di = 2; |
| | | public static int DaoLu_night = 3; |
| | |
| | | import androidx.room.Database; |
| | | import androidx.room.Room; |
| | | import androidx.room.RoomDatabase; |
| | | import androidx.room.migration.Migration; |
| | | import androidx.sqlite.db.SupportSQLiteDatabase; |
| | | import androidx.work.OneTimeWorkRequest; |
| | | import androidx.work.WorkContinuation; |
| | |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | |
| | | import okhttp3.Route; |
| | | import safeluck.drive.evaluation.DB.appstatusdb.AppStatus; |
| | | import safeluck.drive.evaluation.DB.appstatusdb.AppStatusDao; |
| | | import safeluck.drive.evaluation.DB.appstatusdb.AppStatusInitWork; |
| | | import safeluck.drive.evaluation.DB.criterias.Criteria; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaDao; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaForI; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaForII; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaForIII; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaForIIIWorker; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaForIIWorker; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaForIWorker; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaIDao; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaIIDao; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaIIIDao; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaInitWorker; |
| | | import safeluck.drive.evaluation.DB.exam_status.ExamStatus; |
| | |
| | | import safeluck.drive.evaluation.DB.failitems.LuKaoFailedProj; |
| | | import safeluck.drive.evaluation.DB.gps.GPSInfo; |
| | | import safeluck.drive.evaluation.DB.gps.GpsInfoDao; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightAllAnswerDao; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightAllAnswerInitWorker; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightAllQuestInitWorker; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightAllQuestionsDao; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightAnswers; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightQuestion; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightUseInitWorker; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightUseQuestions; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightUseQuestionsDao; |
| | | import safeluck.drive.evaluation.DB.route.RouteBean; |
| | | import safeluck.drive.evaluation.DB.route.RouteBeanDao; |
| | | import safeluck.drive.evaluation.DB.route.RouteCross; |
| | |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | @Database(entities = {Student.class, CriteriaForI.class, FailedProj.class,LuKaoFailedProj.class, CriteriaForII.class, CriteriaForIII.class,RTKConfig.class, GPSInfo.class, AppStatus.class, ExamStatus.class, SingalConfig.class |
| | | , Criteria.class,RouteBean.class, RouteCross.class, RouteTriggerLine.class},version = 1,exportSchema = false) |
| | | @Database(entities = {Student.class, CriteriaForI.class, FailedProj.class,LuKaoFailedProj.class, LightUseQuestions.class, CriteriaForIII.class,RTKConfig.class, GPSInfo.class, AppStatus.class, ExamStatus.class, SingalConfig.class |
| | | , Criteria.class,RouteBean.class, RouteCross.class, RouteTriggerLine.class, LightAnswers.class, LightQuestion.class},version = 1,exportSchema = false) |
| | | public abstract class WorkRoomDataBase extends RoomDatabase { |
| | | private static final String TAG = "WorkRoomDataBase"; |
| | | public abstract StudentDao getstudentDao(); |
| | |
| | | public abstract CriteriaIDao getCriteriaIDao(); |
| | | //考场评判表 |
| | | public abstract CriteriaDao getCriteriaDao(); |
| | | //科目二 II类考场评判表 |
| | | public abstract CriteriaIIDao getCriteriaIIDao(); |
| | | //考场评判表 |
| | | public abstract LightUseQuestionsDao getLightUseQuestionsDao(); |
| | | |
| | | public abstract FailProjDao getFailProjDao(); |
| | | private static volatile WorkRoomDataBase workRoomDataBase; |
| | | |
| | |
| | | OneTimeWorkRequest oneTimeWorkRequest = OneTimeWorkRequest.from(SeedDatabaseWorker.class); |
| | | OneTimeWorkRequest oneTimeWorkRequest1 = OneTimeWorkRequest.from(CriteriaForIWorker.class); |
| | | OneTimeWorkRequest criteriaInitWorkRequest = OneTimeWorkRequest.from(CriteriaInitWorker.class); |
| | | // OneTimeWorkRequest oneTimeWorkRequest3 = OneTimeWorkRequest.from(CriteriaForIIWorker.class); |
| | | OneTimeWorkRequest oneTimeWorkRequest3 = OneTimeWorkRequest.from(LightUseInitWorker.class); |
| | | OneTimeWorkRequest lightAllQuestInitWorker = OneTimeWorkRequest.from(LightAllQuestInitWorker.class); |
| | | OneTimeWorkRequest lightAllAnswerInitWorker = OneTimeWorkRequest.from(LightAllAnswerInitWorker.class); |
| | | OneTimeWorkRequest mCriteriaForIIIWorker= OneTimeWorkRequest.from(CriteriaForIIIWorker.class); |
| | | OneTimeWorkRequest oneTimeWorkRequest2 = OneTimeWorkRequest.from(FailedProjWorker.class); |
| | | OneTimeWorkRequest RTKConfigWorkRequest = OneTimeWorkRequest.from(RTKConfigWork.class); |
| | |
| | | |
| | | //单路径执行,可以实现更加复杂的多路径执行方式 |
| | | WorkContinuation chain1= WorkManager.getInstance(mContext).beginWith(Arrays.asList(oneTimeWorkRequest,oneTimeWorkRequest1,criteriaInitWorkRequest)) |
| | | .then(mCriteriaForIIIWorker); |
| | | .then(mCriteriaForIIIWorker).then(oneTimeWorkRequest3).then(lightAllAnswerInitWorker).then(lightAllQuestInitWorker); |
| | | WorkContinuation chain2 = WorkManager.getInstance(mContext).beginWith(Arrays.asList(RTKConfigWorkRequest,appStatusInitWork,signalConigInitWorker,routeInitWorker)) |
| | | .then(oneTimeWorkRequest2).then(examStatusInitWorker); |
| | | |
| | |
| | | public abstract CriteriaIIIDao getCriteriaIIIDao(); |
| | | |
| | | public abstract LuKaoFailProjDao getLuKaoFailProjDao(); |
| | | |
| | | public abstract LightAllAnswerDao getLightAllAnswersDao(); |
| | | |
| | | public abstract LightAllQuestionsDao getLightAllQuestionsDao(); |
| | | } |
| | |
| | | */ |
| | | @Query("SELECT emp_id,stu_id, utc ,sn ,deducting_reason,score_deducting,item_content from criteria INNER JOIN fail_projects ON criteria.item_id= fail_projects.emp_id where fail_projects.stu_id=:stu_id and fail_projects.subject=999") |
| | | LiveData<List<FailedProj_select>> getFailedProjects(long stu_id); |
| | | /** |
| | | * 查询 科目二 II类考场的失败项目 (多表查询) |
| | | * 如果要添加 科目二II III类考场失败项目,需要建立相应的评判标准表数据表 |
| | | * @return |
| | | */ |
| | | @Query("SELECT emp_id,stu_id,utc,sn,deducting_reason,score_deducting,item_content from criteria_two INNER JOIN fail_projects ON criteria_two.item_id= fail_projects.emp_id where fail_projects.stu_id=:stu_id and fail_projects.subject=2") |
| | | LiveData<List<FailedProj_select>> getFailedProjectsForII(long stu_id); |
| | | |
| | | /** |
| | | * 查询 科目三 路考考场的失败项目 (多表查询) |
| | | * 如果要添加 科目二II III类考场失败项目,需要建立相应的评判标准表数据表 |
| | |
| | | |
| | | import safeluck.drive.evaluation.DB.criterias.Criteria; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaForI; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaForII; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaForIII; |
| | | |
| | | import static androidx.room.ForeignKey.CASCADE; |
| | | |
| | |
| | | return failProjDao.getFailedProjects(stu_id); |
| | | } |
| | | |
| | | /** |
| | | * 获得科目二 II类考场失败项目扣分项 |
| | | * |
| | | * @param stu_id |
| | | * @return |
| | | */ |
| | | public LiveData<List<FailedProj_select>> getFailedProjectsForII(long stu_id) { |
| | | return failProjDao.getFailedProjectsForII(stu_id); |
| | | } /** |
| | | /** |
| | | * 获得科目三 路考考场失败项目扣分项 |
| | | * |
| | | * @param stu_id |
| | |
| | | public LiveData<List<FailedProj_select>> getFailedProjectsForI(long stu_id){ |
| | | return failedProjRepository.getFailedProjectsForI(stu_id); |
| | | } |
| | | public LiveData<List<FailedProj_select>> getFailedProjectsForII(long stu_id){ |
| | | return failedProjRepository.getFailedProjectsForII(stu_id); |
| | | } |
| | | |
| | | public LiveData<List<FailedProj_select>> getFailedProjectsForIII(long stu_id){ |
| | | return failedProjRepository.getFailedProjectsForIII(stu_id); |
| | | } |
| | |
| | | import androidx.room.Index; |
| | | import androidx.room.PrimaryKey; |
| | | |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaForI; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaForII; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaForIII; |
| | | |
| | | import static androidx.room.ForeignKey.CASCADE; |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb |
| | | |
| | | import android.content.Context |
| | | import safeluck.drive.evaluation.DB.WorkRoomDataBase |
| | | |
| | | /**DriveJudge |
| | | * Created by lzw on 2021/1/15. 10:27:19 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | object InjectUtils{ |
| | | fun provideLightDefaultViewModelFactory(context:Context):LightDefaultVMFactory { |
| | | val repository = getLightDefaultRepository(context) |
| | | return LightDefaultVMFactory(repository) |
| | | } |
| | | |
| | | private fun getLightDefaultRepository(context: Context): LightDefaultRepository { |
| | | return LightDefaultRepository.getInstance(WorkRoomDataBase.getWorkRoomDataBase(context).lightUseQuestionsDao) |
| | | } |
| | | |
| | | private fun getLightAllQuestsRepository(context: Context): LightAllQuestRepository { |
| | | return LightAllQuestRepository.getInstance(WorkRoomDataBase.getWorkRoomDataBase(context).lightAllQuestionsDao) |
| | | } |
| | | |
| | | fun provideLightAllQuestionViewModelFactory(context:Context):LightAllQuestVMFactory { |
| | | val repository = getLightAllQuestsRepository(context) |
| | | return LightAllQuestVMFactory(repository) |
| | | } |
| | | |
| | | |
| | | fun provideLightAllAnswerViewModelFactory(context:Context):LightAllAnswerVMFactory { |
| | | val repository = getLightAllAnswerRepository(context) |
| | | return LightAllAnswerVMFactory(repository) |
| | | } |
| | | |
| | | private fun getLightAllAnswerRepository(context: Context): LightAnswersRepository { |
| | | return LightAnswersRepository.getInstance(WorkRoomDataBase.getWorkRoomDataBase(context).lightAllAnswersDao) |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb; |
| | | |
| | | import androidx.lifecycle.LiveData; |
| | | import androidx.room.Dao; |
| | | import androidx.room.Insert; |
| | | import androidx.room.OnConflictStrategy; |
| | | import androidx.room.Query; |
| | | |
| | | import org.jetbrains.annotations.NotNull; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * DriveJudge |
| | | * Created by lzw on 2021/1/14. 09:47:02 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | @Dao |
| | | public interface LightAllAnswerDao { |
| | | @Insert(onConflict=OnConflictStrategy.REPLACE) |
| | | void insertQuestion(LightAnswers lightAnswers); |
| | | |
| | | @Insert(onConflict=OnConflictStrategy.REPLACE) |
| | | void insertAll(List<LightAnswers> answersList); |
| | | |
| | | @Query("SELECT * from light_all_answers where question_id=:question_id") |
| | | List<LightAnswers> getCurrQuest2Answers(int question_id); |
| | | |
| | | @Query("UPDATE light_all_answers SET choose =:flag WHERE id = :id") |
| | | void updateAnswerChoose(int id, int flag); |
| | | |
| | | @Query("SELECT * from light_all_answers ") |
| | | LiveData<List<LightAnswers>> getAllAnswers(); |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb; |
| | | |
| | | import android.content.Context; |
| | | import android.util.Log; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.work.Worker; |
| | | import androidx.work.WorkerParameters; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.google.gson.stream.JsonReader; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.lang.reflect.Type; |
| | | import java.util.List; |
| | | |
| | | import safeluck.drive.evaluation.Constant; |
| | | import safeluck.drive.evaluation.DB.WorkRoomDataBase; |
| | | |
| | | /** |
| | | * DriveJudge |
| | | * Created by lzw on 2021/1/14. 10:40:42 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | public class LightAllAnswerInitWorker extends Worker { |
| | | |
| | | private static final String TAG = "LightAllAnswInitWorker"; |
| | | public LightAllAnswerInitWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) { |
| | | super(context, workerParams); |
| | | } |
| | | |
| | | @NonNull |
| | | @Override |
| | | public Result doWork() { |
| | | |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = getApplicationContext().getAssets().open(Constant.LIGHT_ALL_ANSWER_JSON); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | InputStreamReader inputStreamReader = new InputStreamReader(inputStream); |
| | | JsonReader jsonReader = new JsonReader(inputStreamReader); |
| | | Gson gson = new Gson(); |
| | | Type type =new TypeToken<List<LightAnswers>>(){}.getType(); |
| | | List<LightAnswers> questionsList = gson.fromJson(jsonReader,type); |
| | | Log.i(TAG,"doWork"); |
| | | WorkRoomDataBase.getWorkRoomDataBase(getApplicationContext()).getLightAllAnswersDao().insertAll(questionsList); |
| | | return Result.success(); |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb |
| | | |
| | | import androidx.lifecycle.ViewModel |
| | | import androidx.lifecycle.ViewModelProvider |
| | | |
| | | /**DriveJudge |
| | | * Created by lzw on 2021/1/15. 10:29:00 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | class LightAllAnswerVMFactory(private val resp:LightAnswersRepository): |
| | | ViewModelProvider.NewInstanceFactory() { |
| | | override fun <T : ViewModel?> create(modelClass: Class<T>): T { |
| | | return LightAnswersViewModel(resp) as T |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb; |
| | | |
| | | import android.content.Context; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.work.Worker; |
| | | import androidx.work.WorkerParameters; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.google.gson.stream.JsonReader; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.lang.reflect.Type; |
| | | import java.util.List; |
| | | |
| | | import safeluck.drive.evaluation.Constant; |
| | | import safeluck.drive.evaluation.DB.WorkRoomDataBase; |
| | | |
| | | /** |
| | | * DriveJudge |
| | | * Created by lzw on 2021/1/14. 10:40:42 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | public class LightAllQuestInitWorker extends Worker { |
| | | |
| | | public LightAllQuestInitWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) { |
| | | super(context, workerParams); |
| | | } |
| | | |
| | | @NonNull |
| | | @Override |
| | | public Result doWork() { |
| | | |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = getApplicationContext().getAssets().open(Constant.LIGHT_ALL_DEFAULT_JSON); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | InputStreamReader inputStreamReader = new InputStreamReader(inputStream); |
| | | JsonReader jsonReader = new JsonReader(inputStreamReader); |
| | | Gson gson = new Gson(); |
| | | Type type =new TypeToken<List<LightQuestion>>(){}.getType(); |
| | | List<LightQuestion> questionsList = gson.fromJson(jsonReader,type); |
| | | WorkRoomDataBase.getWorkRoomDataBase(getApplicationContext()).getLightAllQuestionsDao().insertAll(questionsList); |
| | | return Result.success(); |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb |
| | | |
| | | import kotlinx.coroutines.Dispatchers.IO |
| | | import kotlinx.coroutines.withContext |
| | | |
| | | /**DriveJudge |
| | | * Created by lzw on 2021/1/15. 10:01:31 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | class LightAllQuestRepository private constructor( |
| | | private val lightdefaulDao: LightAllQuestionsDao |
| | | ){ |
| | | |
| | | |
| | | |
| | | |
| | | fun getLightAllQuestions() = lightdefaulDao.allLightQuestions |
| | | |
| | | |
| | | companion object{ |
| | | @Volatile |
| | | private var instance:LightAllQuestRepository ?= null |
| | | |
| | | fun getInstance(lightdefaulDao: LightAllQuestionsDao)= instance?: synchronized(this){ |
| | | instance?: LightAllQuestRepository(lightdefaulDao).also { instance = it } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb |
| | | |
| | | import androidx.lifecycle.ViewModel |
| | | import androidx.lifecycle.ViewModelProvider |
| | | |
| | | /**DriveJudge |
| | | * Created by lzw on 2021/1/15. 10:29:00 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | class LightAllQuestVMFactory(private val resp:LightAllQuestRepository): |
| | | ViewModelProvider.NewInstanceFactory() { |
| | | override fun <T : ViewModel?> create(modelClass: Class<T>): T { |
| | | return LightQuestsViewModel(resp) as T |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb; |
| | | |
| | | import androidx.lifecycle.LiveData; |
| | | import androidx.room.Dao; |
| | | import androidx.room.Delete; |
| | | import androidx.room.Insert; |
| | | import androidx.room.OnConflictStrategy; |
| | | import androidx.room.Query; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * DriveJudge |
| | | * Created by lzw on 2021/1/14. 09:47:02 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | @Dao |
| | | public interface LightAllQuestionsDao { |
| | | @Insert(onConflict=OnConflictStrategy.REPLACE) |
| | | void insertQuestion(LightQuestion lightQuestions); |
| | | |
| | | @Insert(onConflict=OnConflictStrategy.REPLACE) |
| | | void insertAll(List<LightQuestion> questionsList); |
| | | |
| | | @Query("SELECT * FROM alllight_question") |
| | | List<LightQuestion> getAllLightQuestions(); |
| | | |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb; |
| | | |
| | | import androidx.room.Entity; |
| | | import androidx.room.PrimaryKey; |
| | | |
| | | /** |
| | | * DriveJudge |
| | | * Created by lzw on 2021/1/14. 13:32:56 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | @Entity(tableName = "light_all_answers") |
| | | public class LightAnswers { |
| | | @ PrimaryKey |
| | | private int id; |
| | | private int question_id; |
| | | private String answer; |
| | | private int choose; |
| | | |
| | | public int getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(int id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public int getQuestion_id() { |
| | | return question_id; |
| | | } |
| | | |
| | | public void setQuestion_id(int question_id) { |
| | | this.question_id = question_id; |
| | | } |
| | | |
| | | public String getAnswer() { |
| | | return answer; |
| | | } |
| | | |
| | | public void setAnswer(String answer) { |
| | | this.answer = answer; |
| | | } |
| | | |
| | | public int getChoose() { |
| | | return choose; |
| | | } |
| | | |
| | | public void setChoose(int choose) { |
| | | this.choose = choose; |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb |
| | | |
| | | import kotlinx.coroutines.Dispatchers.IO |
| | | import kotlinx.coroutines.withContext |
| | | |
| | | /**DriveJudge |
| | | * Created by lzw on 2021/1/15. 10:01:31 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | class LightAnswersRepository private constructor( |
| | | private val lightdefaulDao: LightAllAnswerDao |
| | | ){ |
| | | |
| | | |
| | | |
| | | |
| | | fun getLightAllQuestions(question_id:Int) =lightdefaulDao.getCurrQuest2Answers(question_id) |
| | | suspend fun updateAnswerChoose(id: Int, flag: Int) { |
| | | withContext(IO){ |
| | | lightdefaulDao.updateAnswerChoose(id,flag); |
| | | } |
| | | } |
| | | |
| | | fun getLightAllAnswers()=lightdefaulDao.getAllAnswers() |
| | | |
| | | |
| | | companion object{ |
| | | @Volatile |
| | | private var instance:LightAnswersRepository ?= null |
| | | |
| | | fun getInstance(lightdefaulDao: LightAllAnswerDao)= instance?: synchronized(this){ |
| | | instance?: LightAnswersRepository(lightdefaulDao).also { instance = it } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb |
| | | |
| | | import androidx.lifecycle.LiveData |
| | | import androidx.lifecycle.ViewModel |
| | | import androidx.lifecycle.viewModelScope |
| | | import kotlinx.coroutines.ExperimentalCoroutinesApi |
| | | import kotlinx.coroutines.cancel |
| | | import kotlinx.coroutines.launch |
| | | |
| | | /**DriveJudge |
| | | * Created by lzw on 2021/1/15. 09:46:49 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | class LightAnswersViewModel internal constructor(private val lightDefaultRepository: LightAnswersRepository): ViewModel() { |
| | | fun getQustion2Answer(quest_id:Int) =lightDefaultRepository.getLightAllQuestions(quest_id) |
| | | |
| | | |
| | | |
| | | |
| | | @ExperimentalCoroutinesApi |
| | | override fun onCleared() { |
| | | super.onCleared() |
| | | viewModelScope.cancel() |
| | | } |
| | | |
| | | fun updateAnswerChoose(id: Int, i: Int) { |
| | | viewModelScope.launch { |
| | | lightDefaultRepository.updateAnswerChoose(id,i) |
| | | } |
| | | } |
| | | |
| | | fun getAllAnswers() =lightDefaultRepository.getLightAllAnswers() |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb |
| | | |
| | | import kotlinx.coroutines.Dispatchers.IO |
| | | import kotlinx.coroutines.withContext |
| | | |
| | | /**DriveJudge |
| | | * Created by lzw on 2021/1/15. 10:01:31 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | class LightDefaultRepository private constructor( |
| | | private val lightdefaulDao: LightUseQuestionsDao |
| | | ){ |
| | | suspend fun removeItem(lightusequest:LightUseQuestions){ |
| | | withContext(IO){ |
| | | lightdefaulDao.deleteItem(lightusequest) |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | fun getLightUseQuestions() = lightdefaulDao.getLightUseQuestions() |
| | | suspend fun updateQuest2Answer(questionId: Int, answ: String) { |
| | | withContext(IO){ |
| | | |
| | | lightdefaulDao.updateAnswer(questionId,answ) |
| | | } |
| | | } |
| | | |
| | | suspend fun addItem(questionId: Int, question: String, flag: Int,answ:String) { |
| | | withContext(IO){ |
| | | |
| | | var lightquest = LightUseQuestions() |
| | | lightquest.question = question |
| | | lightquest.id = questionId |
| | | lightquest.flag = flag |
| | | lightquest.answer = answ |
| | | lightdefaulDao.insertQuestion(lightquest) |
| | | } |
| | | } |
| | | |
| | | |
| | | companion object{ |
| | | @Volatile |
| | | private var instance:LightDefaultRepository ?= null |
| | | |
| | | fun getInstance(lightdefaulDao: LightUseQuestionsDao)= instance?: synchronized(this){ |
| | | instance?: LightDefaultRepository(lightdefaulDao).also { instance = it } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb |
| | | |
| | | import androidx.lifecycle.ViewModel |
| | | import androidx.lifecycle.ViewModelProvider |
| | | |
| | | /**DriveJudge |
| | | * Created by lzw on 2021/1/15. 10:29:00 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | class LightDefaultVMFactory(private val resp:LightDefaultRepository): |
| | | ViewModelProvider.NewInstanceFactory() { |
| | | override fun <T : ViewModel?> create(modelClass: Class<T>): T { |
| | | return LightDefaultViewModel(resp) as T |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb |
| | | |
| | | import androidx.lifecycle.LiveData |
| | | import androidx.lifecycle.ViewModel |
| | | import androidx.lifecycle.viewModelScope |
| | | import kotlinx.coroutines.ExperimentalCoroutinesApi |
| | | import kotlinx.coroutines.cancel |
| | | import kotlinx.coroutines.launch |
| | | |
| | | /**DriveJudge |
| | | * Created by lzw on 2021/1/15. 09:46:49 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | class LightDefaultViewModel internal constructor(private val lightDefaultRepository: LightDefaultRepository): ViewModel() { |
| | | var allDefaultQuestion2Answers = lightDefaultRepository.getLightUseQuestions() |
| | | fun deleteItem(lightUseQuestions: LightUseQuestions){ |
| | | viewModelScope.launch { |
| | | lightDefaultRepository.removeItem(lightUseQuestions) |
| | | } |
| | | } |
| | | @ExperimentalCoroutinesApi |
| | | override fun onCleared() { |
| | | super.onCleared() |
| | | viewModelScope.cancel() |
| | | } |
| | | |
| | | fun updateQuestion2Answer(questionId: Int, answ: String) { |
| | | viewModelScope.launch { |
| | | lightDefaultRepository.updateQuest2Answer(questionId,answ) |
| | | } |
| | | } |
| | | |
| | | fun addItem(questionId: Int, Question: String, flag: Int,answer:String) { |
| | | viewModelScope.launch { |
| | | lightDefaultRepository.addItem(questionId,Question,flag,answer) |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb; |
| | | |
| | | import androidx.room.Entity; |
| | | import androidx.room.PrimaryKey; |
| | | |
| | | /** |
| | | * DriveJudge |
| | | * Created by lzw on 2021/1/14. 13:31:11 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | @Entity(tableName = "alllight_question") |
| | | public class LightQuestion { |
| | | @PrimaryKey |
| | | private int id; |
| | | |
| | | private String question; |
| | | |
| | | private int flag; |
| | | |
| | | public int getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(int id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getQuestion() { |
| | | return question; |
| | | } |
| | | |
| | | public void setQuestion(String question) { |
| | | this.question = question; |
| | | } |
| | | |
| | | |
| | | |
| | | public int getFlag() { |
| | | return flag; |
| | | } |
| | | |
| | | public void setFlag(int flag) { |
| | | this.flag = flag; |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb |
| | | |
| | | import androidx.lifecycle.LiveData |
| | | import androidx.lifecycle.ViewModel |
| | | import androidx.lifecycle.viewModelScope |
| | | import kotlinx.coroutines.ExperimentalCoroutinesApi |
| | | import kotlinx.coroutines.cancel |
| | | import kotlinx.coroutines.launch |
| | | |
| | | /**DriveJudge |
| | | * Created by lzw on 2021/1/15. 09:46:49 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | class LightQuestsViewModel internal constructor(private val lightDefaultRepository: LightAllQuestRepository): ViewModel() { |
| | | var allDefaultQuestion2Answers = lightDefaultRepository.getLightAllQuestions() |
| | | |
| | | @ExperimentalCoroutinesApi |
| | | override fun onCleared() { |
| | | super.onCleared() |
| | | viewModelScope.cancel() |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb; |
| | | |
| | | import android.content.Context; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.work.Worker; |
| | | import androidx.work.WorkerParameters; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.google.gson.stream.JsonReader; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.lang.reflect.Type; |
| | | import java.util.List; |
| | | |
| | | import safeluck.drive.evaluation.Constant; |
| | | import safeluck.drive.evaluation.DB.WorkRoomDataBase; |
| | | |
| | | /** |
| | | * DriveJudge |
| | | * Created by lzw on 2021/1/14. 10:40:42 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | public class LightUseInitWorker extends Worker { |
| | | |
| | | public LightUseInitWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) { |
| | | super(context, workerParams); |
| | | } |
| | | |
| | | @NonNull |
| | | @Override |
| | | public Result doWork() { |
| | | |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = getApplicationContext().getAssets().open(Constant.LIGHT_DEFAULT_JSON); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | InputStreamReader inputStreamReader = new InputStreamReader(inputStream); |
| | | JsonReader jsonReader = new JsonReader(inputStreamReader); |
| | | Gson gson = new Gson(); |
| | | Type type =new TypeToken<List<LightUseQuestions>>(){}.getType(); |
| | | List<LightUseQuestions> questionsList = gson.fromJson(jsonReader,type); |
| | | WorkRoomDataBase.getWorkRoomDataBase(getApplicationContext()).getLightUseQuestionsDao().insertAll(questionsList); |
| | | return Result.success(); |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb; |
| | | |
| | | import androidx.room.Entity; |
| | | import androidx.room.PrimaryKey; |
| | | |
| | | /** |
| | | * DriveJudge |
| | | * Created by lzw on 2021/1/14. 09:44:23 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | @Entity(tableName = "lightUseQuest") |
| | | public class LightUseQuestions { |
| | | @PrimaryKey |
| | | private int id; |
| | | |
| | | private String question; |
| | | private String answer; |
| | | private int flag;// 1-不可删除 0-可删除 |
| | | |
| | | public int getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(int id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getQuestion() { |
| | | return question; |
| | | } |
| | | |
| | | public void setQuestion(String question) { |
| | | this.question = question; |
| | | } |
| | | |
| | | public String getAnswer() { |
| | | return answer; |
| | | } |
| | | |
| | | public void setAnswer(String answer) { |
| | | this.answer = answer; |
| | | } |
| | | |
| | | public int getFlag() { |
| | | return flag; |
| | | } |
| | | |
| | | public void setFlag(int flag) { |
| | | this.flag = flag; |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.lightdb; |
| | | |
| | | import androidx.lifecycle.LiveData; |
| | | import androidx.room.Dao; |
| | | import androidx.room.Delete; |
| | | import androidx.room.Insert; |
| | | import androidx.room.OnConflictStrategy; |
| | | import androidx.room.Query; |
| | | |
| | | import org.jetbrains.annotations.NotNull; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * DriveJudge |
| | | * Created by lzw on 2021/1/14. 09:47:02 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | @Dao |
| | | public interface LightUseQuestionsDao { |
| | | @Insert(onConflict=OnConflictStrategy.REPLACE) |
| | | void insertQuestion(LightUseQuestions lightUseQuestions); |
| | | @Query("Update lightUseQuest set answer=:ans where id=:id") |
| | | void updateAnswer(int id,String ans); |
| | | @Insert(onConflict=OnConflictStrategy.REPLACE) |
| | | void insertAll(List<LightUseQuestions> questionsList); |
| | | |
| | | @Delete |
| | | void deleteItem(LightUseQuestions lightUseQuestions); |
| | | |
| | | @Query("SELECT * FROM lightUseQuest") |
| | | LiveData<List<LightUseQuestions>> getLightUseQuestions(); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.adapter; |
| | | |
| | | import android.content.Context; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.CompoundButton; |
| | | import android.widget.ImageView; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.RadioButton; |
| | | import android.widget.TextView; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | import safeluck.drive.evaluation.R; |
| | | import safeluck.drive.evaluation.bean.AnswerStatus; |
| | | import safeluck.drive.evaluation.bean.Question2Answers; |
| | | |
| | | /** |
| | | * DriveJudge |
| | | * Created by lzw on 2021/1/13. 14:42:59 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | public class LightExamSelectAdapter extends RecyclerView.Adapter<LightExamSelectAdapter.MyViewHolder> { |
| | | |
| | | private LayoutInflater inflater; |
| | | private Context mContext; |
| | | |
| | | OnCheckedListener onCheckedListener; |
| | | OnAddItemListener onAddItemListener; |
| | | //记录RadioButton的状态 |
| | | public HashMap<Integer, String> state_boolean = new HashMap<>(); |
| | | private List<Question2Answers> question2AnswersList = new ArrayList<>(); |
| | | |
| | | public LightExamSelectAdapter(Context context) { |
| | | this.inflater = LayoutInflater.from(context); |
| | | this.mContext = context; |
| | | } |
| | | |
| | | public void setOnCheckedListener(OnCheckedListener checkedListener){ |
| | | this.onCheckedListener = checkedListener; |
| | | } |
| | | |
| | | public void setOnAddItemListener(OnAddItemListener onAddItemListener){ |
| | | this.onAddItemListener = onAddItemListener; |
| | | } |
| | | |
| | | public interface OnCheckedListener{ |
| | | //position 跟question关联 也就是question_id; |
| | | void checked(int position,int whichAnswer); |
| | | } |
| | | |
| | | public interface OnAddItemListener{ |
| | | void add(int pos); |
| | | } |
| | | |
| | | @NonNull |
| | | @Override |
| | | public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { |
| | | View view = inflater.inflate(R.layout.light_exam_select_item,parent,false); |
| | | MyViewHolder myViewHolder = new MyViewHolder(view); |
| | | return myViewHolder; |
| | | } |
| | | |
| | | public void setDatas(List<Question2Answers> answers){ |
| | | question2AnswersList.clear(); |
| | | question2AnswersList.addAll(answers); |
| | | notifyDataSetChanged(); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { |
| | | Question2Answers question2Answers = question2AnswersList.get(position); |
| | | holder.tv_question.setText(question2Answers.getQuestion()); |
| | | List<AnswerStatus> answerList = question2Answers.getAnswerStatusList(); |
| | | |
| | | holder.linearLayout2.setVisibility(View.GONE);holder.linearLayout3.setVisibility(View.GONE); |
| | | holder.rb1.setOnCheckedChangeListener(null); |
| | | |
| | | |
| | | holder.tv_answer1.setText(String.format(mContext.getResources().getString(R.string.answer),question2Answers.getAnswerStatusList().get(0).getAnswer())); |
| | | holder.rb1.setChecked(question2Answers.getAnswerStatusList().get(0).getChoose_flag()==1?true:false); |
| | | |
| | | |
| | | |
| | | switch (answerList.size()){ |
| | | case 2: |
| | | holder.linearLayout2.setVisibility(View.VISIBLE); |
| | | AnswerStatus answerStatus1 = answerList.get(1); |
| | | holder.rb2.setOnCheckedChangeListener(null); |
| | | holder.tv_answer2.setText(String.format(mContext.getResources().getString(R.string.answer),answerStatus1.getAnswer())); |
| | | holder.rb2.setChecked(answerStatus1.getChoose_flag()==1?true:false); |
| | | break; |
| | | case 3: |
| | | holder.linearLayout2.setVisibility(View.VISIBLE);holder.linearLayout3.setVisibility(View.VISIBLE); |
| | | AnswerStatus answerStatus2= answerList.get(1); |
| | | AnswerStatus answerStatus3= answerList.get(2); |
| | | holder.rb2.setOnCheckedChangeListener(null); holder.rb3.setOnCheckedChangeListener(null); |
| | | holder.tv_answer2.setText(String.format(mContext.getResources().getString(R.string.answer),answerStatus2.getAnswer())); |
| | | holder.tv_answer3.setText(String.format(mContext.getResources().getString(R.string.answer),answerStatus3.getAnswer())); |
| | | |
| | | holder.rb2.setChecked(answerStatus2.getChoose_flag()==1?true:false); |
| | | holder.rb3.setChecked(answerStatus3.getChoose_flag()==1?true:false); |
| | | break; |
| | | } |
| | | |
| | | holder.imageView.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (onAddItemListener != null){ |
| | | onAddItemListener.add(position); |
| | | } |
| | | } |
| | | }); |
| | | holder.rb1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { |
| | | @Override |
| | | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
| | | if (isChecked){ |
| | | holder.rb2.setChecked(false); |
| | | holder.rb3.setChecked(false); |
| | | if (onCheckedListener!=null){ |
| | | onCheckedListener.checked(position,0); |
| | | } |
| | | } |
| | | } |
| | | }); holder.rb2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { |
| | | @Override |
| | | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
| | | if (isChecked){ |
| | | holder.rb1.setChecked(false); |
| | | holder.rb3.setChecked(false); |
| | | onCheckedListener.checked(position,1); |
| | | } |
| | | } |
| | | }); holder.rb3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { |
| | | @Override |
| | | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
| | | if (isChecked){ |
| | | holder.rb1.setChecked(false); |
| | | holder.rb2.setChecked(false); |
| | | onCheckedListener.checked(position,2); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public int getItemCount() { |
| | | return question2AnswersList.size(); |
| | | } |
| | | |
| | | public class MyViewHolder extends RecyclerView.ViewHolder { |
| | | |
| | | TextView tv_question; |
| | | TextView tv_answer1; |
| | | TextView tv_answer2; |
| | | TextView tv_answer3; |
| | | |
| | | ImageView imageView; |
| | | |
| | | RadioButton rb1,rb2,rb3; |
| | | |
| | | LinearLayout linearLayout2,linearLayout3; |
| | | |
| | | public MyViewHolder(@NonNull View itemView) { |
| | | super(itemView); |
| | | linearLayout2 = itemView.findViewById(R.id.ll_light_container2); |
| | | linearLayout3 = itemView.findViewById(R.id.ll_light_container3); |
| | | imageView = itemView.findViewById(R.id.iv_delete_item); |
| | | |
| | | tv_question = itemView.findViewById(R.id.tv_question); |
| | | tv_answer1 = itemView.findViewById(R.id.tv_answer1); |
| | | tv_answer2 = itemView.findViewById(R.id.tv_answer2); |
| | | tv_answer3 = itemView.findViewById(R.id.tv_answer3); |
| | | |
| | | rb1 = itemView.findViewById(R.id.rb1_light); |
| | | rb2 = itemView.findViewById(R.id.rb2_light); |
| | | rb3 = itemView.findViewById(R.id.rb3_light); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.adapter; |
| | | |
| | | import android.content.Context; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.ImageView; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import safeluck.drive.evaluation.DB.lightdb.LightUseQuestions; |
| | | import safeluck.drive.evaluation.R; |
| | | |
| | | /** |
| | | * DriveJudge |
| | | * Created by lzw on 2021/1/13. 14:42:59 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | public class LightExamUseAdapter extends RecyclerView.Adapter<LightExamUseAdapter.MyViewHolder> { |
| | | |
| | | private LayoutInflater mLayoutInflater; |
| | | private Context mContext; |
| | | private List<LightUseQuestions> examsBeans = new ArrayList<>(); |
| | | public LightExamUseAdapter(Context context) { |
| | | this.mContext = context; |
| | | mLayoutInflater = LayoutInflater.from(context); |
| | | } |
| | | |
| | | private OnDeleteListener onDeleteListener; |
| | | |
| | | public interface OnDeleteListener{ |
| | | void delete(int position); |
| | | } |
| | | |
| | | public void setOnDeleteListener(OnDeleteListener deleteListener){ |
| | | this.onDeleteListener = deleteListener; |
| | | } |
| | | |
| | | @NonNull |
| | | @Override |
| | | public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { |
| | | View view = mLayoutInflater.inflate(R.layout.light_exam_use_item,parent,false); |
| | | MyViewHolder myViewHolder = new MyViewHolder(view); |
| | | return myViewHolder; |
| | | } |
| | | |
| | | public void setDatas(List<LightUseQuestions> lightExamsBeanList){ |
| | | this.examsBeans.clear(); |
| | | this.examsBeans.addAll(lightExamsBeanList); |
| | | notifyDataSetChanged(); |
| | | } |
| | | @Override |
| | | public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { |
| | | LightUseQuestions bean = examsBeans.get(position); |
| | | holder.tv_answer.setText(String.format(mContext.getResources().getString(R.string.answer),bean.getAnswer())); |
| | | holder.tv_question.setText(bean.getQuestion()); |
| | | holder.imageView.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (bean.getFlag() == 1){ |
| | | |
| | | }else{ |
| | | if (onDeleteListener != null){ |
| | | Toast.makeText(mContext, String.format("第%d个题目被删除!",position), Toast.LENGTH_SHORT).show(); |
| | | onDeleteListener.delete(position); |
| | | } |
| | | } |
| | | |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public int getItemCount() { |
| | | return examsBeans.size(); |
| | | } |
| | | |
| | | public class MyViewHolder extends RecyclerView.ViewHolder { |
| | | TextView tv_question; |
| | | TextView tv_answer; |
| | | ImageView imageView ; |
| | | public MyViewHolder(@NonNull View itemView) { |
| | | super(itemView); |
| | | tv_answer = itemView.findViewById(R.id.tv_answer); |
| | | tv_question = itemView.findViewById(R.id.tv_question); |
| | | imageView = itemView.findViewById(R.id.iv_delete_item); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.bean; |
| | | |
| | | /** |
| | | * DriveJudge |
| | | * Created by lzw on 2021/1/15. 15:17:18 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | public class AnswerStatus { |
| | | // 1- xuanzhong |
| | | |
| | | private int choose_flag; |
| | | |
| | | private int id; |
| | | |
| | | private String answer; |
| | | |
| | | public int getChoose_flag() { |
| | | return choose_flag; |
| | | } |
| | | |
| | | public void setChoose_flag(int choose_flag) { |
| | | this.choose_flag = choose_flag; |
| | | } |
| | | |
| | | public String getAnswer() { |
| | | return answer; |
| | | } |
| | | |
| | | public void setAnswer(String answer) { |
| | | this.answer = answer; |
| | | } |
| | | |
| | | public void setId(int id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public int getId() { |
| | | return id; |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.bean; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * DriveJudge |
| | | * Created by lzw on 2021/1/14. 14:58:26 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | public class Question2Answers { |
| | | |
| | | private String question; |
| | | private int question_id; |
| | | private List<AnswerStatus> answerStatusList; |
| | | //1-已经添加到 使用的题目 0-是没有田间 |
| | | |
| | | private int add_flag; |
| | | |
| | | public List<AnswerStatus> getAnswerStatusList() { |
| | | return answerStatusList; |
| | | } |
| | | |
| | | |
| | | public int getQuestion_id() { |
| | | return question_id; |
| | | } |
| | | |
| | | public void setQuestion_id(int question_id) { |
| | | this.question_id = question_id; |
| | | } |
| | | |
| | | public void setAnswerStatusList(List<AnswerStatus> answerStatusList) { |
| | | this.answerStatusList = answerStatusList; |
| | | } |
| | | |
| | | public int getAdd_flag() { |
| | | return add_flag; |
| | | } |
| | | |
| | | public void setAdd_flag(int add_flag) { |
| | | this.add_flag = add_flag; |
| | | } |
| | | |
| | | public String getQuestion() { |
| | | return question; |
| | | } |
| | | |
| | | public void setQuestion(String question) { |
| | | this.question = question; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.customview; |
| | | |
| | | import android.content.Context; |
| | | import android.content.res.TypedArray; |
| | | import android.graphics.Canvas; |
| | | import android.graphics.Rect; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.view.View; |
| | | |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | /** |
| | | * DriveJudge |
| | | * Created by lzw on 2021/1/13. 17:09:58 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | public class MyDecoration extends RecyclerView.ItemDecoration{ |
| | | |
| | | private Context mContext; |
| | | private Drawable mDivider; |
| | | private int mOrientation; |
| | | public static final int HORIZONTAL_LIST = LinearLayoutManager.HORIZONTAL; |
| | | public static final int VERTICAL_LIST = LinearLayoutManager.VERTICAL; |
| | | |
| | | //我们通过获取系统属性中的listDivider来添加,在系统中的AppTheme中设置 |
| | | public static final int[] ATRRS = new int[]{ |
| | | android.R.attr.listDivider |
| | | }; |
| | | |
| | | public MyDecoration(Context context, int orientation) { |
| | | this.mContext = context; |
| | | final TypedArray ta = context.obtainStyledAttributes(ATRRS); |
| | | this.mDivider = ta.getDrawable(0); |
| | | ta.recycle(); |
| | | setOrientation(orientation); |
| | | } |
| | | |
| | | //设置屏幕的方向 |
| | | public void setOrientation(int orientation){ |
| | | if (orientation != HORIZONTAL_LIST && orientation != VERTICAL_LIST){ |
| | | throw new IllegalArgumentException("invalid orientation"); } mOrientation = orientation; |
| | | } |
| | | |
| | | @Override |
| | | public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) { |
| | | if (mOrientation == HORIZONTAL_LIST){ |
| | | drawVerticalLine(c, parent, state); |
| | | }else { |
| | | drawHorizontalLine(c, parent, state); |
| | | } |
| | | } |
| | | |
| | | //画横线, 这里的parent其实是显示在屏幕显示的这部分 |
| | | public void drawHorizontalLine(Canvas c, RecyclerView parent, RecyclerView.State state){ |
| | | int left = parent.getPaddingLeft(); |
| | | int right = parent.getWidth() - parent.getPaddingRight(); |
| | | final int childCount = parent.getChildCount(); |
| | | for (int i = 0; i < childCount; i++){ |
| | | final View child = parent.getChildAt(i); |
| | | |
| | | //获得child的布局信息 |
| | | final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams)child.getLayoutParams(); |
| | | final int top = child.getBottom() + params.bottomMargin; |
| | | final int bottom = top + mDivider.getIntrinsicHeight(); |
| | | mDivider.setBounds(left, top, right, bottom); |
| | | mDivider.draw(c); |
| | | //Log.d("wnw", left + " " + top + " "+right+" "+bottom+" "+i); |
| | | } |
| | | } |
| | | |
| | | //画竖线 |
| | | public void drawVerticalLine(Canvas c, RecyclerView parent, RecyclerView.State state){ |
| | | int top = parent.getPaddingTop(); |
| | | int bottom = parent.getHeight() - parent.getPaddingBottom(); |
| | | final int childCount = parent.getChildCount(); |
| | | for (int i = 0; i < childCount; i++){ |
| | | final View child = parent.getChildAt(i); |
| | | |
| | | //获得child的布局信息 |
| | | final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams)child.getLayoutParams(); |
| | | final int left = child.getRight() + params.rightMargin; |
| | | final int right = left + mDivider.getIntrinsicWidth(); |
| | | mDivider.setBounds(left, top, right, bottom); |
| | | mDivider.draw(c); |
| | | } |
| | | } |
| | | |
| | | //由于Divider也有长宽高,每一个Item需要向下或者向右偏移 |
| | | @Override |
| | | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { |
| | | if(mOrientation == HORIZONTAL_LIST){ |
| | | //画横线,就是往下偏移一个分割线的高度 |
| | | outRect.set(0, 0, 0, mDivider.getIntrinsicHeight()); |
| | | }else { |
| | | //画竖线,就是往右偏移一个分割线的宽度 |
| | | outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.fragment; |
| | | |
| | | import android.bluetooth.BluetoothAdapter; |
| | | import android.bluetooth.BluetoothDevice; |
| | | import android.content.BroadcastReceiver; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.IntentFilter; |
| | | import android.os.Bundle; |
| | | import android.os.Handler; |
| | | import android.os.Message; |
| | | import android.util.Log; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.AdapterView; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.appcompat.widget.Toolbar; |
| | | import androidx.lifecycle.Observer; |
| | | import androidx.lifecycle.ViewModelProviders; |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | import androidx.work.OneTimeWorkRequest; |
| | | import androidx.work.WorkManager; |
| | | |
| | | import com.anyun.exam.lib.AYSdk; |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | |
| | | import me.yokeyword.fragmentation.SupportFragment; |
| | | import safeluck.drive.evaluation.Constant; |
| | | import safeluck.drive.evaluation.DB.WorkRoomDataBase; |
| | | import safeluck.drive.evaluation.DB.lightdb.InjectUtils; |
| | | |
| | | import safeluck.drive.evaluation.DB.lightdb.LightAllAnswerDao; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightAllAnswerVMFactory; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightAnswers; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightAnswersViewModel; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightDefaultVMFactory; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightDefaultViewModel; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightQuestion; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightQuestsViewModel; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightUseInitWorker; |
| | | import safeluck.drive.evaluation.DB.lightdb.LightUseQuestions; |
| | | import safeluck.drive.evaluation.MainActivity; |
| | | import safeluck.drive.evaluation.R; |
| | | import safeluck.drive.evaluation.adapter.LightExamSelectAdapter; |
| | | import safeluck.drive.evaluation.adapter.LightExamUseAdapter; |
| | | import safeluck.drive.evaluation.bean.AnswerStatus; |
| | | import safeluck.drive.evaluation.bean.Question2Answers; |
| | | import safeluck.drive.evaluation.customview.MyDecoration; |
| | | |
| | | import safeluck.drive.evaluation.util.CThreadPoolExecutor; |
| | | |
| | | /** |
| | | * DriveJudge |
| | | * Created by lzw on 2020/9/1. 11:40:50 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | public class LightExamFragment extends SupportFragment implements View.OnClickListener { |
| | | |
| | | public static int UPGRADE_17_FRONT = 1; |
| | | public static int UPGRADE_17_AFTER = 0; |
| | | |
| | | |
| | | private final static String TAG = LightExamFragment.class.getSimpleName(); |
| | | private Toolbar mToolbar; |
| | | private RecyclerView recyclerView_use; |
| | | private RecyclerView recyclerView_select; |
| | | |
| | | private LightExamUseAdapter lightExamUseAdapter; |
| | | |
| | | private LightDefaultViewModel lightDefaultViewModel; |
| | | |
| | | private LightAnswersViewModel lightAnswersViewModel; |
| | | private List<LightUseQuestions> lightExamsBeans = new ArrayList<>(); |
| | | private List<Question2Answers> answersList = new ArrayList<>(); |
| | | private LightExamSelectAdapter lightExamSelectAdapter; |
| | | |
| | | private List<LightAnswers> lightAnswerList = new ArrayList<>(); |
| | | |
| | | |
| | | public static LightExamFragment newInstance() { |
| | | LightExamFragment bleScanFragment = new LightExamFragment(); |
| | | return bleScanFragment; |
| | | } |
| | | |
| | | private void initListView() { |
| | | // listView 显示 |
| | | |
| | | lightExamUseAdapter = new LightExamUseAdapter(_mActivity); |
| | | lightExamUseAdapter.setOnDeleteListener(new LightExamUseAdapter.OnDeleteListener() { |
| | | @Override |
| | | public void delete(int position) { |
| | | lightDefaultViewModel.deleteItem(lightExamsBeans.get(position)); |
| | | } |
| | | }); |
| | | lightExamSelectAdapter = new LightExamSelectAdapter(_mActivity); |
| | | |
| | | |
| | | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(_mActivity); |
| | | LinearLayoutManager linearLayoutManager_use = new LinearLayoutManager(_mActivity); |
| | | recyclerView_use.setLayoutManager(linearLayoutManager_use); |
| | | recyclerView_select.setLayoutManager(linearLayoutManager); |
| | | |
| | | lightExamSelectAdapter.setOnCheckedListener(new LightExamSelectAdapter.OnCheckedListener() { |
| | | @Override |
| | | public void checked(int position, int whichAnswer) { |
| | | Log.i(TAG, "选中的position=" + position + " whick answer=" + whichAnswer); |
| | | Question2Answers question2Answer = answersList.get(position); |
| | | int questionId = question2Answer.getQuestion_id(); |
| | | List<AnswerStatus> answerStatusList = question2Answer.getAnswerStatusList(); |
| | | AnswerStatus answerStatus = answerStatusList.get(whichAnswer); |
| | | String answ = answerStatus.getAnswer(); |
| | | Log.i(TAG, String.format("问题[%s]选中的答案=%s", question2Answer.getQuestion(), answ)); |
| | | lightDefaultViewModel.updateQuestion2Answer(questionId, answ); |
| | | |
| | | lightAnswersViewModel.updateAnswerChoose(answerStatus.getId(), 1); |
| | | for (int i = 0; i < answerStatusList.size(); i++) { |
| | | if (i != whichAnswer) { |
| | | int id = answerStatusList.get(i).getId(); |
| | | lightAnswersViewModel.updateAnswerChoose(id, 0); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | lightExamSelectAdapter.setOnAddItemListener(new LightExamSelectAdapter.OnAddItemListener() { |
| | | @Override |
| | | public void add(int pos) { |
| | | boolean flag = false; |
| | | for (int i = 0; i < lightExamsBeans.size(); i++) { |
| | | LightUseQuestions li =lightExamsBeans.get(i); |
| | | if (li!=null && li.getId()==pos){ |
| | | flag =true; |
| | | break; |
| | | } |
| | | } |
| | | if (flag){ |
| | | Toast.makeText(_mActivity, "已经添加,无需再次添加", Toast.LENGTH_SHORT).show(); |
| | | }else{ |
| | | List<AnswerStatus> answerList = answersList.get(pos).getAnswerStatusList(); |
| | | String answer=""; |
| | | for (int j = 0; j < answerList.size(); j++) { |
| | | AnswerStatus an = answerList.get(j); |
| | | LightAnswers lightAnswers = lightAnswerList.get(an.getId()); |
| | | if ( lightAnswers .getChoose()==1){ |
| | | answer = lightAnswers.getAnswer(); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | lightDefaultViewModel.addItem(pos,answersList.get(pos).getQuestion(),0,answer); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | recyclerView_select.setAdapter(lightExamSelectAdapter); |
| | | recyclerView_use.setAdapter(lightExamUseAdapter); |
| | | recyclerView_select.addItemDecoration(new MyDecoration(_mActivity, MyDecoration.VERTICAL_LIST)); |
| | | recyclerView_use.addItemDecoration(new MyDecoration(_mActivity, MyDecoration.VERTICAL_LIST)); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 初始化列表 |
| | | */ |
| | | private void initView(View view) { |
| | | mToolbar = (Toolbar) view.findViewById(R.id.toolbar); |
| | | mToolbar.setTitle("灯光考试题目"); |
| | | recyclerView_select = view.findViewById(R.id.recyclerview_select); |
| | | recyclerView_use = view.findViewById(R.id.recyclerview_useexams); |
| | | view.findViewById(R.id.btn_light_cancle).setOnClickListener(this); |
| | | view.findViewById(R.id.btn_light_sure).setOnClickListener(this); |
| | | view.findViewById(R.id.btn_light_default).setOnClickListener(this); |
| | | initListView(); |
| | | LightDefaultVMFactory lightDefaultVMFactory = InjectUtils.INSTANCE.provideLightDefaultViewModelFactory(requireContext()); |
| | | LightAllAnswerVMFactory lightAllAnswerVMFactory = InjectUtils.INSTANCE.provideLightAllAnswerViewModelFactory(requireContext()); |
| | | lightDefaultViewModel = ViewModelProviders.of(this, lightDefaultVMFactory).get(LightDefaultViewModel.class); |
| | | lightAnswersViewModel = ViewModelProviders.of(this, lightAllAnswerVMFactory).get(LightAnswersViewModel.class); |
| | | lightAnswersViewModel.getAllAnswers().observe(this, new Observer<List<LightAnswers>>() { |
| | | @Override |
| | | public void onChanged(List<LightAnswers> lightAnswers) { |
| | | lightAnswerList.clear(); |
| | | lightAnswerList.addAll(lightAnswers); |
| | | } |
| | | }); |
| | | CThreadPoolExecutor.runInBackground(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | List<LightQuestion> lightQuestions = WorkRoomDataBase.getWorkRoomDataBase(_mActivity).getLightAllQuestionsDao().getAllLightQuestions(); |
| | | LightAllAnswerDao lightAllAnswerDao = WorkRoomDataBase.getWorkRoomDataBase(_mActivity).getLightAllAnswersDao(); |
| | | for (int i = 0; i < lightQuestions.size(); i++) { |
| | | LightQuestion lightQuestion = lightQuestions.get(i); |
| | | int question_id = lightQuestion.getId(); |
| | | String question = lightQuestion.getQuestion(); |
| | | Question2Answers question2Answers = new Question2Answers(); |
| | | question2Answers.setQuestion_id(question_id); |
| | | question2Answers.setQuestion(question); |
| | | |
| | | List<LightAnswers> lightAnswers = lightAllAnswerDao.getCurrQuest2Answers(question_id); |
| | | |
| | | List<AnswerStatus> answerStatusList = new ArrayList<>(); |
| | | |
| | | for (int j = 0; j < lightAnswers.size(); j++) { |
| | | AnswerStatus answerStatus = new AnswerStatus(); |
| | | LightAnswers lightAnswers1 = lightAnswers.get(j); |
| | | String str = lightAnswers1.getAnswer(); |
| | | answerStatus.setAnswer(str); |
| | | answerStatus.setChoose_flag(lightAnswers1.getChoose()); |
| | | answerStatus.setId(lightAnswers1.getId()); |
| | | answerStatusList.add(answerStatus); |
| | | } |
| | | question2Answers.setAnswerStatusList(answerStatusList); |
| | | answersList.add(question2Answers); |
| | | |
| | | } |
| | | CThreadPoolExecutor.runOnMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | lightExamSelectAdapter.setDatas(answersList); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | lightDefaultViewModel.getAllDefaultQuestion2Answers().observe(this, new Observer<List<LightUseQuestions>>() { |
| | | @Override |
| | | public void onChanged(List<LightUseQuestions> lightUseQuestions) { |
| | | lightExamsBeans.clear(); |
| | | lightExamsBeans.addAll(lightUseQuestions); |
| | | lightExamUseAdapter.setDatas(lightExamsBeans); |
| | | } |
| | | }); |
| | | |
| | | |
| | | if (HomeFragment.class.getSimpleName().equals(getTopFragment().getClass().getSimpleName())) { |
| | | ((MainActivity) _mActivity).viewtitle.setVisibility(View.VISIBLE); |
| | | ((MainActivity) _mActivity).btn_return.setVisibility(View.VISIBLE); |
| | | |
| | | } else { |
| | | ((MainActivity) _mActivity).viewtitle.setVisibility(View.GONE); |
| | | ((MainActivity) _mActivity).btn_return.setVisibility(View.GONE); |
| | | } |
| | | initToolbarNav(mToolbar); |
| | | |
| | | |
| | | } |
| | | |
| | | protected void initToolbarNav(Toolbar toolbar) { |
| | | toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp); |
| | | toolbar.setNavigationOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | |
| | | pop(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onDetach() { |
| | | super.onDetach(); |
| | | ((MainActivity) _mActivity).viewtitle.setVisibility(View.VISIBLE); |
| | | ((MainActivity) _mActivity).btn_return.setVisibility(View.VISIBLE); |
| | | } |
| | | |
| | | @Nullable |
| | | @Override |
| | | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| | | View view = inflater.inflate(R.layout.fragment_light_exam_list, container, false); |
| | | initView(view); |
| | | return view; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | switch (v.getId()){ |
| | | case R.id.btn_light_cancle: |
| | | pop(); |
| | | break; |
| | | case R.id.btn_light_default: |
| | | OneTimeWorkRequest oneTimeWorkRequest = OneTimeWorkRequest.from(LightUseInitWorker.class); |
| | | WorkManager.getInstance(_mActivity).enqueue(oneTimeWorkRequest); |
| | | break; |
| | | case R.id.btn_sure: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | Log.i(TAG, "onResume"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onStop() { |
| | | super.onStop(); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | break; |
| | | case 2: |
| | | Toast.makeText(_mActivity, "灯光题目设置", Toast.LENGTH_SHORT).show(); |
| | | if (getParentFragment() instanceof BaseSettingFragment){ |
| | | ((BaseSettingFragment)getParentFragment()).start( LightExamFragment.newInstance()); |
| | | } |
| | | |
| | | break; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <shape xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:shape="rectangle"> |
| | | <solid android:color="#FF4081"/> |
| | | <size android:height="1dp"/> |
| | | </shape> |
New file |
| | |
| | | <vector android:height="60dp" android:viewportHeight="1024" |
| | | android:viewportWidth="1024" android:width="60dp" xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <path android:fillColor="#81C1ED" android:pathData="M512,65C265.1,65 65,265.1 65,512s200.1,447 447,447 447,-200.1 447,-447S758.9,65 512,65zM778.3,498c0,17.6 -14.4,32 -32,32L558,530v188.3c0,17.6 -14.4,32 -32,32s-32,-14.4 -32,-32L494,530L305.7,530c-17.6,0 -32,-14.4 -32,-32s14.4,-32 32,-32L494,466L494,277.7c0,-17.6 14.4,-32 32,-32s32,14.4 32,32L558,466h188.3c17.6,0 32,14.4 32,32z"/> |
| | | </vector> |
New file |
| | |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="200dp" |
| | | android:height="200dp" |
| | | android:viewportWidth="1024" |
| | | android:viewportHeight="1024"> |
| | | <path |
| | | android:pathData="M512,65C265.1,65 65,265.1 65,512s200.1,447 447,447 447,-200.1 447,-447S758.9,65 512,65zM778.3,498c0,17.6 -14.4,32 -32,32L558,530v188.3c0,17.6 -14.4,32 -32,32s-32,-14.4 -32,-32L494,530L305.7,530c-17.6,0 -32,-14.4 -32,-32s14.4,-32 32,-32L494,466L494,277.7c0,-17.6 14.4,-32 32,-32s32,14.4 32,32L558,466h188.3c17.6,0 32,14.4 32,32z" |
| | | android:fillColor="#cdcdcd"/> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <item android:state_enabled="true" android:state_pressed="true" android:drawable="@drawable/ic_add"/> |
| | | <item android:state_enabled="false" android:state_pressed="false" android:drawable="@drawable/ic_add_disable"/> |
| | | </selector> |
New file |
| | |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="60dp" |
| | | android:height="60dp" |
| | | android:viewportWidth="1024" |
| | | android:viewportHeight="1024"> |
| | | <path |
| | | android:pathData="M512,96C283.2,96 96,283.2 96,512s187.2,416 416,416 416,-187.2 416,-416S740.8,96 512,96zM512,844.8c-183.04,0 -332.8,-149.76 -332.8,-332.8S328.96,179.2 512,179.2 844.8,328.96 844.8,512 695.04,844.8 512,844.8z" |
| | | android:fillColor="#1296db"/> |
| | | </vector> |
New file |
| | |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="60dp" |
| | | android:height="60dp" |
| | | android:viewportWidth="1024" |
| | | android:viewportHeight="1024"> |
| | | <path |
| | | android:pathData="M512,152c96.2,0 186.6,37.4 254.6,105.4S872,415.8 872,512s-37.4,186.6 -105.4,254.6S608.2,872 512,872c-96.2,0 -186.6,-37.4 -254.6,-105.4S152,608.2 152,512s37.4,-186.6 105.4,-254.6S415.8,152 512,152m0,-56C282.2,96 96,282.2 96,512s186.2,416 416,416 416,-186.2 416,-416S741.8,96 512,96z" |
| | | android:fillColor="#1296db"/> |
| | | <path |
| | | android:pathData="M727,297C669.6,239.6 593.2,208 512,208c-81.2,0 -157.6,31.6 -215,89C239.6,354.4 208,430.8 208,512s31.6,157.6 89,215C354.4,784.4 430.8,816 512,816c81.2,0 157.6,-31.6 215,-89C784.4,669.6 816,593.2 816,512s-31.6,-157.6 -89,-215z" |
| | | android:fillColor="#1296db"/> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <item android:state_checked="true" android:drawable="@drawable/ic_select_yes" android:state_enabled="true"/> |
| | | <item android:state_checked="false" android:drawable="@drawable/ic_select_no" android:state_enabled="false"/> |
| | | </selector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | |
| | | |
| | | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:orientation="vertical"> |
| | | |
| | | <include layout="@layout/toolbar"/> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/ic_bground" |
| | | android:orientation="horizontal" |
| | | > |
| | | |
| | | <LinearLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="match_parent" |
| | | android:layout_weight="1" |
| | | android:paddingLeft="@dimen/ui_margin_10dp" |
| | | android:orientation="vertical" |
| | | > |
| | | |
| | | <TextView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="@dimen/ui_margin_50dp" |
| | | android:textColor="@android:color/white" |
| | | android:textSize="28sp" |
| | | android:text="目前使用的题目"/> |
| | | <androidx.recyclerview.widget.RecyclerView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:layout_weight="1" |
| | | android:id="@+id/recyclerview_useexams"/> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:gravity="center_vertical" |
| | | android:layout_height="@dimen/ui_margin_60dp" |
| | | android:orientation="horizontal"> |
| | | <Button |
| | | android:layout_width="0dp" |
| | | android:layout_height="@dimen/ui_margin_50dp" |
| | | android:text="取消" |
| | | android:id="@+id/btn_light_cancle" |
| | | android:layout_weight="1"/> |
| | | <Button |
| | | android:layout_width="0dp" |
| | | android:layout_height="@dimen/ui_margin_50dp" |
| | | android:text="恢复默认" |
| | | android:id="@+id/btn_light_default" |
| | | android:layout_weight="1"/> |
| | | <Button |
| | | android:layout_width="0dp" |
| | | android:layout_height="@dimen/ui_margin_50dp" |
| | | android:id="@+id/btn_light_sure" |
| | | android:text="确认" |
| | | android:layout_weight="1"/> |
| | | </LinearLayout> |
| | | </LinearLayout> |
| | | <LinearLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="match_parent" |
| | | android:layout_weight="1" |
| | | android:paddingRight="@dimen/ui_margin_10dp" |
| | | android:paddingLeft="@dimen/ui_margin_10dp" |
| | | android:orientation="vertical" |
| | | > |
| | | |
| | | <TextView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="@dimen/ui_margin_50dp" |
| | | android:textColor="@android:color/white" |
| | | android:textSize="28sp" |
| | | android:text="可以更换的题目"/> |
| | | <androidx.recyclerview.widget.RecyclerView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:id="@+id/recyclerview_select"/> |
| | | |
| | | </LinearLayout> |
| | | |
| | | </LinearLayout> |
| | | </LinearLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <RelativeLayout |
| | | xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | |
| | | android:padding="@dimen/ui_margin_10dp"> |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="@dimen/ui_margin_50dp" |
| | | android:textSize="25sp" |
| | | android:layout_marginLeft="@dimen/ui_margin_60dp" |
| | | android:gravity="center_vertical" |
| | | android:textColor="@android:color/white" |
| | | android:drawablePadding="@dimen/ui_margin_10dp" |
| | | android:drawableLeft="@drawable/aliyun_svideo_icon_upload_success" |
| | | android:text="请开起前照灯" |
| | | android:id="@+id/tv_question"/> |
| | | |
| | | <RadioGroup |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_below="@+id/tv_question" |
| | | android:layout_marginLeft="@dimen/ui_margin_60dp" |
| | | android:layout_marginTop="@dimen/ui_margin_10dp" |
| | | android:orientation="vertical"> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:orientation="horizontal"> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_answer1" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="@dimen/ui_margin_40dp" |
| | | |
| | | android:layout_weight="1" |
| | | android:text="@string/answer" |
| | | android:textColor="@android:color/white" |
| | | android:textSize="20sp" /> |
| | | |
| | | <RadioButton |
| | | android:layout_width="@dimen/ui_margin_60dp" |
| | | android:layout_height="@dimen/ui_margin_60dp" |
| | | android:id="@+id/rb1_light" |
| | | android:background="@null" |
| | | android:button="@drawable/radiobutton_selector" |
| | | android:textSize="22sp" /> |
| | | </LinearLayout> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:visibility="gone" |
| | | android:layout_marginTop="@dimen/ui_margin_10dp" |
| | | android:id="@+id/ll_light_container2" |
| | | android:orientation="horizontal"> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_answer2" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="@dimen/ui_margin_40dp" |
| | | |
| | | android:layout_weight="1" |
| | | android:text="@string/answer" |
| | | android:textColor="@android:color/white" |
| | | android:textSize="20sp" /> |
| | | |
| | | <RadioButton |
| | | android:layout_width="@dimen/ui_margin_60dp" |
| | | android:layout_height="@dimen/ui_margin_60dp" |
| | | android:id="@+id/rb2_light" |
| | | android:background="@null" |
| | | android:button="@drawable/radiobutton_selector" |
| | | android:textSize="22sp" /> |
| | | </LinearLayout> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="@dimen/ui_margin_10dp" |
| | | android:visibility="gone" |
| | | android:id="@+id/ll_light_container3" |
| | | android:orientation="horizontal"> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_answer3" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="@dimen/ui_margin_40dp" |
| | | |
| | | android:layout_weight="1" |
| | | android:text="@string/answer" |
| | | android:textColor="@android:color/white" |
| | | android:textSize="20sp" /> |
| | | |
| | | <RadioButton |
| | | android:layout_width="@dimen/ui_margin_60dp" |
| | | android:layout_height="@dimen/ui_margin_60dp" |
| | | android:id="@+id/rb3_light" |
| | | android:background="@null" |
| | | android:button="@drawable/radiobutton_selector" |
| | | android:textSize="22sp" /> |
| | | </LinearLayout> |
| | | |
| | | </RadioGroup> |
| | | |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/ui_margin_50dp" |
| | | android:layout_height="@dimen/ui_margin_50dp" |
| | | android:src="@drawable/ic_add_selector" |
| | | android:layout_alignParentStart="true" |
| | | android:id="@+id/iv_delete_item" |
| | | android:layout_centerVertical="true"/> |
| | | </RelativeLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <RelativeLayout |
| | | xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" |
| | | android:layout_height="110dp" |
| | | android:padding="@dimen/ui_margin_10dp"> |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="@dimen/ui_margin_50dp" |
| | | android:textSize="25sp" |
| | | android:gravity="center_vertical" |
| | | android:textColor="@android:color/white" |
| | | android:drawablePadding="@dimen/ui_margin_10dp" |
| | | android:drawableLeft="@drawable/aliyun_svideo_icon_upload_success" |
| | | android:text="请开起前照灯" |
| | | android:id="@+id/tv_question"/> |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:textSize="20sp" |
| | | android:id="@+id/tv_answer" |
| | | android:layout_marginTop="@dimen/ui_margin_10dp" |
| | | android:layout_below="@+id/tv_question" |
| | | android:textColor="@android:color/white" |
| | | android:layout_height="@dimen/ui_margin_40dp" |
| | | android:text="@string/answer"/> |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/ui_margin_50dp" |
| | | android:layout_height="@dimen/ui_margin_50dp" |
| | | android:src="@drawable/umeng_socialize_delete" |
| | | android:layout_alignParentEnd="true" |
| | | android:id="@+id/iv_delete_item" |
| | | android:layout_centerVertical="true"/> |
| | | </RelativeLayout> |
| | |
| | | </string-array> |
| | | |
| | | <string-array name="array_large_item_menu"> |
| | | <!-- <item>灯光设置</item>--> |
| | | <item>规则设置</item> |
| | | <item>蓝牙扫描</item> |
| | | <item>灯光随机题目</item> |
| | | <!-- <item>指令设置</item> |
| | | <item>系统设置</item> |
| | | <item>教学系统设置</item> |
| | |
| | | |
| | | <string name="auto_act_to_select">请选择需要连接的蓝牙设备</string> |
| | | <string name="auto_act_to_refresh">请尝试下拉刷新,进行扫描周围蓝牙设备</string> |
| | | <string name="answer">答案:%1$s</string> |
| | | |
| | | </resources> |
| | |
| | | <item name="colorPrimary">@color/colorPrimary</item> |
| | | <item name="colorPrimaryDark">@color/colorPrimaryDark</item> |
| | | <item name="colorAccent">@color/colorAccent</item> |
| | | <item name="android:listDivider">@drawable/divider</item> |
| | | |
| | | </style> |
| | | |
| | | <style name="AppTheme.NoActionBar.AppBarOverlay" |