From 45b782716a82d54196f5634eb12bda28cc99ff94 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Thu, 18 Mar 2021 17:03:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E5=88=99=E5=B1=95=E7=A4=BA=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../idormy/sms/forwarder/model/RuleModel.java | 20 +++++++++---------- .../idormy/sms/forwarder/utils/LogUtil.java | 5 +++-- app/src/main/res/layout/item_rule.xml | 4 ++-- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/idormy/sms/forwarder/model/RuleModel.java b/app/src/main/java/com/idormy/sms/forwarder/model/RuleModel.java index a0076784..9ab55884 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/model/RuleModel.java +++ b/app/src/main/java/com/idormy/sms/forwarder/model/RuleModel.java @@ -30,7 +30,7 @@ public class RuleModel { public static final Map SIM_SLOT_MAP = new HashMap(); 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 + " 转发到 "; } } diff --git a/app/src/main/java/com/idormy/sms/forwarder/utils/LogUtil.java b/app/src/main/java/com/idormy/sms/forwarder/utils/LogUtil.java index 140c3b38..ac0741cc 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/utils/LogUtil.java +++ b/app/src/main/java/com/idormy/sms/forwarder/utils/LogUtil.java @@ -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()); } } diff --git a/app/src/main/res/layout/item_rule.xml b/app/src/main/res/layout/item_rule.xml index 7f82bfb4..e2a54d24 100644 --- a/app/src/main/res/layout/item_rule.xml +++ b/app/src/main/res/layout/item_rule.xml @@ -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" /> + android:layout_marginLeft="5dp" /> \ No newline at end of file