@@ -8,10 +8,10 @@ import android.os.Bundle
8
8
import android.text.Editable
9
9
import android.text.TextWatcher
10
10
import android.util.Log
11
- import android.view.View
12
11
import android.widget.Button
13
12
import android.widget.CheckBox
14
13
import android.widget.CompoundButton
14
+ import androidx.appcompat.app.AlertDialog
15
15
import androidx.appcompat.app.AppCompatActivity
16
16
import com.cyh128.wenku8reader.R
17
17
import com.cyh128.wenku8reader.util.GlobalConfig
@@ -36,6 +36,22 @@ class LoginInputActivity : AppCompatActivity() {
36
36
// 以下两行会导致内存泄漏,待改进
37
37
// CircularProgressIndicatorSpec spec = new CircularProgressIndicatorSpec(this, null, 0, com.google.android.material.R.style.Widget_Material3_CircularProgressIndicator_ExtraSmall);
38
38
// Drawable drawable = IndeterminateDrawable.createCircularDrawable(this, spec);
39
+ findViewById<Button >(R .id.register).setOnClickListener {
40
+ MaterialAlertDialogBuilder (this )
41
+ .setTitle(" 请前往浏览器注册" )
42
+ .setMessage(" 您需要前往浏览器页面注册,注册成功后再将用户名和密码填入输入框中,点击[前往注册]以继续注册" )
43
+ .setCancelable(false )
44
+ .setNegativeButton(" 取消" , null )
45
+ .setPositiveButton(
46
+ " 前往注册"
47
+ ) { _: DialogInterface ? , _: Int ->
48
+ val uri: Uri = Uri .parse(" https://${GlobalConfig .domain} /register.php" ) // 设置跳转的网站
49
+ val intent = Intent (Intent .ACTION_VIEW , uri)
50
+ startActivity(intent)
51
+ }
52
+ .show()
53
+ }
54
+
39
55
signIn = findViewById(R .id.confirm_login)
40
56
signIn.setOnClickListener {
41
57
signIn.isClickable = false
@@ -85,7 +101,7 @@ class LoginInputActivity : AppCompatActivity() {
85
101
MaterialAlertDialogBuilder (this @LoginInputActivity)
86
102
.setCancelable(false ) // 禁止点击其他区域
87
103
.setTitle(" 网络错误" )
88
- .setMessage(" 可能是以下原因造成的:\n\n 1 -> 请检查是否正在连接VPN或代理服务器 \n 2 -> 未连接上网络\n 3 -> 服务器(wenku8.cc)出错,(此网站有时会登不上去)\n\n 请稍后再试" )
104
+ .setMessage(" 可能是以下原因造成的:\n\n 1 -> 请检查网络ip属地是否为中国大陆 \n 2 -> 未连接上网络\n 3 -> 服务器(wenku8.cc)出错,(此网站有时会登不上去)\n 4 -> 尝试切换节点 \n\n 请稍后再试" )
89
105
.setPositiveButton(" 明白" , null )
90
106
.setIcon(R .drawable.warning)
91
107
.show()
@@ -103,6 +119,25 @@ class LoginInputActivity : AppCompatActivity() {
103
119
username = findViewById(R .id.username)
104
120
password = findViewById(R .id.password)
105
121
initTextFieldListener() // 负责清空错误信息
122
+
123
+ findViewById<Button >(R .id.b_a_login_input_domain).setOnClickListener {
124
+ MaterialAlertDialogBuilder (this )
125
+ .setTitle(" 选择节点" )
126
+ .setSingleChoiceItems(
127
+ arrayOf(" www.wenku8.cc" ," www.wenku8.net" ),
128
+ run {
129
+ if (GlobalConfig .domain == " www.wenku8.cc" ) return @run 0
130
+ else return @run 1
131
+ }
132
+ ) { dialog: DialogInterface , which: Int ->
133
+ when (which) {
134
+ 0 -> GlobalConfig .domain = " www.wenku8.cc"
135
+ 1 -> GlobalConfig .domain = " www.wenku8.net"
136
+ }
137
+ dialog.dismiss()
138
+ }
139
+ .show()
140
+ }
106
141
}
107
142
108
143
private fun initTextFieldListener () { // 负责清空错误信息
0 commit comments