|
|
@@ -1,11 +1,13 @@ |
|
|
|
package com.huntersun.vkyes.etcopencard.project.ui.activity.after;
|
|
|
|
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.graphics.Typeface;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.view.View;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import android.widget.LinearLayout;
|
|
|
|
import android.widget.ImageView;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
@@ -374,31 +376,71 @@ public class ReleaseVehicleDetailActivity extends AppActivity implements TitleBa |
|
|
|
* 添加黑名单项
|
|
|
|
*/
|
|
|
|
private void addBlacklistItem(LinearLayout container, com.alibaba.fastjson.JSONObject blacklistItem, String type) {
|
|
|
|
// 创建黑名单项布局
|
|
|
|
LinearLayout itemLayout = new LinearLayout(this);
|
|
|
|
itemLayout.setOrientation(LinearLayout.VERTICAL);
|
|
|
|
itemLayout.setOrientation(LinearLayout.HORIZONTAL);
|
|
|
|
itemLayout.setPadding(0, 0, 0, (int) getResources().getDimension(R.dimen.dp_10));
|
|
|
|
itemLayout.setBackground(getResources().getDrawable(R.drawable.shape_white_bg));
|
|
|
|
itemLayout.setPadding((int) getResources().getDimension(R.dimen.dp_15),
|
|
|
|
(int) getResources().getDimension(R.dimen.dp_10),
|
|
|
|
(int) getResources().getDimension(R.dimen.dp_15),
|
|
|
|
(int) getResources().getDimension(R.dimen.dp_10));
|
|
|
|
|
|
|
|
// 设置点击事件
|
|
|
|
itemLayout.setOnClickListener(v -> showBlacklistDetailDialog(blacklistItem, type));
|
|
|
|
|
|
|
|
// 创建左侧信息
|
|
|
|
LinearLayout leftLayout = new LinearLayout(this);
|
|
|
|
leftLayout.setOrientation(LinearLayout.VERTICAL);
|
|
|
|
leftLayout.setLayoutParams(new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1.0f));
|
|
|
|
|
|
|
|
// 卡号/签号
|
|
|
|
TextView idText = new TextView(this);
|
|
|
|
String idLabel = "卡".equals(type) ? "卡号" : "签号";
|
|
|
|
String idValue = "卡".equals(type) ?
|
|
|
|
(blacklistItem.getString("cardId") != null ? blacklistItem.getString("cardId") : "未知") :
|
|
|
|
(blacklistItem.getString("obuId") != null ? blacklistItem.getString("obuId") : "未知");
|
|
|
|
idText.setText(idLabel + ": " + idValue);
|
|
|
|
idText.setTextColor(getResources().getColor(R.color.black));
|
|
|
|
idText.setTextSize(14);
|
|
|
|
idText.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
|
|
|
|
|
|
|
// 黑名单类型
|
|
|
|
TextView typeText = new TextView(this);
|
|
|
|
String typeValue = getBlacklistTypeText(blacklistItem.getString("type"), type);
|
|
|
|
typeText.setText("类型: " + typeValue);
|
|
|
|
typeText.setTextColor(getResources().getColor(R.color.text_gray));
|
|
|
|
typeText.setTextSize(12);
|
|
|
|
typeText.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
|
|
|
|
|
|
|
leftLayout.addView(idText);
|
|
|
|
leftLayout.addView(typeText);
|
|
|
|
|
|
|
|
// 创建右侧箭头
|
|
|
|
ImageView arrowIcon = new ImageView(this);
|
|
|
|
arrowIcon.setImageResource(R.mipmap.ic_next_gray);
|
|
|
|
arrowIcon.setLayoutParams(new LinearLayout.LayoutParams(
|
|
|
|
(int) getResources().getDimension(R.dimen.dp_16),
|
|
|
|
(int) getResources().getDimension(R.dimen.dp_16)));
|
|
|
|
arrowIcon.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
|
|
|
|
|
|
|
|
itemLayout.addView(leftLayout);
|
|
|
|
itemLayout.addView(arrowIcon);
|
|
|
|
|
|
|
|
// 创建黑名单项信息
|
|
|
|
StringBuilder itemInfo = new StringBuilder();
|
|
|
|
itemInfo.append(type).append("ID: ");
|
|
|
|
container.addView(itemLayout);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取黑名单类型文本
|
|
|
|
*/
|
|
|
|
private String getBlacklistTypeText(String type, String blacklistType) {
|
|
|
|
if (type == null) return "未知类型";
|
|
|
|
|
|
|
|
if ("卡".equals(type)) {
|
|
|
|
itemInfo.append(blacklistItem.getString("cardId") != null ? blacklistItem.getString("cardId") : "未知");
|
|
|
|
if ("卡".equals(blacklistType)) {
|
|
|
|
return getCardBlackTypeText(type);
|
|
|
|
} else {
|
|
|
|
itemInfo.append(blacklistItem.getString("obuId") != null ? blacklistItem.getString("obuId") : "未知");
|
|
|
|
return getObuBlackTypeText(type);
|
|
|
|
}
|
|
|
|
|
|
|
|
itemInfo.append("\n原因: ").append(blacklistItem.getString("reason") != null ? blacklistItem.getString("reason") : "未知");
|
|
|
|
itemInfo.append("\n创建时间: ").append(blacklistItem.getString("createTime") != null ? blacklistItem.getString("createTime") : "未知");
|
|
|
|
|
|
|
|
TextView itemText = new TextView(this);
|
|
|
|
itemText.setText(itemInfo.toString());
|
|
|
|
itemText.setTextColor(getResources().getColor(R.color.text_gray));
|
|
|
|
itemText.setTextSize(12);
|
|
|
|
itemText.setLineSpacing(4, 1.2f);
|
|
|
|
|
|
|
|
itemLayout.addView(itemText);
|
|
|
|
container.addView(itemLayout);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -506,6 +548,170 @@ public class ReleaseVehicleDetailActivity extends AppActivity implements TitleBa |
|
|
|
return obuStatus;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取卡黑名单类型文本
|
|
|
|
*/
|
|
|
|
private String getCardBlackTypeText(String type) {
|
|
|
|
if (type == null) return "未知类型";
|
|
|
|
|
|
|
|
// 根据卡黑名单类型枚举获取对应的名称
|
|
|
|
if (EnumBean.CARD_BLACK_TYPE != null) {
|
|
|
|
for (EnumBean enumBean : EnumBean.CARD_BLACK_TYPE) {
|
|
|
|
if (type.equals(enumBean.getKey())) {
|
|
|
|
return enumBean.getValue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 如果找不到对应的描述,返回原始类型码
|
|
|
|
LogUtils.w("解除车牌占用详情", "未找到卡黑名单类型对应的描述: " + type);
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取签黑名单类型文本
|
|
|
|
*/
|
|
|
|
private String getObuBlackTypeText(String type) {
|
|
|
|
if (type == null) return "未知类型";
|
|
|
|
|
|
|
|
// 根据签黑名单类型枚举获取对应的名称
|
|
|
|
if (EnumBean.OBU_BLACK_TYPE != null) {
|
|
|
|
for (EnumBean enumBean : EnumBean.OBU_BLACK_TYPE) {
|
|
|
|
if (type.equals(enumBean.getKey())) {
|
|
|
|
return enumBean.getValue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 如果找不到对应的描述,返回原始类型码
|
|
|
|
LogUtils.w("解除车牌占用详情", "未找到签黑名单类型对应的描述: " + type);
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取来源类型文本
|
|
|
|
*/
|
|
|
|
private String getSourceTypeText(String sourceType) {
|
|
|
|
if (sourceType == null) return "未知来源";
|
|
|
|
|
|
|
|
// 根据来源类型枚举获取对应的名称
|
|
|
|
if (EnumBean.SOURCE_TYPE != null) {
|
|
|
|
for (EnumBean enumBean : EnumBean.SOURCE_TYPE) {
|
|
|
|
if (sourceType.equals(enumBean.getKey())) {
|
|
|
|
return enumBean.getValue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 如果找不到对应的描述,返回原始来源码
|
|
|
|
LogUtils.w("解除车牌占用详情", "未找到来源类型对应的描述: " + sourceType);
|
|
|
|
return sourceType;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 显示黑名单详情弹窗
|
|
|
|
*/
|
|
|
|
private void showBlacklistDetailDialog(com.alibaba.fastjson.JSONObject blacklistItem, String type) {
|
|
|
|
// 创建弹窗布局
|
|
|
|
LinearLayout dialogLayout = new LinearLayout(this);
|
|
|
|
dialogLayout.setOrientation(LinearLayout.VERTICAL);
|
|
|
|
dialogLayout.setBackground(getResources().getDrawable(R.drawable.shape_white_bg));
|
|
|
|
dialogLayout.setPadding((int) getResources().getDimension(R.dimen.dp_20),
|
|
|
|
(int) getResources().getDimension(R.dimen.dp_20),
|
|
|
|
(int) getResources().getDimension(R.dimen.dp_20),
|
|
|
|
(int) getResources().getDimension(R.dimen.dp_20));
|
|
|
|
|
|
|
|
// 标题
|
|
|
|
TextView titleText = new TextView(this);
|
|
|
|
titleText.setText("下黑详情");
|
|
|
|
titleText.setTextColor(getResources().getColor(R.color.black));
|
|
|
|
titleText.setTextSize(18);
|
|
|
|
titleText.setTypeface(Typeface.DEFAULT_BOLD);
|
|
|
|
titleText.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
|
|
|
titleText.setPadding(0, 0, 0, (int) getResources().getDimension(R.dimen.dp_15));
|
|
|
|
|
|
|
|
// 详情内容区域
|
|
|
|
LinearLayout contentLayout = new LinearLayout(this);
|
|
|
|
contentLayout.setOrientation(LinearLayout.VERTICAL);
|
|
|
|
contentLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
|
|
|
|
|
|
|
// 1. 卡号或签号
|
|
|
|
addDetailItem(contentLayout, "卡".equals(type) ? "卡号" : "签号",
|
|
|
|
"卡".equals(type) ? blacklistItem.getString("cardId") : blacklistItem.getString("obuId"));
|
|
|
|
|
|
|
|
// 2. 渠道编号
|
|
|
|
addDetailItem(contentLayout, "渠道编号", blacklistItem.getString("agencyId"));
|
|
|
|
|
|
|
|
// 3. 下黑来源
|
|
|
|
addDetailItem(contentLayout, "下黑来源", getSourceTypeText(blacklistItem.getString("sourceIn")));
|
|
|
|
|
|
|
|
// 4. 下黑原因
|
|
|
|
addDetailItem(contentLayout, "下黑原因", blacklistItem.getString("reason"));
|
|
|
|
|
|
|
|
// 5. 下黑类型
|
|
|
|
addDetailItem(contentLayout, "下黑类型", getBlacklistTypeText(blacklistItem.getString("type"), type));
|
|
|
|
|
|
|
|
// 6. 下黑时间
|
|
|
|
addDetailItem(contentLayout, "下黑时间", blacklistItem.getString("creationTime"));
|
|
|
|
|
|
|
|
// 关闭按钮
|
|
|
|
Button closeButton = new Button(this);
|
|
|
|
closeButton.setText("关闭");
|
|
|
|
closeButton.setTextColor(getResources().getColor(R.color.white));
|
|
|
|
closeButton.setBackgroundColor(getResources().getColor(R.color.text_gray));
|
|
|
|
closeButton.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
|
|
|
|
(int) getResources().getDimension(R.dimen.dp_40)));
|
|
|
|
closeButton.setPadding(0, (int) getResources().getDimension(R.dimen.dp_10), 0, (int) getResources().getDimension(R.dimen.dp_10));
|
|
|
|
closeButton.setOnClickListener(v -> {
|
|
|
|
// 关闭弹窗的逻辑
|
|
|
|
if (blacklistDetailDialog != null && blacklistDetailDialog.isShowing()) {
|
|
|
|
blacklistDetailDialog.dismiss();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
dialogLayout.addView(titleText);
|
|
|
|
dialogLayout.addView(contentLayout);
|
|
|
|
dialogLayout.addView(closeButton);
|
|
|
|
|
|
|
|
// 创建并显示弹窗
|
|
|
|
blacklistDetailDialog = new android.app.AlertDialog.Builder(this)
|
|
|
|
.setView(dialogLayout)
|
|
|
|
.setCancelable(true)
|
|
|
|
.create();
|
|
|
|
|
|
|
|
blacklistDetailDialog.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
private android.app.AlertDialog blacklistDetailDialog;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 添加详情项
|
|
|
|
*/
|
|
|
|
private void addDetailItem(LinearLayout container, String label, String value) {
|
|
|
|
LinearLayout itemLayout = new LinearLayout(this);
|
|
|
|
itemLayout.setOrientation(LinearLayout.HORIZONTAL);
|
|
|
|
itemLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
|
|
|
itemLayout.setPadding(0, 0, 0, (int) getResources().getDimension(R.dimen.dp_8));
|
|
|
|
|
|
|
|
// 标签
|
|
|
|
TextView labelText = new TextView(this);
|
|
|
|
labelText.setText(label + ": ");
|
|
|
|
labelText.setTextColor(getResources().getColor(R.color.black));
|
|
|
|
labelText.setTextSize(14);
|
|
|
|
labelText.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
|
|
|
|
|
|
|
// 值
|
|
|
|
TextView valueText = new TextView(this);
|
|
|
|
valueText.setText(value != null ? value : "未知");
|
|
|
|
valueText.setTextColor(getResources().getColor(R.color.text_gray));
|
|
|
|
valueText.setTextSize(14);
|
|
|
|
valueText.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
|
|
|
|
|
|
|
itemLayout.addView(labelText);
|
|
|
|
itemLayout.addView(valueText);
|
|
|
|
container.addView(itemLayout);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 通过按钮点击
|
|
|
|
*/
|