add share gpu log button
This commit is contained in:
parent
0f5c595908
commit
572810e022
|
|
@ -222,6 +222,14 @@ class HomeSettingsFragment : Fragment() {
|
|||
{ shareLog() }
|
||||
)
|
||||
)
|
||||
add(
|
||||
HomeSetting(
|
||||
R.string.share_gpu_log,
|
||||
R.string.share_gpu_log_description,
|
||||
R.drawable.ic_log,
|
||||
{ shareGpuLog() }
|
||||
)
|
||||
)
|
||||
add(
|
||||
HomeSetting(
|
||||
R.string.open_user_folder,
|
||||
|
|
@ -408,6 +416,40 @@ class HomeSettingsFragment : Fragment() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun shareGpuLog() {
|
||||
val currentLog = DocumentFile.fromSingleUri(
|
||||
mainActivity,
|
||||
DocumentsContract.buildDocumentUri(
|
||||
DocumentProvider.AUTHORITY,
|
||||
"${DocumentProvider.ROOT_ID}/log/eden_gpu.log"
|
||||
)
|
||||
)!!
|
||||
val oldLog = DocumentFile.fromSingleUri(
|
||||
mainActivity,
|
||||
DocumentsContract.buildDocumentUri(
|
||||
DocumentProvider.AUTHORITY,
|
||||
"${DocumentProvider.ROOT_ID}/log/eden_gpu.log.old.txt"
|
||||
)
|
||||
)!!
|
||||
|
||||
val intent = Intent(Intent.ACTION_SEND)
|
||||
.setDataAndType(currentLog.uri, FileUtil.TEXT_PLAIN)
|
||||
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
if (!Log.gameLaunched && oldLog.exists()) {
|
||||
intent.putExtra(Intent.EXTRA_STREAM, oldLog.uri)
|
||||
startActivity(Intent.createChooser(intent, getText(R.string.share_gpu_log)))
|
||||
} else if (currentLog.exists()) {
|
||||
intent.putExtra(Intent.EXTRA_STREAM, currentLog.uri)
|
||||
startActivity(Intent.createChooser(intent, getText(R.string.share_gpu_log)))
|
||||
} else {
|
||||
Toast.makeText(
|
||||
requireContext(),
|
||||
getText(R.string.share_gpu_log_missing),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setInsets() =
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { view, windowInsets ->
|
||||
val barInsets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
|
|
|
|||
|
|
@ -325,6 +325,9 @@
|
|||
<string name="share_log">Share debug logs</string>
|
||||
<string name="share_log_description">Share Eden\'s log file to debug issues</string>
|
||||
<string name="share_log_missing">No log file found</string>
|
||||
<string name="share_gpu_log">Share GPU logs</string>
|
||||
<string name="share_gpu_log_description">Share Eden\'s GPU log file to debug graphics issues</string>
|
||||
<string name="share_gpu_log_missing">No GPU log file found</string>
|
||||
<string name="install_game_content">Install game content</string>
|
||||
<string name="install_game_content_description">Install game updates or DLC</string>
|
||||
<string name="installing_game_content">Installing content…</string>
|
||||
|
|
|
|||
Loading…
Reference in New Issue