From aa160355c3d2992e9455abe61145d59eb45f3e48 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sun, 23 Feb 2020 19:48:34 +0100 Subject: [PATCH] Added 'Export logs' button to bug report page --- .../antennapod/activity/BugReportActivity.java | 14 ++++++++++++++ app/src/main/res/layout/bug_report.xml | 6 ++++++ core/src/main/res/values/strings.xml | 1 + 3 files changed, 21 insertions(+) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/BugReportActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/BugReportActivity.java index 01413bb79..48264bb26 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/BugReportActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/BugReportActivity.java @@ -52,5 +52,19 @@ public class BugReportActivity extends AppCompatActivity { clipboard.setPrimaryClip(clip); Snackbar.make(findViewById(android.R.id.content), R.string.copied_to_clipboard, Snackbar.LENGTH_SHORT).show(); }); + + findViewById(R.id.btn_export_logcat).setOnClickListener(v -> { + try { + File filename = new File(UserPreferences.getDataFolder(null), "full-logs.txt"); + filename.createNewFile(); + String cmd = "logcat -d -f " + filename.getAbsolutePath(); + Runtime.getRuntime().exec(cmd); + Snackbar.make(findViewById(android.R.id.content), + filename.getAbsolutePath(), Snackbar.LENGTH_SHORT).show(); + } catch (IOException e) { + e.printStackTrace(); + Snackbar.make(findViewById(android.R.id.content), e.getMessage(), Snackbar.LENGTH_LONG).show(); + } + }); } } diff --git a/app/src/main/res/layout/bug_report.xml b/app/src/main/res/layout/bug_report.xml index e97e85265..1cc9bc9d8 100644 --- a/app/src/main/res/layout/bug_report.xml +++ b/app/src/main/res/layout/bug_report.xml @@ -16,6 +16,12 @@ android:layout_width="match_parent" android:layout_height="wrap_content"/> +