From 06b8160354c724f7730ababe4df504a2fd8e3c25 Mon Sep 17 00:00:00 2001
From: lizhanwei <Dana_Lee1016@126.com>
Date: 星期一, 23 三月 2020 16:42:55 +0800
Subject: [PATCH] 完成科三项目状态颜色变化
---
app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java b/app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java
index 9ccbf39..60f2901 100644
--- a/app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java
+++ b/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("杩涘叆鑰冨満缁撴潫鑰冭瘯锛宻tartexam="+examStatus.getStartExam());
- return getResources().getColor(R.color.colorAccent);
+ return getResources().getDrawable(R.drawable.ic_btn_fail);
}else{
MyLog.i("杩涘叆鑰冨満锛宼ype="+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("璇ラ」鑰冭瘯澶辫触锛宼ype="+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);
}
--
Gitblit v1.8.0