Skip to content

Commit

Permalink
no need to line var
Browse files Browse the repository at this point in the history
  • Loading branch information
SaeedDev94 committed Feb 23, 2024
1 parent 1399840 commit 091e24c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions app/src/main/java/io/github/saeeddev94/xray/LogsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,10 @@ class LogsActivity : AppCompatActivity() {
try {
loggingProcess = ProcessBuilder("logcat", "-v", "raw", "-s", "GoLog,${BuildConfig.APPLICATION_ID}").start()
val reader = BufferedReader(InputStreamReader(loggingProcess!!.inputStream))
var line = ""
val logStringBuilder = StringBuilder()
while (!Thread.currentThread().isInterrupted && reader.readLine().also { line = it } != null) {
logStringBuilder.append(line).append("\n")
val logs = StringBuilder()
while (!Thread.currentThread().isInterrupted && reader.readLine().also { logs.append("$it\n") } != null) {
runOnUiThread {
binding.logsTextView.text = logStringBuilder.toString()
binding.logsTextView.text = logs.toString()
binding.logsScrollView.post {
binding.logsScrollView.fullScroll(ScrollView.FOCUS_DOWN)
}
Expand Down

0 comments on commit 091e24c

Please sign in to comment.