From 741f436b703ad77567f64966f600aa96a752c6ce Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Thu, 11 Feb 2021 08:23:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=BD=AC=E5=8F=91=E8=A7=84?= =?UTF-8?q?=E5=88=99=E7=95=8C=E9=9D=A2=E4=BC=98=E5=8C=96(=E8=81=94?= =?UTF-8?q?=E5=8A=A8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../idormy/sms/forwarder/RuleActivity.java | 34 +++++++++++-- .../idormy/sms/forwarder/model/RuleModel.java | 2 +- .../activity_alter_dialog_setview_rule.xml | 50 ++++++++++++------- 3 files changed, 65 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/com/idormy/sms/forwarder/RuleActivity.java b/app/src/main/java/com/idormy/sms/forwarder/RuleActivity.java index c455eaf5..db1c5c27 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/RuleActivity.java +++ b/app/src/main/java/com/idormy/sms/forwarder/RuleActivity.java @@ -9,6 +9,7 @@ import android.view.View; import android.widget.AdapterView; import android.widget.Button; import android.widget.EditText; +import android.widget.LinearLayout; import android.widget.ListView; import android.widget.RadioGroup; import android.widget.TextView; @@ -60,7 +61,6 @@ public class RuleActivity extends AppCompatActivity { } }); - } // 初始化数据 @@ -78,7 +78,35 @@ public class RuleActivity extends AppCompatActivity { final View view1 = View.inflate(RuleActivity.this, R.layout.activity_alter_dialog_setview_rule, null); final RadioGroup radioGroupRuleFiled = (RadioGroup) view1.findViewById(R.id.radioGroupRuleFiled); - if (ruleModel != null) radioGroupRuleFiled.check(ruleModel.getRuleFiledCheckId()); + final LinearLayout matchTypeLayout = (LinearLayout) view1.findViewById(R.id.matchTypeLayout); + final LinearLayout matchValueLayout = (LinearLayout) view1.findViewById(R.id.matchValueLayout); + if (ruleModel != null) { + int id = ruleModel.getRuleFiledCheckId(); + radioGroupRuleFiled.check(id); + if (id != 0) { + matchTypeLayout.setVisibility(View.GONE); + matchValueLayout.setVisibility(View.GONE); + } else { + matchTypeLayout.setVisibility(View.VISIBLE); + matchValueLayout.setVisibility(View.VISIBLE); + } + } + radioGroupRuleFiled.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + //Toast.makeText(RuleActivity.this, "Checked:" + checkedId, Toast.LENGTH_LONG).show(); + switch (checkedId) { + case R.id.btnTranspondAll: + matchTypeLayout.setVisibility(View.GONE); + matchValueLayout.setVisibility(View.GONE); + break; + default: + matchTypeLayout.setVisibility(View.VISIBLE); + matchValueLayout.setVisibility(View.VISIBLE); + break; + } + } + }); final RadioGroup radioGroupRuleCheck = (RadioGroup) view1.findViewById(R.id.radioGroupRuleCheck); if (ruleModel != null) radioGroupRuleCheck.check(ruleModel.getRuleCheckCheckId()); @@ -95,7 +123,7 @@ public class RuleActivity extends AppCompatActivity { btSetRuleSender.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - Toast.makeText(RuleActivity.this, "selectSender", Toast.LENGTH_LONG).show(); + //Toast.makeText(RuleActivity.this, "selectSender", Toast.LENGTH_LONG).show(); selectSender(ruleSenderTv); } }); 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 7825f1d6..6887d6b8 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 @@ -18,7 +18,7 @@ public class RuleModel { public static final Map CHECK_MAP = new HashMap(); static { - FILED_MAP.put("transpond_all", "转发全部"); + FILED_MAP.put("transpond_all", "全部"); FILED_MAP.put("phone_num", "手机号"); FILED_MAP.put("msg_content", "内容"); } diff --git a/app/src/main/res/layout/activity_alter_dialog_setview_rule.xml b/app/src/main/res/layout/activity_alter_dialog_setview_rule.xml index 6cd0f981..2a8dc9f0 100644 --- a/app/src/main/res/layout/activity_alter_dialog_setview_rule.xml +++ b/app/src/main/res/layout/activity_alter_dialog_setview_rule.xml @@ -7,14 +7,14 @@ - + android:text="设置匹配的字段" /> + android:text="全部" /> + android:layout_marginLeft="10dp" + android:orientation="vertical" + android:visibility="gone"> - + android:layout_marginLeft="10dp" + android:orientation="vertical" + android:visibility="gone"> - + android:text="设置发送方" /> + - @@ -161,8 +179,6 @@ android:layout_weight="1" android:text="@string/del" /> - - \ No newline at end of file