Skip to content

Commit

Permalink
app: refine LogsActivity & LogcatActivity (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
5ec1cff authored Jan 22, 2025
1 parent 9fd394d commit 64a69e6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/github/kr328/clash/LogcatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class LogcatActivity : BaseActivity<LogcatDesign>() {
when (it) {
LogcatDesign.Request.Close -> {
stopService(LogcatService::class.intent)

startActivity(LogsActivity::class.intent)
finish()
}
else -> Unit
Expand Down
6 changes: 1 addition & 5 deletions app/src/main/java/com/github/kr328/clash/LogsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ import kotlinx.coroutines.selects.select
import kotlinx.coroutines.withContext

class LogsActivity : BaseActivity<LogsDesign>() {
override suspend fun main() {
if (LogcatService.running) {
return startActivity(LogcatActivity::class.intent)
}

override suspend fun main() {
val design = LogsDesign(this)

setContentDesign(design)
Expand All @@ -38,7 +35,6 @@ class LogsActivity : BaseActivity<LogsDesign>() {
when (it) {
LogsDesign.Request.StartLogcat -> {
startActivity(LogcatActivity::class.intent)

finish()
}
LogsDesign.Request.DeleteAll -> {
Expand Down
9 changes: 7 additions & 2 deletions app/src/main/java/com/github/kr328/clash/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@ class MainActivity : BaseActivity<MainDesign>() {
startActivity(ProfilesActivity::class.intent)
MainDesign.Request.OpenProviders ->
startActivity(ProvidersActivity::class.intent)
MainDesign.Request.OpenLogs ->
startActivity(LogsActivity::class.intent)
MainDesign.Request.OpenLogs -> {
if (LogcatService.running) {
startActivity(LogcatActivity::class.intent)
} else {
startActivity(LogsActivity::class.intent)
}
}
MainDesign.Request.OpenSettings ->
startActivity(SettingsActivity::class.intent)
MainDesign.Request.OpenHelp ->
Expand Down

0 comments on commit 64a69e6

Please sign in to comment.