fix(android): 等待中的取消入口落在面板按钮上(连接后表单被隐藏)
真机 V-A1b 实测发现:startConnect() 切到远控面板后,表单上的按钮不可见, 「点取消」没有可点的目标。把底部按钮在 connecting 态显示为「取消」并共享 cancelConnect() 一条路径(两个入口一个语义),成功后复位为「断开」。 APK 重装后 proof step 3/4 通过(连接已取消文案 + 3.9s 回表单)。
This commit is contained in:
parent
bb3cf6b09b
commit
3891c970eb
@ -44,6 +44,7 @@ class MainActivity : Activity(), RemoteSurfaceView.Listener {
|
|||||||
private lateinit var portInput: EditText
|
private lateinit var portInput: EditText
|
||||||
private lateinit var codeInput: EditText
|
private lateinit var codeInput: EditText
|
||||||
private lateinit var connectButton: Button
|
private lateinit var connectButton: Button
|
||||||
|
private lateinit var disconnectButton: Button
|
||||||
private lateinit var connectStatus: TextView
|
private lateinit var connectStatus: TextView
|
||||||
|
|
||||||
@Volatile
|
@Volatile
|
||||||
@ -207,9 +208,11 @@ class MainActivity : Activity(), RemoteSurfaceView.Listener {
|
|||||||
text = "键盘"
|
text = "键盘"
|
||||||
setOnClickListener { showKeyboard() }
|
setOnClickListener { showKeyboard() }
|
||||||
}
|
}
|
||||||
val disconnectButton = Button(this).apply {
|
disconnectButton = Button(this).apply {
|
||||||
text = "断开"
|
text = "断开"
|
||||||
setOnClickListener { disconnect() }
|
// 连接等待期它显示「取消」并走同一个 cancelConnect():两个按钮的
|
||||||
|
// 取消语义必须只有一条路径(V-A1 判据依赖取消后的固定状态)。
|
||||||
|
setOnClickListener { if (connecting) cancelConnect() else disconnect() }
|
||||||
}
|
}
|
||||||
val bar = LinearLayout(this).apply {
|
val bar = LinearLayout(this).apply {
|
||||||
orientation = LinearLayout.HORIZONTAL
|
orientation = LinearLayout.HORIZONTAL
|
||||||
@ -458,6 +461,10 @@ class MainActivity : Activity(), RemoteSurfaceView.Listener {
|
|||||||
connecting = true
|
connecting = true
|
||||||
val gen = ++sessionGeneration
|
val gen = ++sessionGeneration
|
||||||
connectButton.text = "取消"
|
connectButton.text = "取消"
|
||||||
|
// 等待期间界面已切到远控面板,表单上的按钮看不见——收起动作挂在
|
||||||
|
// 面板底部按钮上:连接中它是「取消」(disconnect() 已正确作废在途连接),
|
||||||
|
// 成功后改回「断开」。
|
||||||
|
disconnectButton.text = "取消"
|
||||||
showRemoteState()
|
showRemoteState()
|
||||||
statusView.text = "连接 $host:$port …"
|
statusView.text = "连接 $host:$port …"
|
||||||
thread(name = "connect") {
|
thread(name = "connect") {
|
||||||
@ -486,6 +493,7 @@ class MainActivity : Activity(), RemoteSurfaceView.Listener {
|
|||||||
remoteW = w
|
remoteW = w
|
||||||
remoteH = ht
|
remoteH = ht
|
||||||
connectButton.text = "断开"
|
connectButton.text = "断开"
|
||||||
|
disconnectButton.text = "断开"
|
||||||
// 只有认证成功的会话才值得记住;验证码不落盘(用户裁决)
|
// 只有认证成功的会话才值得记住;验证码不落盘(用户裁决)
|
||||||
getSharedPreferences(PREFS, Context.MODE_PRIVATE)
|
getSharedPreferences(PREFS, Context.MODE_PRIVATE)
|
||||||
.edit()
|
.edit()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user