From 70439b2ae0e80807064d419f812b220f549f04ea Mon Sep 17 00:00:00 2001 From: Ishan09811 <156402647+Ishan09811@users.noreply.github.com> Date: Fri, 8 Mar 2024 21:58:02 +0530 Subject: [PATCH] add functions for share log option --- .../pandroid/app/main/SettingsFragment.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/main/SettingsFragment.java b/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/main/SettingsFragment.java index fe35bad06..61dffc7f7 100644 --- a/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/main/SettingsFragment.java +++ b/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/main/SettingsFragment.java @@ -21,6 +21,20 @@ public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable S setItemClick("input", (item) -> PreferenceActivity.launch(requireContext(), InputPreferences.class)); setItemClick("general", (item)-> PreferenceActivity.launch(requireContext(), GeneralPreferences.class)); setItemClick("advanced", (item)-> PreferenceActivity.launch(requireContext(), AdvancedPreferences.class)); + setItemClick("share_log", (item)-> { + // Share Log File + shareLogFile(); + }); + } + + private void shareLogFile() { + // Share the log file + String filePath = "/storage/emulated/0/Android/media/com.panda3ds.pandroid/logs/current.txt"; + Uri uri = Uri.parse("file://" + filePath); + Intent intent = new Intent(Intent.ACTION_SEND); + intent.setType("text/plain"); + intent.putExtra(Intent.EXTRA_STREAM, uri); + startActivity(Intent.createChooser(intent, "Share Log File")); } private String getVersionName() {