@@ -4,15 +4,18 @@ import android.content.Intent
4
4
import android.os.Bundle
5
5
import android.provider.Settings
6
6
import android.support.v7.app.AppCompatActivity
7
+ import android.util.Log
7
8
import com.orhanobut.hawk.Hawk
8
9
import kotlinx.android.synthetic.main.activity_control.*
9
10
11
+
10
12
/* *
11
13
* 描述:辅助服务控制页
12
14
*
13
15
* @author CoderPig on 2018/04/12 10:50.
14
16
*/
15
17
class ControlActivity : AppCompatActivity () {
18
+
16
19
override fun onCreate (savedInstanceState : Bundle ? ) {
17
20
super .onCreate(savedInstanceState)
18
21
setContentView(R .layout.activity_control)
@@ -24,6 +27,15 @@ class ControlActivity : AppCompatActivity() {
24
27
cb_add_friends.isChecked = Hawk .get(Constant .ADD_FRIENDS ,false )
25
28
cb_friends_square.isChecked = Hawk .get(Constant .FRIEND_SQUARE ,false )
26
29
cb_catch_red_packet.isChecked = Hawk .get(Constant .RED_PACKET ,false )
30
+ val members = Hawk .get(Constant .MEMBER_LIST , mutableListOf<String >())
31
+ if (members.size > 0 ) {
32
+ val sb = StringBuilder ()
33
+ for (member in members) {
34
+ sb.append(member).append(" \n " )
35
+ }
36
+ ed_friends.setText(sb.toString())
37
+ }
38
+
27
39
btn_sure.setOnClickListener({
28
40
Hawk .put(Constant .GROUP_NAME , ed_group_name.text.toString())
29
41
shortToast(" 群聊名称已保存!" )
@@ -33,6 +45,24 @@ class ControlActivity : AppCompatActivity() {
33
45
shortToast(" 群聊名称已清除!" )
34
46
ed_group_name.setText(" " )
35
47
})
48
+
49
+ btn_write.setOnClickListener({
50
+ val memberList = (ed_friends.text.toString()).split(" \n " ).filter{it.trim() != " " }
51
+ Hawk .put(Constant .MEMBER_LIST , memberList)
52
+ Log .e(" Test" ,memberList.toString())
53
+ shortToast(" 数据写入成功!" )
54
+ })
55
+
56
+ btn_reset.setOnClickListener({
57
+ Hawk .put(Constant .MEMBER_LIST , mutableListOf<String >())
58
+ ed_friends.setText(" " )
59
+ shortToast(" 数据重置成功!" )
60
+ })
61
+
62
+ btn_open_wechat.setOnClickListener {
63
+ val intent = packageManager.getLaunchIntentForPackage(" com.tencent.mm" )
64
+ startActivity(intent)
65
+ }
36
66
btn_open_accessbility.setOnClickListener({
37
67
startActivity(Intent (Settings .ACTION_ACCESSIBILITY_SETTINGS ))
38
68
})
0 commit comments