Skip to content

Commit

Permalink
fix gui
Browse files Browse the repository at this point in the history
  • Loading branch information
arm64v8a committed Apr 14, 2023
1 parent 3a41a6d commit a0a51bb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.LinearLayout
import android.widget.ScrollView
import android.widget.Toast
import androidx.activity.result.component1
import androidx.activity.result.component2
Expand Down Expand Up @@ -355,7 +356,10 @@ abstract class ProfileSettingsActivity<T : AbstractBean>(
}
}
}
MaterialAlertDialogBuilder(activity).setView(view).show()
val scrollView = ScrollView(context).apply {
addView(view)
}
MaterialAlertDialogBuilder(activity).setView(scrollView).show()
true
}
else -> false
Expand Down
22 changes: 13 additions & 9 deletions app/src/main/java/moe/matsuri/nb4a/utils/SendLog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,19 @@ object SendLog {

// Get log bytes from neko.log
fun getNekoLog(max: Long): ByteArray {
val file = File(
SagerNet.application.cacheDir,
"neko.log"
)
val len = file.length()
val stream = FileInputStream(file)
if (max in 1 until len) {
stream.skip(len - max) // TODO string?
return try {
val file = File(
SagerNet.application.cacheDir,
"neko.log"
)
val len = file.length()
val stream = FileInputStream(file)
if (max in 1 until len) {
stream.skip(len - max) // TODO string?
}
stream.use { it.readBytes() }
} catch (e: Exception) {
e.stackTraceToString().toByteArray()
}
return stream.use { it.readBytes() }
}
}

0 comments on commit a0a51bb

Please sign in to comment.