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