mirror of
https://github.com/starr-dusT/yuzu-mainline
synced 2024-03-05 21:12:25 -08:00
android: add option to share log
This commit is contained in:
parent
5435f0be5e
commit
8713c442e9
@ -114,6 +114,11 @@ class HomeSettingsFragment : Fragment() {
|
|||||||
R.string.install_firmware_description,
|
R.string.install_firmware_description,
|
||||||
R.drawable.ic_firmware
|
R.drawable.ic_firmware
|
||||||
) { mainActivity.getFirmware.launch(arrayOf("application/zip")) },
|
) { mainActivity.getFirmware.launch(arrayOf("application/zip")) },
|
||||||
|
HomeSetting(
|
||||||
|
R.string.share_log,
|
||||||
|
R.string.share_log_description,
|
||||||
|
R.drawable.ic_log
|
||||||
|
) { shareLog() },
|
||||||
HomeSetting(
|
HomeSetting(
|
||||||
R.string.about,
|
R.string.about,
|
||||||
R.string.about_description,
|
R.string.about_description,
|
||||||
@ -268,6 +273,24 @@ class HomeSettingsFragment : Fragment() {
|
|||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun shareLog() {
|
||||||
|
val file = DocumentFile.fromSingleUri(
|
||||||
|
mainActivity, DocumentsContract.buildDocumentUri(
|
||||||
|
DocumentProvider.AUTHORITY,
|
||||||
|
"${DocumentProvider.ROOT_ID}/log/yuzu_log.txt"
|
||||||
|
)
|
||||||
|
)!!
|
||||||
|
if (file.exists()) {
|
||||||
|
val intent = Intent(Intent.ACTION_SEND)
|
||||||
|
.setDataAndType(file.uri, FileUtil.TEXT_PLAIN)
|
||||||
|
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||||
|
.putExtra(Intent.EXTRA_STREAM, file.uri)
|
||||||
|
startActivity(Intent.createChooser(intent, "Share log"))
|
||||||
|
} else {
|
||||||
|
Toast.makeText(requireContext(), getText(R.string.share_log_missing), Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setInsets() =
|
private fun setInsets() =
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { view: View, windowInsets: WindowInsetsCompat ->
|
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { view: View, windowInsets: WindowInsetsCompat ->
|
||||||
val barInsets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
|
val barInsets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||||
|
10
src/android/app/src/main/res/drawable/ic_log.xml
Normal file
10
src/android/app/src/main/res/drawable/ic_log.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="960"
|
||||||
|
android:viewportHeight="960"
|
||||||
|
android:tint="?attr/colorControlNormal">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M360,720L600,720Q617,720 628.5,708.5Q640,697 640,680Q640,663 628.5,651.5Q617,640 600,640L360,640Q343,640 331.5,651.5Q320,663 320,680Q320,697 331.5,708.5Q343,720 360,720ZM360,560L600,560Q617,560 628.5,548.5Q640,537 640,520Q640,503 628.5,491.5Q617,480 600,480L360,480Q343,480 331.5,491.5Q320,503 320,520Q320,537 331.5,548.5Q343,560 360,560ZM240,880Q207,880 183.5,856.5Q160,833 160,800L160,160Q160,127 183.5,103.5Q207,80 240,80L527,80Q543,80 557.5,86Q572,92 583,103L777,297Q788,308 794,322.5Q800,337 800,353L800,800Q800,833 776.5,856.5Q753,880 720,880L240,880ZM520,320L520,160L240,160Q240,160 240,160Q240,160 240,160L240,800Q240,800 240,800Q240,800 240,800L720,800Q720,800 720,800Q720,800 720,800L720,360L560,360Q543,360 531.5,348.5Q520,337 520,320ZM240,160L240,160L240,320Q240,337 240,348.5Q240,360 240,360L240,360L240,160L240,320Q240,337 240,348.5Q240,360 240,360L240,360L240,800Q240,800 240,800Q240,800 240,800L240,800Q240,800 240,800Q240,800 240,800L240,160Q240,160 240,160Q240,160 240,160Z"/>
|
||||||
|
</vector>
|
@ -102,6 +102,9 @@
|
|||||||
<string name="firmware_installed_success">Firmware installed successfully</string>
|
<string name="firmware_installed_success">Firmware installed successfully</string>
|
||||||
<string name="firmware_installed_failure">Firmware installation failed.</string>
|
<string name="firmware_installed_failure">Firmware installation failed.</string>
|
||||||
<string name="firmware_installed_failure_description">Check that the ZIP contains a firmware.</string>
|
<string name="firmware_installed_failure_description">Check that the ZIP contains a firmware.</string>
|
||||||
|
<string name="share_log">Share log</string>
|
||||||
|
<string name="share_log_description">Share the log file</string>
|
||||||
|
<string name="share_log_missing">No log file found</string>
|
||||||
|
|
||||||
<!-- About screen strings -->
|
<!-- About screen strings -->
|
||||||
<string name="gaia_is_not_real">Gaia isn\'t real</string>
|
<string name="gaia_is_not_real">Gaia isn\'t real</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user