This commit is contained in:
arm64v8a 2023-04-14 14:40:16 +09:00
parent 3a41a6dd25
commit a0a51bbf30
2 changed files with 18 additions and 10 deletions

View File

@ -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
@ -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

View File

@ -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() }
}
}