Skip to content

Commit 560cfae

Browse files
committed
优化获取SIM信息(兼容高版本Android) & 自动填写设备备注 & 自动填充卡槽信息到SIM1备注/SIM2备注 & 支持卡槽匹配规则 & 支持正则匹配规则
1 parent 23c51a5 commit 560cfae

File tree

12 files changed

+134
-82
lines changed

12 files changed

+134
-82
lines changed

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,10 @@ Android手机监听短信并根据指定规则转发到其他手机:钉钉机
9191
| ![添加/编辑发送方网页通知](pic/sendersetwebnotify.jpg "添加/编辑发送方网页通知") | ![添加/编辑发送方企业微信群机器人](pic/sendersetqywechat.jpg "添加/编辑发送方企业微信群机器人") |
9292
| 添加/编辑发送方企业微信应用 | 应用设置 |
9393
| ![添加/编辑发送方企业微信应用](pic/sendersetqywxapp.jpg "添加/编辑发送方企业微信应用") | ![应用设置](pic/setting.jpg "应用设置") |
94-
| 关于/在线升级 | 转发短信模板增加卡槽标识 |
95-
| ![在线升级](pic/update.jpg "在线升级") | ![转发短信模板增加卡槽标识](pic/siminfo.jpg "转发短信模板增加卡槽标识") |
96-
94+
| 关于/在线升级 | 支持正则匹配规则 & 支持卡槽匹配规则 |
95+
| ![在线升级](pic/update.jpg "在线升级") | ![支持正则匹配规则 & 支持卡槽匹配规则](pic/regex.jpg "支持正则匹配规则 & 支持卡槽匹配规则") |
96+
| 转发短信模板增加卡槽标识 | |
97+
| ![转发短信模板增加卡槽标识](pic/siminfo.jpg "转发短信模板增加卡槽标识") | |
9798

9899
--------
99100

@@ -114,15 +115,19 @@ Android手机监听短信并根据指定规则转发到其他手机:钉钉机
114115
+ [v1.5.0](app/release/SmsForwarder_release_20210305_1.5.0.apk) 新增转发到企业微信应用消息
115116
+ [v1.5.1](app/release/SmsForwarder_release_20210310_1.5.1.apk) 解决Android 9.xx、10.xx收不到广播问题
116117
+ [v1.5.2](app/release/SmsForwarder_release_20210311_1.5.2.apk) 支持标注卡槽号码(优先使用)、设备信息;自定义转发信息模版
118+
+ [v1.6.0](app/release/SmsForwarder_release_20210312_1.6.0.apk) 优化获取SIM信息(兼容高版本Android) & 自动填写设备备注 & 自动填充卡槽信息到SIM1备注/SIM2备注 & 支持卡槽匹配规则 & 支持正则匹配规则
117119

118120
--------
119121

120122
## 反馈与建议:
121123

124+
+ 提交issues 或 pr
125+
+ 加入交流群
126+
122127
| | |
123128
| ---- | ---- |
124-
| QQ交流群:562854376 | 提交issues 或 pr |
125-
| ![QQ交流群:562854376](pic/qqgroup.jpg "QQ交流群:562854376") | ![QQ交流群:562854376](pic/about.jpg "QQ交流群:562854376") |
129+
| QQ交流群:562854376 | 微信交流群 |
130+
| ![QQ交流群:562854376](pic/qqgroup.jpg "QQ交流群:562854376") | ![微信交流群](pic/wechat.jpg "微信交流群") |
126131

127132

128133
## LICENSE
6.97 MB
Binary file not shown.

app/release/output-metadata.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
{
1111
"type": "SINGLE",
1212
"filters": [],
13-
"versionCode": 15,
14-
"versionName": "1.5.2",
15-
"outputFile": "SmsForwarder_release_20210311_1.5.2.apk"
13+
"versionCode": 16,
14+
"versionName": "1.6.0",
15+
"outputFile": "SmsForwarder_release_20210312_1.6.0.apk"
1616
}
1717
]
1818
}

app/src/main/java/com/idormy/sms/forwarder/RuleActivity.java

Lines changed: 70 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.idormy.sms.forwarder;
22

3+
import android.annotation.SuppressLint;
34
import android.content.DialogInterface;
45
import android.os.Bundle;
56
import android.os.Handler;
@@ -144,7 +145,15 @@ private void setRule(final RuleModel ruleModel) {
144145
if (ruleModel != null) radioGroupRuleFiled.check(ruleModel.getRuleFiledCheckId());
145146

146147
final RadioGroup radioGroupRuleCheck = (RadioGroup) view1.findViewById(R.id.radioGroupRuleCheck);
147-
if (ruleModel != null) radioGroupRuleCheck.check(ruleModel.getRuleCheckCheckId());
148+
final RadioGroup radioGroupRuleCheck2 = (RadioGroup) view1.findViewById(R.id.radioGroupRuleCheck2);
149+
if (ruleModel != null) {
150+
int ruleCheckCheckId = ruleModel.getRuleCheckCheckId();
151+
if (ruleCheckCheckId == R.id.btnIs || ruleCheckCheckId == R.id.btnNotIs || ruleCheckCheckId == R.id.btnContain) {
152+
radioGroupRuleCheck.check(ruleCheckCheckId);
153+
} else {
154+
radioGroupRuleCheck2.check(ruleCheckCheckId);
155+
}
156+
}
148157

149158
final RadioGroup radioGroupSimSlot = (RadioGroup) view1.findViewById(R.id.radioGroupSimSlot);
150159
if (ruleModel != null) radioGroupSimSlot.check(ruleModel.getRuleSimSlotCheckId());
@@ -174,7 +183,7 @@ public void onClick(View view) {
174183
//当更新选择的字段的时候,更新之下各个选项的状态
175184
final LinearLayout matchTypeLayout = (LinearLayout) view1.findViewById(R.id.matchTypeLayout);
176185
final LinearLayout matchValueLayout = (LinearLayout) view1.findViewById(R.id.matchValueLayout);
177-
refreshSelectRadioGroupRuleFiled(radioGroupRuleFiled, radioGroupRuleCheck, editTextRuleValue, tv_mu_rule_tips, matchTypeLayout, matchValueLayout);
186+
refreshSelectRadioGroupRuleFiled(radioGroupRuleFiled, radioGroupRuleCheck, radioGroupRuleCheck2, editTextRuleValue, tv_mu_rule_tips, matchTypeLayout, matchValueLayout);
178187

179188
Button buttonruleok = view1.findViewById(R.id.buttonruleok);
180189
Button buttonruledel = view1.findViewById(R.id.buttonruledel);
@@ -189,10 +198,12 @@ public void onClick(View view) {
189198
@Override
190199
public void onClick(View view) {
191200
Object senderId = ruleSenderTv.getTag();
201+
int radioGroupRuleCheckId = Math.max(radioGroupRuleCheck.getCheckedRadioButtonId(), radioGroupRuleCheck2.getCheckedRadioButtonId());
202+
Log.d(TAG, "XXXX " + radioGroupRuleCheck.getCheckedRadioButtonId() + " " + radioGroupRuleCheck2.getCheckedRadioButtonId() + " " + radioGroupRuleCheckId);
192203
if (ruleModel == null) {
193204
RuleModel newRuleModel = new RuleModel();
194205
newRuleModel.setFiled(RuleModel.getRuleFiledFromCheckId(radioGroupRuleFiled.getCheckedRadioButtonId()));
195-
newRuleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheck.getCheckedRadioButtonId()));
206+
newRuleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheckId));
196207
newRuleModel.setSimSlot(RuleModel.getRuleSimSlotFromCheckId(radioGroupSimSlot.getCheckedRadioButtonId()));
197208
newRuleModel.setValue(editTextRuleValue.getText().toString());
198209
if (senderId != null) {
@@ -203,7 +214,7 @@ public void onClick(View view) {
203214
adapter.add(ruleModels);
204215
} else {
205216
ruleModel.setFiled(RuleModel.getRuleFiledFromCheckId(radioGroupRuleFiled.getCheckedRadioButtonId()));
206-
ruleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheck.getCheckedRadioButtonId()));
217+
ruleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheckId));
207218
ruleModel.setSimSlot(RuleModel.getRuleSimSlotFromCheckId(radioGroupSimSlot.getCheckedRadioButtonId()));
208219
ruleModel.setValue(editTextRuleValue.getText().toString());
209220
if (senderId != null) {
@@ -237,18 +248,19 @@ public void onClick(View view) {
237248
if (senderId == null) {
238249
Toast.makeText(RuleActivity.this, "请先创建选择发送方", Toast.LENGTH_LONG).show();
239250
} else {
251+
int radioGroupRuleCheckId = Math.max(radioGroupRuleCheck.getCheckedRadioButtonId(), radioGroupRuleCheck2.getCheckedRadioButtonId());
240252
if (ruleModel == null) {
241253
RuleModel newRuleModel = new RuleModel();
242254
newRuleModel.setFiled(RuleModel.getRuleFiledFromCheckId(radioGroupRuleFiled.getCheckedRadioButtonId()));
243-
newRuleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheck.getCheckedRadioButtonId()));
255+
newRuleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheckId));
244256
newRuleModel.setSimSlot(RuleModel.getRuleSimSlotFromCheckId(radioGroupSimSlot.getCheckedRadioButtonId()));
245257
newRuleModel.setValue(editTextRuleValue.getText().toString());
246258
newRuleModel.setSenderId(Long.valueOf(senderId.toString()));
247259

248260
testRule(newRuleModel, Long.valueOf(senderId.toString()));
249261
} else {
250262
ruleModel.setFiled(RuleModel.getRuleFiledFromCheckId(radioGroupRuleFiled.getCheckedRadioButtonId()));
251-
ruleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheck.getCheckedRadioButtonId()));
263+
ruleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheckId));
252264
ruleModel.setSimSlot(RuleModel.getRuleSimSlotFromCheckId(radioGroupSimSlot.getCheckedRadioButtonId()));
253265
ruleModel.setValue(editTextRuleValue.getText().toString());
254266
ruleModel.setSenderId(Long.valueOf(senderId.toString()));
@@ -264,18 +276,57 @@ public void onClick(View view) {
264276
//当更新选择的字段的时候,更新之下各个选项的状态
265277
// 如果设置了转发全部,禁用选择模式和匹配值输入
266278
// 如果设置了多重规则,选择模式置为是
267-
private void refreshSelectRadioGroupRuleFiled(RadioGroup radioGroupRuleFiled, final RadioGroup radioGroupRuleCheck, final EditText editTextRuleValue, final TextView tv_mu_rule_tips, final LinearLayout matchTypeLayout, final LinearLayout matchValueLayout) {
268-
refreshSelectRadioGroupRuleFiledAction(radioGroupRuleFiled.getCheckedRadioButtonId(), radioGroupRuleCheck, editTextRuleValue, tv_mu_rule_tips, matchTypeLayout, matchValueLayout);
279+
private void refreshSelectRadioGroupRuleFiled(RadioGroup radioGroupRuleFiled, final RadioGroup radioGroupRuleCheck, final RadioGroup radioGroupRuleCheck2, final EditText editTextRuleValue, final TextView tv_mu_rule_tips, final LinearLayout matchTypeLayout, final LinearLayout matchValueLayout) {
280+
refreshSelectRadioGroupRuleFiledAction(radioGroupRuleFiled.getCheckedRadioButtonId(), radioGroupRuleCheck, radioGroupRuleCheck2, editTextRuleValue, tv_mu_rule_tips, matchTypeLayout, matchValueLayout);
269281

282+
radioGroupRuleCheck.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
283+
@SuppressLint("ResourceType")
284+
@Override
285+
public void onCheckedChanged(RadioGroup group, int checkedId) {
286+
Log.d(TAG, String.valueOf(group));
287+
Log.d(TAG, String.valueOf(checkedId));
288+
if (group != null && checkedId > 0) {
289+
if (group == radioGroupRuleCheck) {
290+
radioGroupRuleCheck2.clearCheck();
291+
} else if (group == radioGroupRuleCheck2) {
292+
radioGroupRuleCheck.clearCheck();
293+
}
294+
group.check(checkedId);
295+
}
296+
}
297+
});
298+
radioGroupRuleCheck2.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
299+
@SuppressLint("ResourceType")
300+
@Override
301+
public void onCheckedChanged(RadioGroup group, int checkedId) {
302+
Log.d(TAG, String.valueOf(group));
303+
Log.d(TAG, String.valueOf(checkedId));
304+
if (group != null && checkedId > 0) {
305+
if (group == radioGroupRuleCheck) {
306+
radioGroupRuleCheck2.clearCheck();
307+
} else if (group == radioGroupRuleCheck2) {
308+
radioGroupRuleCheck.clearCheck();
309+
}
310+
group.check(checkedId);
311+
}
312+
}
313+
});
270314
radioGroupRuleFiled.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
271315
@Override
272316
public void onCheckedChanged(RadioGroup group, int checkedId) {
273-
refreshSelectRadioGroupRuleFiledAction(checkedId, radioGroupRuleCheck, editTextRuleValue, tv_mu_rule_tips, matchTypeLayout, matchValueLayout);
317+
Log.d(TAG, String.valueOf(group));
318+
Log.d(TAG, String.valueOf(checkedId));
319+
if (group == radioGroupRuleCheck) {
320+
radioGroupRuleCheck2.clearCheck();
321+
} else if (group == radioGroupRuleCheck2) {
322+
radioGroupRuleCheck.clearCheck();
323+
}
324+
refreshSelectRadioGroupRuleFiledAction(checkedId, radioGroupRuleCheck, radioGroupRuleCheck2, editTextRuleValue, tv_mu_rule_tips, matchTypeLayout, matchValueLayout);
274325
}
275326
});
276327
}
277328

278-
private void refreshSelectRadioGroupRuleFiledAction(int checkedRuleFiledId, final RadioGroup radioGroupRuleCheck, final EditText editTextRuleValue, final TextView tv_mu_rule_tips, final LinearLayout matchTypeLayout, final LinearLayout matchValueLayout) {
329+
private void refreshSelectRadioGroupRuleFiledAction(int checkedRuleFiledId, final RadioGroup radioGroupRuleCheck, final RadioGroup radioGroupRuleCheck2, final EditText editTextRuleValue, final TextView tv_mu_rule_tips, final LinearLayout matchTypeLayout, final LinearLayout matchValueLayout) {
279330
tv_mu_rule_tips.setVisibility(View.GONE);
280331
matchTypeLayout.setVisibility(View.VISIBLE);
281332
matchValueLayout.setVisibility(View.VISIBLE);
@@ -285,6 +336,9 @@ private void refreshSelectRadioGroupRuleFiledAction(int checkedRuleFiledId, fina
285336
for (int i = 0; i < radioGroupRuleCheck.getChildCount(); i++) {
286337
((RadioButton) radioGroupRuleCheck.getChildAt(i)).setEnabled(false);
287338
}
339+
for (int i = 0; i < radioGroupRuleCheck2.getChildCount(); i++) {
340+
((RadioButton) radioGroupRuleCheck2.getChildAt(i)).setEnabled(false);
341+
}
288342
editTextRuleValue.setEnabled(false);
289343
matchTypeLayout.setVisibility(View.GONE);
290344
matchValueLayout.setVisibility(View.GONE);
@@ -293,6 +347,9 @@ private void refreshSelectRadioGroupRuleFiledAction(int checkedRuleFiledId, fina
293347
for (int i = 0; i < radioGroupRuleCheck.getChildCount(); i++) {
294348
((RadioButton) radioGroupRuleCheck.getChildAt(i)).setEnabled(false);
295349
}
350+
for (int i = 0; i < radioGroupRuleCheck2.getChildCount(); i++) {
351+
((RadioButton) radioGroupRuleCheck2.getChildAt(i)).setEnabled(false);
352+
}
296353
editTextRuleValue.setEnabled(true);
297354
matchTypeLayout.setVisibility(View.GONE);
298355
tv_mu_rule_tips.setVisibility(MyApplication.showHelpTip ? View.VISIBLE : View.GONE);
@@ -301,6 +358,9 @@ private void refreshSelectRadioGroupRuleFiledAction(int checkedRuleFiledId, fina
301358
for (int i = 0; i < radioGroupRuleCheck.getChildCount(); i++) {
302359
((RadioButton) radioGroupRuleCheck.getChildAt(i)).setEnabled(true);
303360
}
361+
for (int i = 0; i < radioGroupRuleCheck2.getChildCount(); i++) {
362+
((RadioButton) radioGroupRuleCheck2.getChildAt(i)).setEnabled(true);
363+
}
304364
editTextRuleValue.setEnabled(true);
305365
break;
306366
}

app/src/main/java/com/idormy/sms/forwarder/model/RuleModel.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public class RuleModel {
4242
CHECK_MAP.put("startwith", "开头是");
4343
CHECK_MAP.put("endwith", "结尾是");
4444
CHECK_MAP.put("notis", "不是");
45+
CHECK_MAP.put("regex", "正则匹配");
4546
}
4647

4748
static {

app/src/main/res/layout/activity_about.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
android:layout_width="0dp"
112112
android:layout_height="wrap_content"
113113
android:layout_weight="1"
114-
android:text="开源地址" />
114+
android:text="更新日志" />
115115

116116
<TextView
117117
android:id="@+id/linkweb"
@@ -120,7 +120,7 @@
120120
android:layout_weight="3"
121121
android:autoLink="web"
122122
android:gravity="right"
123-
android:text="https://github.com/pppscn/SmsForwarder"
123+
android:text="https://github.com/pppscn/SmsForwarder/releases"
124124
android:textSize="14sp" />
125125
</LinearLayout>
126126

0 commit comments

Comments
 (0)