新增:监听其他APP通知信息的规则配置

pull/67/head
pppscn 3 years ago
parent 5703c7d637
commit c950ad6c59

@ -116,7 +116,7 @@ void cmdExecute(String cmd) {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
@ -129,9 +129,9 @@ dependencies {
implementation "com.alibaba:fastjson:1.2.78"
//SDK
// implementation 'com.umeng.umsdk:common:9.4.4'//
// implementation 'com.umeng.umsdk:asms:1.4.1'//
// implementation 'com.umeng.umsdk:apm:1.4.2' // SDKcrash
implementation 'com.umeng.umsdk:common:9.4.4'//
implementation 'com.umeng.umsdk:asms:1.4.1'//
//implementation 'com.umeng.umsdk:apm:1.4.2' // SDKcrash
//XUpdate
implementation 'com.github.xuexiangjys:XUpdate:2.1.0'
@ -152,7 +152,4 @@ dependencies {
//AndroidAsync
implementation 'com.koushikdutta.async:androidasync:3.1.0'
//Bind Android views and callbacks to fields and methods.
//implementation 'com.jakewharton:butterknife-gradle-plugin:10.2.3'
//annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3'
}

@ -106,7 +106,7 @@
</intent-filter>
</receiver>
<receiver
android:name=".receiver.SmsForwarderBroadcastReceiver"
android:name=".receiver.SmsBroadcastReceiver"
android:permission="android.permission.BROADCAST_SMS"
tools:ignore="IntentFilterExportedReceiver">
<intent-filter android:priority="2147483647">

@ -16,6 +16,8 @@ import com.idormy.sms.forwarder.utils.Define;
import com.idormy.sms.forwarder.utils.PhoneUtils;
import com.idormy.sms.forwarder.utils.SettingUtil;
import com.smailnet.emailkit.EmailKit;
import com.umeng.analytics.MobclickAgent;
import com.umeng.commonsdk.UMConfigure;
import java.util.ArrayList;
import java.util.List;
@ -75,11 +77,11 @@ public class MyApplication extends Application {
super.onCreate();
//初始化组件化基础库, 所有友盟业务SDK都必须调用此初始化接口。
//建议在宿主App的Application.onCreate函数中调用基础组件库初始化函数。
//UMConfigure.init(this, "60254fc7425ec25f10f4293e", getChannelName(this), UMConfigure.DEVICE_TYPE_PHONE, "");
UMConfigure.init(this, "60254fc7425ec25f10f4293e", getChannelName(this), UMConfigure.DEVICE_TYPE_PHONE, "");
// 选用LEGACY_AUTO页面采集模式
//MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.LEGACY_MANUAL);
MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.LEGACY_MANUAL);
//pro close log
//UMConfigure.setLogEnabled(true);
UMConfigure.setLogEnabled(true);
Intent intent = new Intent(this, FrontService.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {

@ -29,6 +29,7 @@ import com.idormy.sms.forwarder.sender.SendUtil;
import com.idormy.sms.forwarder.sender.SenderUtil;
import com.idormy.sms.forwarder.utils.RuleUtil;
import com.idormy.sms.forwarder.utils.SettingUtil;
import com.umeng.analytics.MobclickAgent;
import java.util.ArrayList;
import java.util.Date;
@ -134,6 +135,28 @@ public class RuleActivity extends AppCompatActivity {
}
}
private int getDialogView(String currentType) {
switch (currentType) {
case "call":
return R.layout.alert_dialog_setview_rule_call;
case "app":
return R.layout.alert_dialog_setview_rule_app;
default:
return R.layout.alert_dialog_setview_rule;
}
}
private int getDialogTitle(String currentType) {
switch (currentType) {
case "call":
return R.string.setrule_call;
case "app":
return R.string.setrule_app;
default:
return R.string.setrule;
}
}
// 初始化数据
private void initRules() {
ruleModels = RuleUtil.getRule(null, null, currentType);
@ -145,7 +168,7 @@ public class RuleActivity extends AppCompatActivity {
private void setRule(final RuleModel ruleModel) {
final AlertDialog.Builder alertDialog71 = new AlertDialog.Builder(RuleActivity.this);
final View view1 = View.inflate(RuleActivity.this, R.layout.alert_dialog_setview_rule, null);
final View view1 = View.inflate(RuleActivity.this, getDialogView(currentType), null);
final RadioGroup radioGroupRuleFiled = view1.findViewById(R.id.radioGroupRuleFiled);
if (ruleModel != null) radioGroupRuleFiled.check(ruleModel.getRuleFiledCheckId());
@ -202,13 +225,16 @@ public class RuleActivity extends AppCompatActivity {
Button buttonRuleDel = view1.findViewById(R.id.buttonRuleDel);
Button buttonRuleTest = view1.findViewById(R.id.buttonRuleTest);
alertDialog71
.setTitle(R.string.setrule)
//.setIcon(R.drawable.ic_sms_forwarder)
.setTitle(getDialogTitle(currentType))
.setView(view1)
.create();
final AlertDialog show = alertDialog71.show();
buttonRuleOk.setOnClickListener(view -> {
Object senderId = ruleSenderTv.getTag();
if (senderId == null) {
Toast.makeText(RuleActivity.this, R.string.new_sender_first, Toast.LENGTH_LONG).show();
return;
}
int radioGroupRuleCheckId = Math.max(radioGroupRuleCheck.getCheckedRadioButtonId(), radioGroupRuleCheck2.getCheckedRadioButtonId());
Log.d(TAG, radioGroupRuleCheck.getCheckedRadioButtonId() + " " + radioGroupRuleCheck2.getCheckedRadioButtonId() + " " + radioGroupRuleCheckId);
if (ruleModel == null) {
@ -220,9 +246,7 @@ public class RuleActivity extends AppCompatActivity {
newRuleModel.setValue(editTextRuleValue.getText().toString());
newRuleModel.setSwitchSmsTemplate(switchSmsTemplate.isChecked());
newRuleModel.setSmsTemplate(textSmsTemplate.getText().toString());
if (senderId != null) {
newRuleModel.setSenderId(Long.valueOf(senderId.toString()));
}
newRuleModel.setSenderId(Long.valueOf(senderId.toString()));
RuleUtil.addRule(newRuleModel);
initRules();
adapter.add(ruleModels);
@ -233,9 +257,7 @@ public class RuleActivity extends AppCompatActivity {
ruleModel.setValue(editTextRuleValue.getText().toString());
ruleModel.setSwitchSmsTemplate(switchSmsTemplate.isChecked());
ruleModel.setSmsTemplate(textSmsTemplate.getText().toString());
if (senderId != null) {
ruleModel.setSenderId(Long.valueOf(senderId.toString()));
}
ruleModel.setSenderId(Long.valueOf(senderId.toString()));
RuleUtil.updateRule(ruleModel);
initRules();
adapter.update(ruleModels);
@ -257,26 +279,27 @@ public class RuleActivity extends AppCompatActivity {
Object senderId = ruleSenderTv.getTag();
if (senderId == null) {
Toast.makeText(RuleActivity.this, R.string.new_sender_first, Toast.LENGTH_LONG).show();
return;
}
int radioGroupRuleCheckId = Math.max(radioGroupRuleCheck.getCheckedRadioButtonId(), radioGroupRuleCheck2.getCheckedRadioButtonId());
if (ruleModel == null) {
RuleModel newRuleModel = new RuleModel();
newRuleModel.setFiled(RuleModel.getRuleFiledFromCheckId(radioGroupRuleFiled.getCheckedRadioButtonId()));
newRuleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheckId));
newRuleModel.setSimSlot(RuleModel.getRuleSimSlotFromCheckId(radioGroupSimSlot.getCheckedRadioButtonId()));
newRuleModel.setValue(editTextRuleValue.getText().toString());
newRuleModel.setSenderId(Long.valueOf(senderId.toString()));
testRule(newRuleModel, Long.valueOf(senderId.toString()));
} else {
int radioGroupRuleCheckId = Math.max(radioGroupRuleCheck.getCheckedRadioButtonId(), radioGroupRuleCheck2.getCheckedRadioButtonId());
if (ruleModel == null) {
RuleModel newRuleModel = new RuleModel();
newRuleModel.setFiled(RuleModel.getRuleFiledFromCheckId(radioGroupRuleFiled.getCheckedRadioButtonId()));
newRuleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheckId));
newRuleModel.setSimSlot(RuleModel.getRuleSimSlotFromCheckId(radioGroupSimSlot.getCheckedRadioButtonId()));
newRuleModel.setValue(editTextRuleValue.getText().toString());
newRuleModel.setSenderId(Long.valueOf(senderId.toString()));
testRule(newRuleModel, Long.valueOf(senderId.toString()));
} else {
ruleModel.setFiled(RuleModel.getRuleFiledFromCheckId(radioGroupRuleFiled.getCheckedRadioButtonId()));
ruleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheckId));
ruleModel.setSimSlot(RuleModel.getRuleSimSlotFromCheckId(radioGroupSimSlot.getCheckedRadioButtonId()));
ruleModel.setValue(editTextRuleValue.getText().toString());
ruleModel.setSenderId(Long.valueOf(senderId.toString()));
ruleModel.setFiled(RuleModel.getRuleFiledFromCheckId(radioGroupRuleFiled.getCheckedRadioButtonId()));
ruleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheckId));
ruleModel.setSimSlot(RuleModel.getRuleSimSlotFromCheckId(radioGroupSimSlot.getCheckedRadioButtonId()));
ruleModel.setValue(editTextRuleValue.getText().toString());
ruleModel.setSenderId(Long.valueOf(senderId.toString()));
testRule(ruleModel, Long.valueOf(senderId.toString()));
}
testRule(ruleModel, Long.valueOf(senderId.toString()));
}
});
@ -306,6 +329,20 @@ public class RuleActivity extends AppCompatActivity {
textSmsTemplate.append("{{短信内容}}");
});
Button buttonInsertSenderApp = view1.findViewById(R.id.bt_insert_sender_app);
buttonInsertSenderApp.setOnClickListener(view -> {
textSmsTemplate.setFocusable(true);
textSmsTemplate.requestFocus();
textSmsTemplate.append("{{APP包名}}");
});
Button buttonInsertContentApp = view1.findViewById(R.id.bt_insert_content_app);
buttonInsertContentApp.setOnClickListener(view -> {
textSmsTemplate.setFocusable(true);
textSmsTemplate.requestFocus();
textSmsTemplate.append("{{通知内容}}");
});
Button buttonInsertExtra = view1.findViewById(R.id.bt_insert_extra);
buttonInsertExtra.setOnClickListener(view -> {
textSmsTemplate.setFocusable(true);
@ -474,13 +511,13 @@ public class RuleActivity extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
//MobclickAgent.onResume(this);
MobclickAgent.onResume(this);
}
@Override
protected void onPause() {
super.onPause();
//MobclickAgent.onPause(this);
MobclickAgent.onPause(this);
}
}

@ -54,6 +54,7 @@ import com.idormy.sms.forwarder.sender.SenderSmsMsg;
import com.idormy.sms.forwarder.sender.SenderTelegramMsg;
import com.idormy.sms.forwarder.sender.SenderUtil;
import com.idormy.sms.forwarder.sender.SenderWebNotifyMsg;
import com.umeng.analytics.MobclickAgent;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -1188,13 +1189,13 @@ public class SenderActivity extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
//MobclickAgent.onResume(this);
MobclickAgent.onResume(this);
}
@Override
protected void onPause() {
super.onPause();
//MobclickAgent.onPause(this);
MobclickAgent.onPause(this);
}
}

@ -22,7 +22,9 @@ import lombok.Data;
public class RuleModel {
public static final String FILED_TRANSPOND_ALL = "transpond_all";
public static final String FILED_PHONE_NUM = "phone_num";
public static final String FILED_PACKAGE_NAME = "package_name";
public static final String FILED_MSG_CONTENT = "msg_content";
public static final String FILED_INFORM_CONTENT = "inform_content";
public static final String FILED_MULTI_MATCH = "multi_match";
public static final Map<String, String> FILED_MAP = new HashMap<>();
public static final String CHECK_IS = "is";
@ -50,6 +52,8 @@ public class RuleModel {
FILED_MAP.put("phone_num", "手机号");
FILED_MAP.put("msg_content", "内容");
FILED_MAP.put("multi_match", "多重匹配");
FILED_MAP.put("package_name", "APP包名");
FILED_MAP.put("inform_content", "通知内容");
}
static {
@ -96,6 +100,10 @@ public class RuleModel {
return FILED_MSG_CONTENT;
case R.id.btnPhone:
return FILED_PHONE_NUM;
case R.id.btnPackageName:
return FILED_PACKAGE_NAME;
case R.id.btnInformContent:
return FILED_INFORM_CONTENT;
case R.id.btnMultiMatch:
return FILED_MULTI_MATCH;
default:
@ -228,7 +236,7 @@ public class RuleModel {
}
public String getRuleMatch() {
String SimStr = SIM_SLOT_MAP.get(simSlot) + "卡 ";
String SimStr = "app".equals(type) ? "" : SIM_SLOT_MAP.get(simSlot) + "卡 ";
if (filed == null || filed.equals(FILED_TRANSPOND_ALL)) {
return SimStr + "全部 转发到 ";
} else {
@ -246,6 +254,10 @@ public class RuleModel {
return R.id.btnContent;
case FILED_PHONE_NUM:
return R.id.btnPhone;
case FILED_PACKAGE_NAME:
return R.id.btnPackageName;
case FILED_INFORM_CONTENT:
return R.id.btnInformContent;
case FILED_MULTI_MATCH:
return R.id.btnMultiMatch;
default:

@ -45,8 +45,8 @@ public class SmsVo implements Serializable {
}
}
return customSmsTemplate.replace("{{来源号码}}", mobile)
.replace("{{短信内容}}", content)
return customSmsTemplate.replace("{{来源号码}}", mobile).replace("{{APP包名}}", mobile)
.replace("{{短信内容}}", content).replace("{{通知内容}}", content)
.replace("{{卡槽信息}}", simInfo)
.replace("{{接收时间}}", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date))
.replace("{{设备名称}}", deviceMark)

@ -19,13 +19,13 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
public class SmsForwarderBroadcastReceiver extends BroadcastReceiver {
public class SmsBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String receiveAction = intent.getAction();
String TAG = "SmsForwarderBroadcastReceiver";
String TAG = "SmsBroadcastReceiver";
Log.d(TAG, "onReceive intent " + receiveAction);
if ("android.provider.Telephony.SMS_RECEIVED".equals(receiveAction)) {
try {

@ -17,7 +17,9 @@ class RuleLine {
public static final String CONJUNCTION_AND = "并且";
public static final String CONJUNCTION_OR = "或者";
public static final String FILED_PHONE_NUM = "手机号";
public static final String FILED_PACKAGE_NAME = "APP包名";
public static final String FILED_MSG_CONTENT = "短信内容";
public static final String FILED_INFORM_CONTENT = "通知内容";
public static final String SURE_YES = "是";
public static final String SURE_NOT = "不是";
public static final String CHECK_EQUALS = "相等";
@ -43,6 +45,8 @@ class RuleLine {
static {
FILED_LIST.add("手机号");
FILED_LIST.add("短信内容");
FILED_LIST.add("APP包名");
FILED_LIST.add("通知内容");
}
static {
@ -269,9 +273,11 @@ class RuleLine {
//先检查规则是否命中
switch (this.field) {
case FILED_PHONE_NUM:
case FILED_PACKAGE_NAME:
mixChecked = checkValue(msg.getMobile());
break;
case FILED_MSG_CONTENT:
case FILED_INFORM_CONTENT:
mixChecked = checkValue(msg.getContent());
break;
default:

@ -80,7 +80,6 @@ public class RuleLineUtils {
* Rule
*
*/
public static boolean checkRuleTree(SmsVo msg, RuleLine currentRuleLine) throws Exception {
//该节点是否命中
boolean currentAll = currentRuleLine.checkMsg(msg);
@ -126,7 +125,6 @@ public class RuleLineUtils {
*
*
*/
public static RuleLine generateRuleTree(String line, int lineNum, RuleLine parentRuleLine) throws Exception {
String[] words = line.split(" ");

@ -82,6 +82,18 @@
style="@style/rg_rb_style"
android:text="@string/sms_content" />
<RadioButton
android:id="@+id/btnPackageName"
style="@style/rg_rb_style"
android:text="@string/package_name"
android:visibility="gone" />
<RadioButton
android:id="@+id/btnInformContent"
style="@style/rg_rb_style"
android:text="@string/inform_content"
android:visibility="gone" />
<RadioButton
android:id="@+id/btnMultiMatch"
style="@style/rg_rb_style"
@ -334,6 +346,31 @@
android:text="@string/insert_extra"
tools:ignore="ButtonStyle,NestedWeights" />
<Button
android:id="@+id/bt_insert_sender_app"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="@string/insert_sender_app"
tools:ignore="ButtonStyle,NestedWeights"
android:visibility="gone" />
<Button
android:id="@+id/bt_insert_content_app"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="@string/insert_content_app"
tools:ignore="ButtonStyle,NestedWeights"
android:visibility="gone" />
<Button
android:id="@+id/bt_insert_time"
android:layout_width="match_parent"

@ -0,0 +1,440 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="@string/match_sim_slot"
android:textStyle="bold" />
<RadioGroup
android:id="@+id/radioGroupSimSlot"
style="@style/rg_style"
android:orientation="horizontal">
<RadioButton
android:id="@+id/btnSimSlotAll"
style="@style/rg_rb_style"
android:checked="true"
android:text="@string/all" />
<RadioButton
android:id="@+id/btnSimSlot1"
style="@style/rg_rb_style"
android:text="@string/sim1" />
<RadioButton
android:id="@+id/btnSimSlot2"
style="@style/rg_rb_style"
android:text="@string/sim2" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="@string/match_field"
android:textStyle="bold" />
<RadioGroup
android:id="@+id/radioGroupRuleFiled"
style="@style/rg_style"
android:orientation="horizontal">
<RadioButton
android:id="@+id/btnTranspondAll"
style="@style/rg_rb_style"
android:checked="true"
android:text="@string/all" />
<RadioButton
android:id="@+id/btnPhone"
style="@style/rg_rb_style"
android:text="@string/phone_number"
android:visibility="gone" />
<RadioButton
android:id="@+id/btnContent"
style="@style/rg_rb_style"
android:text="@string/sms_content"
android:visibility="gone" />
<RadioButton
android:id="@+id/btnPackageName"
style="@style/rg_rb_style"
android:text="@string/package_name" />
<RadioButton
android:id="@+id/btnInformContent"
style="@style/rg_rb_style"
android:text="@string/inform_content" />
<RadioButton
android:id="@+id/btnMultiMatch"
style="@style/rg_rb_style"
android:text="@string/multiple_matches" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:id="@+id/matchTypeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="@string/match_type"
android:textStyle="bold" />
<RadioGroup
android:id="@+id/radioGroupRuleCheck"
style="@style/rg_style"
android:orientation="horizontal">
<RadioButton
android:id="@+id/btnIs"
style="@style/rg_rb_style"
android:text="@string/btn_is" />
<RadioButton
android:id="@+id/btnContain"
style="@style/rg_rb_style"
android:text="@string/btn_contain" />
<RadioButton
android:id="@+id/btnNotContain"
style="@style/rg_rb_style"
android:text="@string/btn_not_contain" />
</RadioGroup>
<RadioGroup
android:id="@+id/radioGroupRuleCheck2"
style="@style/rg_style"
android:orientation="horizontal">
<RadioButton
android:id="@+id/btnStartWith"
style="@style/rg_rb_style"
android:text="@string/btn_start_with" />
<RadioButton
android:id="@+id/btnEndWith"
style="@style/rg_rb_style"
android:text="@string/btn_end_with" />
<RadioButton
android:id="@+id/btnRegex"
style="@style/rg_rb_style"
android:text="@string/btn_regex" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:id="@+id/matchValueLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="@string/match_value"
android:textStyle="bold" />
<EditText
android:id="@+id/editTextRuleValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:autofillHints=""
android:ems="14"
android:inputType="textMultiLine"
android:gravity="start|top"
android:minLines="1"
android:text=""
tools:ignore="LabelFor" />
<TextView
android:id="@+id/tv_mu_rule_tips"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:text="@string/mu_rule_tips2" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/select_sender"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/btSetRuleSender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="0dp"
android:minHeight="0dp"
android:text="@string/select" />
<TextView
android:id="@+id/ruleSenderTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="5dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="@string/enable_custom_templates"
android:textStyle="bold" />
<Switch
android:id="@+id/switch_sms_template"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:gravity="end"
android:textSize="18sp"
tools:ignore="UseSwitchCompatOrMaterialXml" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_sms_template"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="5dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/custom_templates"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="@string/custom_templates_tips"
android:textSize="11sp" />
</LinearLayout>
<EditText
android:id="@+id/text_sms_template"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints=""
android:inputType="textMultiLine"
android:gravity="start|top"
android:minLines="1"
android:text=""
tools:ignore="LabelFor" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/bt_insert_sender"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="@string/insert_sender"
tools:ignore="ButtonStyle,NestedWeights"
android:visibility="gone" />
<Button
android:id="@+id/bt_insert_content"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="@string/insert_content"
tools:ignore="ButtonStyle,NestedWeights"
android:visibility="gone" />
<Button
android:id="@+id/bt_insert_extra"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="@string/insert_extra"
tools:ignore="ButtonStyle,NestedWeights"
android:visibility="gone" />
<Button
android:id="@+id/bt_insert_sender_app"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="@string/insert_sender_app"
tools:ignore="ButtonStyle,NestedWeights" />
<Button
android:id="@+id/bt_insert_content_app"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="@string/insert_content_app"
tools:ignore="ButtonStyle,NestedWeights" />
<Button
android:id="@+id/bt_insert_time"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="@string/insert_time"
tools:ignore="ButtonStyle,NestedWeights" />
<Button
android:id="@+id/bt_insert_device_name"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="@string/insert_device_name"
tools:ignore="ButtonStyle,NestedWeights" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:orientation="horizontal">
<Button
android:id="@+id/buttonRuleTest"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_weight="1"
android:text="@string/test"
tools:ignore="ButtonStyle,NestedWeights" />
<Button
android:id="@+id/buttonRuleDel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_weight="1"
android:text="@string/del"
tools:ignore="ButtonStyle,NestedWeights" />
<Button
android:id="@+id/buttonRuleOk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/ok"
tools:ignore="ButtonStyle,NestedWeights" />
</LinearLayout>
</LinearLayout>
</ScrollView>

@ -0,0 +1,442 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="@string/match_sim_slot"
android:textStyle="bold" />
<RadioGroup
android:id="@+id/radioGroupSimSlot"
style="@style/rg_style"
android:orientation="horizontal">
<RadioButton
android:id="@+id/btnSimSlotAll"
style="@style/rg_rb_style"
android:checked="true"
android:text="@string/all" />
<RadioButton
android:id="@+id/btnSimSlot1"
style="@style/rg_rb_style"
android:text="@string/sim1" />
<RadioButton
android:id="@+id/btnSimSlot2"
style="@style/rg_rb_style"
android:text="@string/sim2" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="@string/match_field"
android:textStyle="bold" />
<RadioGroup
android:id="@+id/radioGroupRuleFiled"
style="@style/rg_style"
android:orientation="horizontal">
<RadioButton
android:id="@+id/btnTranspondAll"
style="@style/rg_rb_style"
android:checked="true"
android:text="@string/all" />
<RadioButton
android:id="@+id/btnPhone"
style="@style/rg_rb_style"
android:text="@string/phone_number" />
<RadioButton
android:id="@+id/btnContent"
style="@style/rg_rb_style"
android:text="@string/sms_content"
android:visibility="gone" />
<RadioButton
android:id="@+id/btnPackageName"
style="@style/rg_rb_style"
android:text="@string/package_name"
android:visibility="gone" />
<RadioButton
android:id="@+id/btnInformContent"
style="@style/rg_rb_style"
android:text="@string/inform_content"
android:visibility="gone" />
<RadioButton
android:id="@+id/btnMultiMatch"
style="@style/rg_rb_style"
android:text="@string/multiple_matches"
android:visibility="gone" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:id="@+id/matchTypeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="@string/match_type"
android:textStyle="bold" />
<RadioGroup
android:id="@+id/radioGroupRuleCheck"
style="@style/rg_style"
android:orientation="horizontal">
<RadioButton
android:id="@+id/btnIs"
style="@style/rg_rb_style"
android:text="@string/btn_is" />
<RadioButton
android:id="@+id/btnContain"
style="@style/rg_rb_style"
android:text="@string/btn_contain" />
<RadioButton
android:id="@+id/btnNotContain"
style="@style/rg_rb_style"
android:text="@string/btn_not_contain" />
</RadioGroup>
<RadioGroup
android:id="@+id/radioGroupRuleCheck2"
style="@style/rg_style"
android:orientation="horizontal">
<RadioButton
android:id="@+id/btnStartWith"
style="@style/rg_rb_style"
android:text="@string/btn_start_with" />
<RadioButton
android:id="@+id/btnEndWith"
style="@style/rg_rb_style"
android:text="@string/btn_end_with" />
<RadioButton
android:id="@+id/btnRegex"
style="@style/rg_rb_style"
android:text="@string/btn_regex" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:id="@+id/matchValueLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="@string/match_value"
android:textStyle="bold" />
<EditText
android:id="@+id/editTextRuleValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:autofillHints=""
android:ems="14"
android:inputType="textMultiLine"
android:gravity="start|top"
android:minLines="1"
android:text=""
tools:ignore="LabelFor" />
<TextView
android:id="@+id/tv_mu_rule_tips"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:text="@string/mu_rule_tips" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/select_sender"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/btSetRuleSender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="0dp"
android:minHeight="0dp"
android:text="@string/select" />
<TextView
android:id="@+id/ruleSenderTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="5dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="@string/enable_custom_templates"
android:textStyle="bold" />
<Switch
android:id="@+id/switch_sms_template"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:gravity="end"
android:textSize="18sp"
tools:ignore="UseSwitchCompatOrMaterialXml" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_sms_template"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="5dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/custom_templates"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="@string/custom_templates_tips"
android:textSize="11sp" />
</LinearLayout>
<EditText
android:id="@+id/text_sms_template"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints=""
android:inputType="textMultiLine"
android:gravity="start|top"
android:minLines="1"
android:text=""
tools:ignore="LabelFor" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/bt_insert_sender"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="@string/insert_sender"
tools:ignore="ButtonStyle,NestedWeights" />
<Button
android:id="@+id/bt_insert_content"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="@string/insert_content"
tools:ignore="ButtonStyle,NestedWeights"
android:visibility="gone" />
<Button
android:id="@+id/bt_insert_extra"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="@string/insert_extra"
tools:ignore="ButtonStyle,NestedWeights" />
<Button
android:id="@+id/bt_insert_sender_app"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="@string/insert_sender_app"
tools:ignore="ButtonStyle,NestedWeights"
android:visibility="gone" />
<Button
android:id="@+id/bt_insert_content_app"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="@string/insert_content_app"
tools:ignore="ButtonStyle,NestedWeights"
android:visibility="gone" />
<Button
android:id="@+id/bt_insert_time"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="@string/insert_time"
tools:ignore="ButtonStyle,NestedWeights" />
<Button
android:id="@+id/bt_insert_device_name"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="@string/insert_device_name"
tools:ignore="ButtonStyle,NestedWeights" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:orientation="horizontal">
<Button
android:id="@+id/buttonRuleTest"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_weight="1"
android:text="@string/test"
tools:ignore="ButtonStyle,NestedWeights" />
<Button
android:id="@+id/buttonRuleDel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_weight="1"
android:text="@string/del"
tools:ignore="ButtonStyle,NestedWeights" />
<Button
android:id="@+id/buttonRuleOk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/ok"
tools:ignore="ButtonStyle,NestedWeights" />
</LinearLayout>
</LinearLayout>
</ScrollView>

@ -47,6 +47,8 @@
<string name="reflashing_tips">Refreshing…</string>
<!--RuleActivity-->
<string name="setrule">Fwd Rule Settings</string>
<string name="setrule_call">Fwd Rule Settings of call</string>
<string name="setrule_app">Fwd Rule Settings of app</string>
<string name="delete_rule_title">Delete confirmation</string>
<string name="delete_rule_tips">Are you sure to delete this rule entry?</string>
<string name="delete_rule_toast">The rule entry has deleted.</string>
@ -61,7 +63,9 @@
<string name="match_sim_slot">Sim Slot</string>
<string name="match_field">Field</string>
<string name="phone_number">Phone No.</string>
<string name="package_name">PackageName</string>
<string name="sms_content">SMS</string>
<string name="inform_content">Inform content</string>
<string name="multiple_matches">Multiple</string>
<string name="match_type">Type</string>
<string name="btn_is">Is</string>
@ -129,7 +133,7 @@
<string name="ServerChanSendKey">ServerChan\'s SendKey</string>
<string name="TelegramApiToken">ApiToken or Custom address</string>
<string name="TelegramChatId">ChatId</string>
<string name="WebNotifyMethod">Method</string>
<string name="WebNotifyMethod" formatted="false">Method</string>
<string name="WebNotifyWebServer">WebServer e.g. https://a.b.com/msg?token=xyz</string>
<string name="WebNotifyWebParams">WebParams e.g. payload=%7B%22text%22%3A%22[msg]%22%7D [msg] will be replaced with text message content. \nSupport Json format, for example: {"text":[MSG]}.\n Note: MSG is automatically utF-8 encoded in addition to JSON format</string>
<string name="WebNotifySecret">Secret (If empty, sign is not counted)</string>
@ -154,7 +158,9 @@
<string name="custom_templates">Custom templates</string>
<string name="custom_templates_tips">TipInsert labels as needed;Leave blank to default template</string>
<string name="insert_sender">Phone</string>
<string name="insert_sender_app">PackageName</string>
<string name="insert_content">SMS</string>
<string name="insert_content_app">InformContent</string>
<string name="insert_extra">SIM</string>
<string name="insert_time">Time</string>
<string name="insert_device_name">Device</string>
@ -173,6 +179,7 @@
<string name="sim1" tools:ignore="Typos">SIM1</string>
<string name="sim2" tools:ignore="Typos">SIM2</string>
<string name="mu_rule_tips">多重匹配规则示例:\n \n 并且 是 手机号 相等 10086\n 或者 是 手机号 相等 10011\n 并且 是 短信内容 包含 欠费\n \n 以上规则表示收到短信并且手机号是10086 或者 手机号是10010并且 短信内容 包含 欠费 时转发短信\n 注意:每行开始的空格代表层级,太过复杂的多重规则可能导致内存占用很大!</string>
<string name="mu_rule_tips2">多重匹配规则示例:\n \n 并且 是 包名 相等 com.tencent.mm\n 或者 是 包名 相等 com.tencent.mm\n 并且 是 通知内容 包含 欠费\n \n 以上规则表示收到APP通知并且包名是com.tencent.mm 或者 包名是com.tencent.mm并且 通知内容 包含 欠费 时转发通知\n 注意:每行开始的空格代表层级,太过复杂的多重规则可能导致内存占用很大!</string>
<string name="post">POST</string>
<string name="get">GET</string>
<!--CloneActivity-->

@ -46,11 +46,13 @@
<string name="release_tips">松开可以刷新!</string>
<string name="reflashing_tips">正在刷新…</string>
<!--RuleActivity-->
<string name="setrule">设置转发规则</string>
<string name="setrule">设置短信转发规则</string>
<string name="setrule_call">设置来电转发规则</string>
<string name="setrule_app">设置APP通知转发规则</string>
<string name="delete_rule_title">规则删除确认</string>
<string name="delete_rule_tips">确定删除该条规则?</string>
<string name="delete_rule_toast">该条规则已经删除!</string>
<string name="new_sender_first">先创建发送通道再选择</string>
<string name="new_sender_first">选择发送通道(若无,请先添加)</string>
<string name="add_sender_first">请先去设置发送通道页面添加</string>
<string name="select_sender">选择发送通道</string>
<string name="rule_tester">规则测试</string>
@ -61,7 +63,9 @@
<string name="match_sim_slot">设置匹配的卡槽</string>
<string name="match_field">设置匹配的字段</string>
<string name="phone_number">手机号</string>
<string name="package_name">APP包名</string>
<string name="sms_content">短信内容</string>
<string name="inform_content">通知内容</string>
<string name="multiple_matches">多重匹配</string>
<string name="match_type">设置匹配的模式</string>
<string name="btn_is"></string>
@ -129,7 +133,7 @@
<string name="ServerChanSendKey">设置Server酱·Turbo版的SendKey</string>
<string name="TelegramApiToken">设置Telegram机器人的ApiToken 或 自定义地址</string>
<string name="TelegramChatId">设置被通知人(或群组)的ChatId</string>
<string name="WebNotifyMethod">请求方式</string>
<string name="WebNotifyMethod" formatted="false">请求方式</string>
<string name="WebNotifyWebServer">设置WebServer例如https://a.b.com/msg?token=xyz</string>
<string name="WebNotifyWebParams">设置WebParams例如payload=%7B%22text%22%3A%22[msg]%22%7D [msg]将被替换成短信内容。\n支持Json格式例如{"text":[msg]}。\n注意除JSON格式外msg会自动进行UTF-8编码</string>
<string name="WebNotifySecret">设置Secret:置空则不计算sign</string>
@ -154,7 +158,9 @@
<string name="custom_templates">转发信息模版</string>
<string name="custom_templates_tips">Tip按需插入内容标签留空使用默认模版</string>
<string name="insert_sender">来源号码</string>
<string name="insert_sender_app">APP包名</string>
<string name="insert_content">短信内容</string>
<string name="insert_content_app">通知内容</string>
<string name="insert_extra">卡槽信息</string>
<string name="insert_time">接收时间</string>
<string name="insert_device_name">设备名称</string>
@ -173,6 +179,7 @@
<string name="sim1" tools:ignore="Typos">SIM1</string>
<string name="sim2" tools:ignore="Typos">SIM2</string>
<string name="mu_rule_tips">多重匹配规则示例:\n \n 并且 是 手机号 相等 10086\n 或者 是 手机号 相等 10011\n 并且 是 短信内容 包含 欠费\n \n 以上规则表示收到短信并且手机号是10086 或者 手机号是10010并且 短信内容 包含 欠费 时转发短信\n 注意:每行开始的空格代表层级,太过复杂的多重规则可能导致内存占用很大!</string>
<string name="mu_rule_tips2">多重匹配规则示例:\n \n 并且 是 APP包名 相等 com.tencent.mm\n 或者 是 APP包名 相等 com.tencent.mm\n 并且 是 通知内容 包含 欠费\n \n 以上规则表示收到APP通知并且APP包名是com.tencent.mm 或者 APP包名是com.tencent.mm并且 通知内容 包含 欠费 时转发通知\n 注意:每行开始的空格代表层级,太过复杂的多重规则可能导致内存占用很大!</string>
<string name="post">POST</string>
<string name="get">GET</string>
<string name="local_ip">本机IP</string>

Loading…
Cancel
Save