Skip to content

Commit fdacdbc

Browse files
committed
点返回键直接销毁主界面 而不是回到桌面
1 parent 3722737 commit fdacdbc

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

app/src/main/java/com/github/jing332/tts_server_android/MainActivity.kt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ class MainActivity : AppCompatActivity() {
7979
}
8080
})
8181

82-
8382
/*注册广播*/
8483
myReceiver = MyReceiver()
8584
val intentFilter = IntentFilter(TtsIntentService.ACTION_SEND)
@@ -105,18 +104,6 @@ class MainActivity : AppCompatActivity() {
105104
MyTools.checkUpdate(this)
106105
}
107106

108-
/*点击返回键返回桌面而不是退出程序*/
109-
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
110-
if (keyCode == KeyEvent.KEYCODE_BACK) {
111-
val home = Intent(Intent.ACTION_MAIN)
112-
home.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
113-
home.addCategory(Intent.CATEGORY_HOME)
114-
startActivity(home)
115-
return true
116-
}
117-
return super.onKeyDown(keyCode, event)
118-
}
119-
120107
/*右上角更多菜单*/
121108
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
122109
val inflation: MenuInflater = menuInflater

app/src/main/java/com/github/jing332/tts_server_android/TtsIntentService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class TtsIntentService(name: String = "TtsIntentService") : IntentService(name)
126126
Log.d("LogCallback", s)
127127
sendLog(s)
128128
}
129-
/*启动动Go服务并阻塞等待,直到关闭*/
129+
/*启动Go服务并阻塞等待,直到关闭*/
130130
Tts_server_lib.runServer(port.toLong(), cb)
131131
sendClosedMsg()
132132
}

0 commit comments

Comments
 (0)