|
|
@ -374,49 +374,49 @@ public class RuleActivity extends AppCompatActivity {
|
|
|
|
buttonInsertSender.setOnClickListener(view -> {
|
|
|
|
buttonInsertSender.setOnClickListener(view -> {
|
|
|
|
textSmsTemplate.setFocusable(true);
|
|
|
|
textSmsTemplate.setFocusable(true);
|
|
|
|
textSmsTemplate.requestFocus();
|
|
|
|
textSmsTemplate.requestFocus();
|
|
|
|
textSmsTemplate.append("{{来源号码}}");
|
|
|
|
insertOrReplaceText2Cursor(textSmsTemplate, "{{来源号码}}");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Button buttonInsertContent = view1.findViewById(R.id.bt_insert_content);
|
|
|
|
Button buttonInsertContent = view1.findViewById(R.id.bt_insert_content);
|
|
|
|
buttonInsertContent.setOnClickListener(view -> {
|
|
|
|
buttonInsertContent.setOnClickListener(view -> {
|
|
|
|
textSmsTemplate.setFocusable(true);
|
|
|
|
textSmsTemplate.setFocusable(true);
|
|
|
|
textSmsTemplate.requestFocus();
|
|
|
|
textSmsTemplate.requestFocus();
|
|
|
|
textSmsTemplate.append("{{短信内容}}");
|
|
|
|
insertOrReplaceText2Cursor(textSmsTemplate, "{{短信内容}}");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Button buttonInsertSenderApp = view1.findViewById(R.id.bt_insert_sender_app);
|
|
|
|
Button buttonInsertSenderApp = view1.findViewById(R.id.bt_insert_sender_app);
|
|
|
|
buttonInsertSenderApp.setOnClickListener(view -> {
|
|
|
|
buttonInsertSenderApp.setOnClickListener(view -> {
|
|
|
|
textSmsTemplate.setFocusable(true);
|
|
|
|
textSmsTemplate.setFocusable(true);
|
|
|
|
textSmsTemplate.requestFocus();
|
|
|
|
textSmsTemplate.requestFocus();
|
|
|
|
textSmsTemplate.append("{{APP包名}}");
|
|
|
|
insertOrReplaceText2Cursor(textSmsTemplate, "{{APP包名}}");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Button buttonInsertContentApp = view1.findViewById(R.id.bt_insert_content_app);
|
|
|
|
Button buttonInsertContentApp = view1.findViewById(R.id.bt_insert_content_app);
|
|
|
|
buttonInsertContentApp.setOnClickListener(view -> {
|
|
|
|
buttonInsertContentApp.setOnClickListener(view -> {
|
|
|
|
textSmsTemplate.setFocusable(true);
|
|
|
|
textSmsTemplate.setFocusable(true);
|
|
|
|
textSmsTemplate.requestFocus();
|
|
|
|
textSmsTemplate.requestFocus();
|
|
|
|
textSmsTemplate.append("{{通知内容}}");
|
|
|
|
insertOrReplaceText2Cursor(textSmsTemplate, "{{通知内容}}");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Button buttonInsertExtra = view1.findViewById(R.id.bt_insert_extra);
|
|
|
|
Button buttonInsertExtra = view1.findViewById(R.id.bt_insert_extra);
|
|
|
|
buttonInsertExtra.setOnClickListener(view -> {
|
|
|
|
buttonInsertExtra.setOnClickListener(view -> {
|
|
|
|
textSmsTemplate.setFocusable(true);
|
|
|
|
textSmsTemplate.setFocusable(true);
|
|
|
|
textSmsTemplate.requestFocus();
|
|
|
|
textSmsTemplate.requestFocus();
|
|
|
|
textSmsTemplate.append("{{卡槽信息}}");
|
|
|
|
insertOrReplaceText2Cursor(textSmsTemplate, "{{卡槽信息}}");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Button buttonInsertTime = view1.findViewById(R.id.bt_insert_time);
|
|
|
|
Button buttonInsertTime = view1.findViewById(R.id.bt_insert_time);
|
|
|
|
buttonInsertTime.setOnClickListener(view -> {
|
|
|
|
buttonInsertTime.setOnClickListener(view -> {
|
|
|
|
textSmsTemplate.setFocusable(true);
|
|
|
|
textSmsTemplate.setFocusable(true);
|
|
|
|
textSmsTemplate.requestFocus();
|
|
|
|
textSmsTemplate.requestFocus();
|
|
|
|
textSmsTemplate.append("{{接收时间}}");
|
|
|
|
insertOrReplaceText2Cursor(textSmsTemplate, "{{接收时间}}");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Button buttonInsertDeviceName = view1.findViewById(R.id.bt_insert_device_name);
|
|
|
|
Button buttonInsertDeviceName = view1.findViewById(R.id.bt_insert_device_name);
|
|
|
|
buttonInsertDeviceName.setOnClickListener(view -> {
|
|
|
|
buttonInsertDeviceName.setOnClickListener(view -> {
|
|
|
|
textSmsTemplate.setFocusable(true);
|
|
|
|
textSmsTemplate.setFocusable(true);
|
|
|
|
textSmsTemplate.requestFocus();
|
|
|
|
textSmsTemplate.requestFocus();
|
|
|
|
textSmsTemplate.append("{{设备名称}}");
|
|
|
|
insertOrReplaceText2Cursor(textSmsTemplate, "{{设备名称}}");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//正则替换
|
|
|
|
//正则替换
|
|
|
@ -433,6 +433,12 @@ public class RuleActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void insertOrReplaceText2Cursor(EditText editText, String str) {
|
|
|
|
|
|
|
|
int start = Math.max(editText.getSelectionStart(), 0);
|
|
|
|
|
|
|
|
int end = Math.max(editText.getSelectionEnd(), 0);
|
|
|
|
|
|
|
|
editText.getText().replace(Math.min(start, end), Math.max(start, end), str, 0, str.length());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//当更新选择的字段的时候,更新之下各个选项的状态
|
|
|
|
//当更新选择的字段的时候,更新之下各个选项的状态
|
|
|
|
// 如果设置了转发全部,禁用选择模式和匹配值输入
|
|
|
|
// 如果设置了转发全部,禁用选择模式和匹配值输入
|
|
|
|
// 如果设置了多重规则,选择模式置为是
|
|
|
|
// 如果设置了多重规则,选择模式置为是
|
|
|
|