规则展示优化

This commit is contained in:
pppscn 2021-03-18 17:03:51 +08:00
parent 0f645e2dd8
commit 89bc6d048f
3 changed files with 14 additions and 15 deletions

View File

@ -30,7 +30,7 @@ public class RuleModel {
public static final Map<String, String> SIM_SLOT_MAP = new HashMap<String, String>();
static {
FILED_MAP.put("transpond_all", "转发全部");
FILED_MAP.put("transpond_all", "全部转发");
FILED_MAP.put("phone_num", "手机号");
FILED_MAP.put("msg_content", "内容");
FILED_MAP.put("multi_match", "多重匹配");
@ -62,11 +62,10 @@ public class RuleModel {
public static String getRuleMatch(String filed, String check, String value, String simSlot) {
String SimStr = SIM_SLOT_MAP.get(simSlot) + "";
switch (filed) {
case FILED_TRANSPOND_ALL:
return SimStr + "全部转发到 ";
default:
return SimStr + "" + FILED_MAP.get(filed) + " " + CHECK_MAP.get(check) + " " + value + " 转发到 ";
if (filed == null || filed.equals(FILED_TRANSPOND_ALL)) {
return SimStr + "全部 转发到 ";
} else {
return SimStr + "" + FILED_MAP.get(filed) + " " + CHECK_MAP.get(check) + " " + value + " 转发到 ";
}
}
@ -194,11 +193,10 @@ public class RuleModel {
public String getRuleMatch() {
String SimStr = SIM_SLOT_MAP.get(simSlot) + "";
switch (filed) {
case FILED_TRANSPOND_ALL:
return SimStr + "全部转发到 ";
default:
return SimStr + "" + FILED_MAP.get(filed) + " " + CHECK_MAP.get(check) + " " + value + " 转发到 ";
if (filed == null || filed.equals(FILED_TRANSPOND_ALL)) {
return SimStr + "全部 转发到 ";
} else {
return SimStr + "" + FILED_MAP.get(filed) + " " + CHECK_MAP.get(check) + " " + value + " 转发到 ";
}
}

View File

@ -165,13 +165,14 @@ public class LogUtil {
Integer senderType = cursor.getInt(
cursor.getColumnIndexOrThrow(SenderTable.SenderEntry.COLUMN_NAME_TYPE));
String rule = RuleModel.getRuleMatch(ruleFiled, ruleCheck, ruleValue, ruleSimSlot) + senderName.trim();
String rule = RuleModel.getRuleMatch(ruleFiled, ruleCheck, ruleValue, ruleSimSlot);
if (senderName != null) rule += senderName.trim();
int senderImageId = SenderModel.getImageId(senderType);
LogVo logVo = new LogVo(itemid, itemfrom, content, simInfo, time, rule, senderImageId);
LogVos.add(logVo);
} catch (Exception e) {
Log.i(TAG, "getLog e:" + e.getMessage());
Log.e(TAG, "getLog e:" + e.getMessage());
}
}

View File

@ -15,12 +15,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp" />
android:layout_marginLeft="5dp" />
<TextView
android:id="@+id/rule_sender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp" />
android:layout_marginLeft="5dp" />
</LinearLayout>