单元格数据渲染逻辑
This commit is contained in:
@@ -11,7 +11,10 @@ import java.util.ArrayList;
|
||||
public class CheckItemInfo implements Serializable {
|
||||
//view类型
|
||||
private int style;
|
||||
//view标题 版本检测 系统检测...
|
||||
//view顶端标题
|
||||
private String viewTitle;
|
||||
|
||||
//icon 下第一行title 自动驾驶软件\鹰眼系统
|
||||
private String title;
|
||||
|
||||
private String value;
|
||||
@@ -59,6 +62,14 @@ public class CheckItemInfo implements Serializable {
|
||||
this.style = style;
|
||||
}
|
||||
|
||||
public String getViewTitle() {
|
||||
return viewTitle;
|
||||
}
|
||||
|
||||
public void setViewTitle(String viewTitle) {
|
||||
this.viewTitle = viewTitle;
|
||||
}
|
||||
|
||||
public static class DetailItem implements Serializable {
|
||||
private String title;
|
||||
private String value;
|
||||
|
||||
@@ -83,6 +83,7 @@ public class CheckActivity extends AppCompatActivity {
|
||||
ArrayList list = new ArrayList(1);
|
||||
CheckItemInfo info = new CheckItemInfo();
|
||||
info.setUsual(false);
|
||||
info.setTitle("自动驾驶车辆存在风险");
|
||||
info.setStyle(CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_TITLE);
|
||||
list.add(info);
|
||||
dataArrayList.add(0, list);
|
||||
@@ -109,35 +110,35 @@ public class CheckActivity extends AppCompatActivity {
|
||||
* **************************************************************************************版本检测
|
||||
*/
|
||||
public void versionCheckResult() {
|
||||
ArrayList arrayList = new ArrayList(2);
|
||||
//adas
|
||||
ArrayList arrayVer = new ArrayList();
|
||||
//adas 检测指标
|
||||
|
||||
//鹰眼
|
||||
String verCodeStr = CommonUtils.getVersionName(context, true);
|
||||
Log.d(TAG, "版本检测结果:鹰眼" + verCodeStr);
|
||||
|
||||
//测试数据
|
||||
CheckItemInfo itemInfo = new CheckItemInfo();
|
||||
itemInfo.setViewTitle("版本检测:");
|
||||
itemInfo.setUsual(true);
|
||||
itemInfo.setTitle("自动驾驶升级到\\n 版本3.1.2.7");
|
||||
itemInfo.setTitle("自动驾驶升级到\n 版本3.1.2.7");
|
||||
if ("不是最新版本" != null) {
|
||||
itemInfo.setValue("版本升级");
|
||||
}
|
||||
arrayList.add(itemInfo);
|
||||
arrayVer.add(itemInfo);
|
||||
|
||||
CheckItemInfo yingyan = new CheckItemInfo();
|
||||
yingyan.setUsual(true);
|
||||
yingyan.setTitle(" 鹰眼\\n版本" + verCodeStr);
|
||||
yingyan.setTitle(" 鹰眼 \n版本" + verCodeStr);
|
||||
yingyan.setValue("最新版本 无风险");
|
||||
arrayList.add(yingyan);
|
||||
dataArrayList.add(arrayList);
|
||||
arrayVer.add(yingyan);
|
||||
dataArrayList.add(arrayVer);
|
||||
}
|
||||
|
||||
/**
|
||||
* **************************************************************************************系统检测
|
||||
*/
|
||||
public void systemCheckResult() {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
ArrayList arrSys = new ArrayList();
|
||||
//网络
|
||||
netStatus();
|
||||
//电量
|
||||
@@ -148,6 +149,7 @@ public class CheckActivity extends AppCompatActivity {
|
||||
double memory = CommonUtils.getMemory(packageName);
|
||||
//风险状态
|
||||
CheckItemInfo itemInfo = new CheckItemInfo();
|
||||
itemInfo.setViewTitle("系统检测:");
|
||||
itemInfo.setTitle("自动驾驶系统");
|
||||
itemInfo.setUsual(false);
|
||||
itemInfo.setValue("存在风险");
|
||||
@@ -156,13 +158,13 @@ public class CheckActivity extends AppCompatActivity {
|
||||
item.setTitle("工控机链接状态");
|
||||
item.setValue("断开");
|
||||
itemInfo.setItemList(item);
|
||||
arrayList.add(itemInfo);
|
||||
arrSys.add(itemInfo);
|
||||
|
||||
//鹰眼测试数据
|
||||
CheckItemInfo yingyan = new CheckItemInfo();
|
||||
yingyan.setTitle("鹰眼软件");
|
||||
yingyan.setUsual(false);
|
||||
yingyan.setValue("存在风险");
|
||||
yingyan.setValue("无风险");
|
||||
|
||||
CheckItemInfo.DetailItem netItem = new CheckItemInfo.DetailItem();
|
||||
netItem.setTitle("网络状态");
|
||||
@@ -183,9 +185,9 @@ public class CheckActivity extends AppCompatActivity {
|
||||
memoryItem.setTitle("内存占比");
|
||||
memoryItem.setValue(String.valueOf(memory));
|
||||
yingyan.setItemList(cpuItem);
|
||||
arrayList.add(yingyan);
|
||||
arrSys.add(yingyan);
|
||||
|
||||
dataArrayList.add(arrayList);
|
||||
dataArrayList.add(arrSys);
|
||||
|
||||
}
|
||||
|
||||
@@ -250,6 +252,21 @@ public class CheckActivity extends AppCompatActivity {
|
||||
* 时延 工控机->云 工控机->鹰眼 什么数据的时延
|
||||
*/
|
||||
public void software() {
|
||||
ArrayList arrSoftware = new ArrayList();
|
||||
CheckItemInfo itemInfo = new CheckItemInfo();
|
||||
itemInfo.setViewTitle("软件检测:");
|
||||
itemInfo.setTitle("自动驾驶系统");
|
||||
itemInfo.setUsual(true);
|
||||
itemInfo.setValue("无风险");
|
||||
arrSoftware.add(itemInfo);
|
||||
|
||||
CheckItemInfo itemY = new CheckItemInfo();
|
||||
itemY.setTitle("鹰眼软件");
|
||||
itemY.setUsual(true);
|
||||
itemY.setValue("无风险");
|
||||
arrSoftware.add(itemY);
|
||||
dataArrayList.add(arrSoftware);
|
||||
|
||||
time();
|
||||
}
|
||||
|
||||
@@ -258,6 +275,7 @@ public class CheckActivity extends AppCompatActivity {
|
||||
* 需要产品确认哪些指标? 定位+周边识别?
|
||||
*/
|
||||
public long time() {
|
||||
|
||||
final long start = System.nanoTime();
|
||||
long adasDataTime = TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start));
|
||||
Log.i("ADAS数据延时", "接收数据 -> 发出 cost :" + adasDataTime + "ms");
|
||||
@@ -285,9 +303,10 @@ public class CheckActivity extends AppCompatActivity {
|
||||
* 9、路由器
|
||||
*/
|
||||
public void hardware() {
|
||||
ArrayList list = new ArrayList();
|
||||
ArrayList arrHardware = new ArrayList();
|
||||
CheckItemInfo itemInfo = new CheckItemInfo();
|
||||
itemInfo.setTitle("(下面 1 项存在异常)");
|
||||
itemInfo.setViewTitle("硬件检测:");
|
||||
itemInfo.setTitle("自动驾驶系统");
|
||||
itemInfo.setUsual(false);
|
||||
|
||||
CheckItemInfo.DetailItem detailItem = new CheckItemInfo.DetailItem();
|
||||
@@ -339,8 +358,9 @@ public class CheckActivity extends AppCompatActivity {
|
||||
luyou.setTitle("路由器");
|
||||
luyou.setValue("正常");
|
||||
itemInfo.setItemList(luyou);
|
||||
list.add(itemInfo);
|
||||
dataArrayList.add(list);
|
||||
arrHardware.add(itemInfo);
|
||||
|
||||
dataArrayList.add(arrHardware);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,6 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
*/
|
||||
class CheckListViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView viewTitle;
|
||||
private TextView detailTitle;
|
||||
private TextView iconAutoTitle;
|
||||
private TextView autoRiskState;
|
||||
|
||||
@@ -97,7 +96,6 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
public CheckListViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
viewTitle = itemView.findViewById(R.id.list_item_title);
|
||||
detailTitle = itemView.findViewById(R.id.detail_title);
|
||||
//自动驾驶
|
||||
iconAutoTitle = itemView.findViewById(R.id.icon_auto_title);
|
||||
autoRiskState = itemView.findViewById(R.id.auto_risk_state);
|
||||
@@ -149,25 +147,22 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
try {
|
||||
Object list = dataArrayList.get(position);
|
||||
if (position == 0) {
|
||||
((CheckTitleViewHolder) holder).mTextView.setText("自动驾驶车辆正常");
|
||||
// ((CheckTitleViewHolder) holder).errorImage.;
|
||||
if (list instanceof ArrayList && ((ArrayList) list).size() > 0) {
|
||||
CheckItemInfo item = (CheckItemInfo) ((ArrayList) list).get(0);
|
||||
((CheckTitleViewHolder) holder).mTextView.setText(item.getTitle());
|
||||
if (item.isUsual() == true) {
|
||||
((CheckTitleViewHolder) holder).errorImage.setImageResource(R.drawable.check_right);
|
||||
} else {
|
||||
((CheckTitleViewHolder) holder).errorImage.setImageResource(R.drawable.check_wrong);
|
||||
}
|
||||
}
|
||||
} else if (position == dataArrayList.size() - 1) {
|
||||
((CheckListViewHolder) holder).viewTitle.setText("硬件检测:");
|
||||
} else {
|
||||
switch (position) {
|
||||
case 1:
|
||||
((CheckListViewHolder) holder).viewTitle.setText("版本检测:");
|
||||
break;
|
||||
case 2:
|
||||
((CheckListViewHolder) holder).viewTitle.setText("系统检测:");
|
||||
break;
|
||||
case 3:
|
||||
((CheckListViewHolder) holder).viewTitle.setText("软件检测:");
|
||||
break;
|
||||
}
|
||||
((CheckListViewHolder) holder).detailTitle.setText("(以下 1 项需要优化,版本升级后需要重启设备)");
|
||||
if (list instanceof ArrayList && ((ArrayList) list).size() > 1) {
|
||||
CheckItemInfo item = (CheckItemInfo) ((ArrayList) list).get(0);
|
||||
((CheckListViewHolder) holder).viewTitle.setText(item.getViewTitle());
|
||||
//自动驾驶
|
||||
((CheckListViewHolder) holder).iconAutoTitle.setText(item.getTitle());
|
||||
((CheckListViewHolder) holder).autoRiskState.setText(item.getValue());
|
||||
if (item.isUsual() == true) {
|
||||
@@ -175,6 +170,15 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
} else {
|
||||
((CheckListViewHolder) holder).autoRiskState.setTextColor(mContext.getResources().getColor(R.color.check_tip_error_color));
|
||||
}
|
||||
//鹰眼
|
||||
CheckItemInfo itemForYing = (CheckItemInfo) ((ArrayList) list).get(1);
|
||||
((CheckListViewHolder) holder).iconyingTitle.setText(itemForYing.getTitle());
|
||||
((CheckListViewHolder) holder).yingRiskState.setText(itemForYing.getValue());
|
||||
if (itemForYing.isUsual() == true) {
|
||||
((CheckListViewHolder) holder).yingRiskState.setTextColor(mContext.getResources().getColor(R.color.check_little_btn_green));
|
||||
} else {
|
||||
((CheckListViewHolder) holder).yingRiskState.setTextColor(mContext.getResources().getColor(R.color.check_tip_error_color));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -184,7 +188,7 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 5;
|
||||
return dataArrayList.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BIN
modules/mogo-module-check/src/main/res/drawable/check_right.png
Normal file
BIN
modules/mogo-module-check/src/main/res/drawable/check_right.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
@@ -17,24 +17,13 @@
|
||||
android:layout_marginStart="@dimen/dp_80"
|
||||
android:layout_marginLeft="@dimen/dp_50"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:text="版本检测:"
|
||||
android:text="版本检测:(以下 1 项需要优化,版本升级后需要重启设备)"
|
||||
android:textColor="@color/module_commons_wm_dialog_text_textColor"
|
||||
android:textSize="@dimen/dp_42"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_50"
|
||||
android:text="(以下 1 项需要优化,版本升级后需要重启设备)"
|
||||
android:textColor="@color/module_commons_wm_dialog_text_textColor"
|
||||
android:textSize="@dimen/dp_42"
|
||||
app:layout_constraintLeft_toRightOf="@id/list_item_title"
|
||||
app:layout_constraintTop_toTopOf="@id/list_item_title" />
|
||||
|
||||
<!--自动驾驶应用-->
|
||||
<LinearLayout
|
||||
android:id="@+id/auto_layout"
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
android:layout_height="@dimen/dp_140"
|
||||
android:layout_marginStart="@dimen/dp_856"
|
||||
android:layout_marginTop="@dimen/dp_200"
|
||||
android:src="@drawable/check_wrong"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user