优化:界面的用户体验

This commit is contained in:
pppscn 2021-11-21 14:29:28 +08:00
parent e0053c4ec8
commit 79ed2da3f1
6 changed files with 184 additions and 35 deletions

View File

@ -43,6 +43,7 @@ public class RuleActivity extends AppCompatActivity {
private List<RuleModel> ruleModels = new ArrayList<>();
private RuleAdapter adapter;
private String currentType = "sms";
private ListView listView;
//消息处理者,创建一个Handler的子类对象,目的是重写Handler的处理消息的方法(handleMessage())
@SuppressLint("HandlerLeak")
@ -78,7 +79,7 @@ public class RuleActivity extends AppCompatActivity {
adapter = new RuleAdapter(RuleActivity.this, R.layout.item_rule, ruleModels);
// 将适配器上的数据传递给listView
ListView listView = findViewById(R.id.list_view_rule);
listView = findViewById(R.id.list_view_rule);
listView.setAdapter(adapter);
// 为ListView注册一个监听器当用户点击了ListView中的任何一个子项时就会回调onItemClick()方法
@ -163,6 +164,11 @@ public class RuleActivity extends AppCompatActivity {
}
public void addRule(View view) {
currentType = (String) view.getTag();
int typeCheckId = getTypeCheckId(currentType);
final RadioGroup radioGroupTypeCheck = findViewById(R.id.radioGroupTypeCheck);
radioGroupTypeCheck.check(typeCheckId);
setRule(null);
}

View File

@ -33,11 +33,21 @@
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_marginTop="5dp"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#aadcdcdc" />
<ListView
android:id="@+id/list_view_app"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="0dp"
android:layout_weight="1" />
<TextView

View File

@ -38,11 +38,21 @@
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_marginTop="5dp"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#aadcdcdc" />
<ListView
android:id="@+id/list_view_rule"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="0dp"
android:layout_weight="1" />
<LinearLayout
@ -58,14 +68,53 @@
android:text="@string/rule_tips"
android:textColor="@color/colorPrimary" />
<Button
<LinearLayout
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_margin="10dp"
android:background="@color/colorPrimary"
android:onClick="addRule"
android:padding="0dp"
android:text="@string/new_forwarding_rule" />
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dip"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:onClick="addRule"
android:tag="sms"
android:padding="0dp"
android:text="@string/new_sms_rule" />
<Button
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:onClick="addRule"
android:tag="call"
android:padding="0dp"
android:text="@string/new_call_rule" />
<Button
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:onClick="addRule"
android:tag="app"
android:padding="0dp"
android:text="@string/new_app_rule" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -277,12 +277,26 @@
android:orientation="horizontal"
android:padding="15dp">
<TextView
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/forward_sms"
android:textStyle="bold"
tools:ignore="RelativeOverlap" />
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/forward_sms"
android:textStyle="bold"
tools:ignore="RelativeOverlap" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="@string/forward_sms_tips"
android:textSize="9sp"
tools:ignore="SmallSp" />
</LinearLayout>
<Switch
android:id="@+id/switch_enable_sms"
@ -304,12 +318,26 @@
android:orientation="horizontal"
android:padding="15dp">
<TextView
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/forward_missed_calls"
android:textStyle="bold"
tools:ignore="RelativeOverlap" />
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/forward_missed_calls"
android:textStyle="bold"
tools:ignore="RelativeOverlap" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="@string/forward_missed_calls_tips"
android:textSize="9sp"
tools:ignore="SmallSp" />
</LinearLayout>
<Switch
android:id="@+id/switch_enable_phone"
@ -331,12 +359,26 @@
android:orientation="horizontal"
android:padding="15dp">
<TextView
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/forward_app_notify"
android:textStyle="bold"
tools:ignore="RelativeOverlap" />
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/forward_app_notify"
android:textStyle="bold"
tools:ignore="RelativeOverlap" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="@string/forward_app_notify_tips"
android:textSize="9sp"
tools:ignore="SmallSp" />
</LinearLayout>
<Switch
android:id="@+id/switch_enable_app_notify"
@ -358,12 +400,26 @@
android:orientation="horizontal"
android:padding="15dp">
<TextView
android:layout_width="0dp"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="@string/enable_exclude_from_recents"
android:textStyle="bold" />
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/enable_exclude_from_recents"
android:textStyle="bold"
tools:ignore="RelativeOverlap" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="@string/enable_exclude_from_recents_tips"
android:textSize="9sp"
tools:ignore="SmallSp" />
</LinearLayout>
<Switch
android:id="@+id/switch_exclude_from_recents"
@ -385,12 +441,26 @@
android:orientation="horizontal"
android:padding="15dp">
<TextView
android:layout_width="0dp"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="@string/enable_custom_templates"
android:textStyle="bold" />
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/enable_custom_templates"
android:textStyle="bold"
tools:ignore="RelativeOverlap" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="@string/enable_custom_templates_tips"
android:textSize="9sp"
tools:ignore="SmallSp" />
</LinearLayout>
<Switch
android:id="@+id/switch_sms_template"

View File

@ -58,7 +58,9 @@
<string name="add_sender_first">Please add a sender first.</string>
<string name="select_sender">Select Sender</string>
<string name="rule_tester">Rule tester:</string>
<string name="new_forwarding_rule">New forwarding rule</string>
<string name="new_sms_rule">New sms forwarding rule</string>
<string name="new_call_rule">New call forwarding rule</string>
<string name="new_app_rule">New app forwarding rule</string>
<string name="test_sim_slot">Test Sim Slot</string>
<string name="test_phone_number">Test Phone Number</string>
<string name="test_msg_content">Test Msg Content</string>
@ -157,10 +159,15 @@
<string name="add_extra">Sim slot info attached</string>
<string name="add_device_name">Device Name attached</string>
<string name="forward_sms">Forward sms</string>
<string name="forward_sms_tips">总开关,请授予读取短信、通知类短信、发送短信等权限,开启后需添加转发规则</string>
<string name="forward_missed_calls">Forward missed calls</string>
<string name="forward_missed_calls_tips">总开关,请授予读取通话记录、联系人等权限,开启后需添加转发规则</string>
<string name="forward_app_notify">Forward app notify</string>
<string name="forward_app_notify_tips">总开关,请先授予通知使用权,开启后需添加转发规则</string>
<string name="enable_custom_templates">Enable custom templates</string>
<string name="enable_custom_templates_tips">全局自定义模版,如果添加转发规则再次定义,则优先取转发规则的</string>
<string name="enable_exclude_from_recents">Exclude from recents</string>
<string name="enable_exclude_from_recents_tips">开启后,有效避免手动误杀进程,利于保活?</string>
<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>

View File

@ -15,7 +15,7 @@
<string name="rule_setting">转发规则</string>
<string name="sender_setting">发送通道</string>
<string name="app_list">应用列表</string>
<string name="log_tips">提示:置顶下拉刷新,长按删除单条记录</string>
<string name="log_tips">提示:置顶下拉刷新,长按删除单条,选项卡切换日志类型</string>
<string name="rule_tips">提示:新建规则点击“添加”,长按删除/点击编辑已有</string>
<string name="sender_tips">提示:新建发送通道点击“添加”,长按删除/点击编辑已有</string>
<string name="app_tips">提示点击复制APP的包名长按则启动并跳转该APP</string>
@ -58,7 +58,9 @@
<string name="add_sender_first">请先去设置发送通道页面添加</string>
<string name="select_sender">选择发送通道</string>
<string name="rule_tester">规则测试</string>
<string name="new_forwarding_rule">添加转发规则</string>
<string name="new_sms_rule">添加短信转发</string>
<string name="new_call_rule">添加来电转发</string>
<string name="new_app_rule">添加应用转发</string>
<string name="test_sim_slot">测试模拟的接收卡槽</string>
<string name="test_phone_number">测试模拟的来源号码</string>
<string name="test_msg_content">测试模拟的短信内容</string>
@ -157,10 +159,15 @@
<string name="add_extra">转发时附加卡槽信息</string>
<string name="add_device_name">转发时附加设备名称</string>
<string name="forward_sms">转发短信广播</string>
<string name="forward_sms_tips">总开关,请授予读取短信、通知类短信、发送短信等权限,开启后需添加转发规则</string>
<string name="forward_missed_calls">转发未接来电</string>
<string name="forward_missed_calls_tips">总开关,请授予读取通话记录、联系人等权限,开启后需添加转发规则</string>
<string name="forward_app_notify">转发APP通知</string>
<string name="forward_app_notify_tips">总开关,请先授予通知使用权,开启后需添加转发规则</string>
<string name="enable_custom_templates">启用自定义模版</string>
<string name="enable_custom_templates_tips">全局自定义模版,如果添加转发规则再次定义,则优先取转发规则的</string>
<string name="enable_exclude_from_recents">不在最近任务列表中显示</string>
<string name="enable_exclude_from_recents_tips">开启后,有效避免手动误杀进程,利于保活?</string>
<string name="custom_templates">转发信息模版</string>
<string name="custom_templates_tips">Tip按需插入内容标签留空使用默认模版</string>
<string name="insert_sender">来源号码</string>