lizhanwei
2020-03-23 06b8160354c724f7730ababe4df504a2fd8e3c25
app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java
@@ -4,6 +4,7 @@
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import androidx.annotation.NonNull;
@@ -124,7 +125,6 @@
    private List<SimulateNightBean.QuestionBean> tempQs=  new ArrayList<>();
    private TableRow tableRow1,tableRow2,tableRow3;
    private Button btn_1,btn_2;
private List<Integer> btn_ids = new ArrayList<Integer>();
    private Handler mHandler = new Handler(new Handler.Callback() {
@@ -141,7 +141,8 @@
                for (int i = 0; i < btn_ids.size(); i++) {
                    int viewId = getResources().getIdentifier(String.valueOf(btn_ids.get(i)),"id",_mActivity.getPackageName());
                    ((Button) view.findViewById(viewId)).setBackgroundColor(100+i+1);
                    ((Button) view.findViewById(viewId)).setBackground(bbb(101+i));
                }
            }
            if (msg.what == SPEED_DATA){
@@ -288,7 +289,7 @@
     * @param type
     * @return
     */
    private int bbb(int type) {
    private Drawable bbb(int type) {
        if (examStatusList!=null &&examStatusList.size()>0){
            for (ExamStatus examStatus:
                    examStatusList) {
@@ -298,23 +299,23 @@
                        if (examStatusList.get(0).getStartExam() == Constant.NONE_BEEN_START_EXAM){
                            //结束考试了
                            MyLog.i("进入考场结束考试,startexam="+examStatus.getStartExam());
                            return getResources().getColor(R.color.colorAccent);
                            return getResources().getDrawable(R.drawable.ic_btn_fail);
                        }else{
                            MyLog.i("进入考场,type="+type);
                            return getResources().getColor(R.color.pink);
                            return getResources().getDrawable(R.drawable.ic_btn_examing);
                        }
                    }else if (examStatus.getEnter() == safeluck.drive.evaluation.DB.Constant.FINISH_ITEM){
                        if (examStatusList.get(0).getStartExam()==Constant.NONE_BEEN_START_EXAM){
                            return getResources().getColor(R.color.examing);
                            return getResources().getDrawable(R.drawable.ic_btn_daikao);
                        }
                        String ss=ExamPlatformData.getInstance().getItemStatusStr(type);
                        if (item_conents.contains(ss)) {
                            MyLog.i("该项考试失败,type="+type);
                            return getResources().getColor(R.color.colorAccent);
                            return getResources().getDrawable(R.drawable.ic_btn_fail);
                        }else{
                            if (examStatus.getResult() ==1){
                                MyLog.i(String.format("已经播放过%s合格",ss));
@@ -323,16 +324,16 @@
                                examStatusViewModel.updateItemExamResult(1,examStatus.getMap_id());
                            }
                            return getResources().getColor(R.color.train_btn_return);
                            return getResources().getDrawable(R.drawable.ic_btn_succ);
                        }
                    }else{
                        return getResources().getColor(R.color.examing);
                        return getResources().getDrawable(R.drawable.ic_btn_daikao);
                    }
                }
            }
        }
        return getResources().getColor(R.color.examing);
        return getResources().getDrawable(R.drawable.ic_btn_daikao);
    }