Add GCAuth multilingual
This commit is contained in:
parent
ebbb5a8c13
commit
0e09d2c589
@ -84,7 +84,7 @@ class MainHook : IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||
"minor-api-os.hoyoverse.com",
|
||||
"log-upload-os.hoyoverse.com"
|
||||
)
|
||||
|
||||
|
||||
private var socketFactory: SSLSocketFactory
|
||||
private var verifier: DefaultHostnameVerifier
|
||||
|
||||
@ -159,6 +159,7 @@ class MainHook : IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||
setMessage(moduleRes.getString(R.string.Tips2))
|
||||
setCancelable(false)
|
||||
setView(ScrollView(context).apply {
|
||||
setPadding(25, 0, 25, 0)
|
||||
addView(LinearLayout(activity).apply {
|
||||
orientation = LinearLayout.VERTICAL
|
||||
addView(EditText(activity).apply {
|
||||
@ -329,10 +330,12 @@ class MainHook : IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||
layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1f)
|
||||
setTextColor(Color.BLUE)
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_SP, 18f)
|
||||
text = "Tools"
|
||||
text = moduleRes.getString(R.string.Tools)
|
||||
})
|
||||
addView(TextView(activity).apply {
|
||||
layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)
|
||||
layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT).also {
|
||||
it.setMargins(0, 0, 20, 0)
|
||||
}
|
||||
setTextColor(Color.BLUE)
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_SP, 18f)
|
||||
text = "X"
|
||||
@ -351,7 +354,7 @@ class MainHook : IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||
layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)
|
||||
addView(TextView(activity).apply {
|
||||
setTextColor(Color.BLUE)
|
||||
text = "(Check server stats)"
|
||||
text = moduleRes.getString(R.string.CheckServerStatus)
|
||||
setOnClickListener {
|
||||
Thread() {
|
||||
try {
|
||||
@ -377,17 +380,17 @@ class MainHook : IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||
response.append(line)
|
||||
}
|
||||
runOnMainThread {
|
||||
text = if (response.toString() == "me.exzork.gcauth.handler.GCAuthAuthenticationHandler") "Server stats: GcAuth" else "Server stats: GcAuth not install"
|
||||
text = if (response.toString() == "me.exzork.gcauth.handler.GCAuthAuthenticationHandler") moduleRes.getString(R.string.ServerStatus) + "GcAuth" else moduleRes.getString(R.string.ServerStatus) + "GcAuth" + moduleRes.getString(R.string.NotInstall)
|
||||
}
|
||||
} else {
|
||||
runOnMainThread {
|
||||
text = "Server stats: Get server stats error. "
|
||||
text = moduleRes.getString(R.string.ServerStatus) + moduleRes.getString(R.string.GetServerStatusError)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: Throwable) {
|
||||
runOnMainThread {
|
||||
text = "Server stats: Get server stats error. $e"
|
||||
text = moduleRes.getString(R.string.ServerStatus) + moduleRes.getString(R.string.GetServerStatusError) + e
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
@ -397,7 +400,7 @@ class MainHook : IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||
addView(LinearLayout(activity).apply {
|
||||
layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)
|
||||
addView(Switch(activity).apply {
|
||||
text = "Input"
|
||||
text = moduleRes.getString(R.string.InputSwitch)
|
||||
setOnCheckedChangeListener { _, b ->
|
||||
if (b) {
|
||||
val params = mainView.layoutParams as WindowManager.LayoutParams
|
||||
@ -415,7 +418,7 @@ class MainHook : IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||
layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)
|
||||
addView(TextView(activity).apply {
|
||||
setTextColor(Color.BLUE)
|
||||
text = "User:"
|
||||
text = moduleRes.getString(R.string.User)
|
||||
})
|
||||
addView(EditText(activity).apply {
|
||||
userEdit = this
|
||||
@ -428,7 +431,7 @@ class MainHook : IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||
layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)
|
||||
addView(TextView(activity).apply {
|
||||
setTextColor(Color.BLUE)
|
||||
text = "Password:"
|
||||
text = moduleRes.getString(R.string.Password)
|
||||
})
|
||||
addView(EditText(activity).apply {
|
||||
passEdit = this
|
||||
@ -441,7 +444,7 @@ class MainHook : IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||
addView(LinearLayout(activity).apply {
|
||||
layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)
|
||||
addView(Button(activity).apply {
|
||||
text = "Login"
|
||||
text = moduleRes.getString(R.string.Login)
|
||||
layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)
|
||||
setOnClickListener {
|
||||
Thread() {
|
||||
@ -482,7 +485,7 @@ class MainHook : IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||
if (json.optBoolean("success", false)) {
|
||||
val token = json.optString("jwt", "")
|
||||
runOnMainThread {
|
||||
Toast.makeText(activity, "Login success. copy:\n${token}", Toast.LENGTH_LONG).show()
|
||||
Toast.makeText(activity, "${moduleRes.getString(R.string.LoginSuccess)}\n${token}", Toast.LENGTH_LONG).show()
|
||||
(activity.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager).text = token
|
||||
sp.edit().run {
|
||||
putString("user", userEdit.text.toString())
|
||||
@ -492,14 +495,14 @@ class MainHook : IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||
}
|
||||
} else {
|
||||
runOnMainThread {
|
||||
Toast.makeText(activity, "Login failed, ${json.optString("message", "")}", Toast.LENGTH_LONG).show()
|
||||
Toast.makeText(activity, moduleRes.getString(R.string.LoginFailed) + json.optString("message", ""), Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: Throwable) {
|
||||
runOnMainThread {
|
||||
Toast.makeText(activity, "Login error, $e", Toast.LENGTH_LONG).show()
|
||||
Toast.makeText(activity, moduleRes.getString(R.string.LoginError) + e, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
|
@ -15,4 +15,16 @@
|
||||
<string name="ExitGames">退出游戏</string>
|
||||
<string name="Settings">设置</string>
|
||||
<string name="KeepSSL">跳过SSL证书检查(不稳定)(需重启)</string>
|
||||
<string name="CheckServerStatus">(点击检查服务器状态)</string>
|
||||
<string name="ServerStatus">"服务器状态: "</string>
|
||||
<string name="NotInstall">未安装</string>
|
||||
<string name="GetServerStatusError">获取服务器状态错误.</string>
|
||||
<string name="InputSwitch">输入开关</string>
|
||||
<string name="Login">登录</string>
|
||||
<string name="Password">密码:</string>
|
||||
<string name="User">用户:</string>
|
||||
<string name="LoginSuccess">登录成功. 复制令牌:</string>
|
||||
<string name="LoginFailed">登录失败.</string>
|
||||
<string name="LoginError">登录错误.</string>
|
||||
<string name="Tools">工具</string>
|
||||
</resources>
|
@ -14,4 +14,16 @@
|
||||
<string name="ExitGames">Exit games</string>
|
||||
<string name="Settings">Settings</string>
|
||||
<string name="KeepSSL">Skip SSL certificate check (instable) (restart required)</string>
|
||||
<string name="CheckServerStatus">(Click Check server status)</string>
|
||||
<string name="ServerStatus">Server status:</string>
|
||||
<string name="NotInstall">not Install</string>
|
||||
<string name="GetServerStatusError">Get server status error.</string>
|
||||
<string name="InputSwitch">Input switch</string>
|
||||
<string name="Login">Login</string>
|
||||
<string name="User">User:</string>
|
||||
<string name="Password">Password:</string>
|
||||
<string name="LoginSuccess">Login success. copy token:</string>
|
||||
<string name="LoginFailed">Login failed.</string>
|
||||
<string name="LoginError">Login error.</string>
|
||||
<string name="Tools">Tools</string>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user