diff options
author | ByteHamster <info@bytehamster.com> | 2020-02-23 19:48:34 +0100 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2020-02-23 19:48:34 +0100 |
commit | aa160355c3d2992e9455abe61145d59eb45f3e48 (patch) | |
tree | 7bf73ea59b28e82d792cc71a21adb376291b0622 | |
parent | 930642cb36b262196ac4f56a1e8e9e582cd42ec8 (diff) | |
download | AntennaPod-aa160355c3d2992e9455abe61145d59eb45f3e48.zip |
Added 'Export logs' button to bug report page
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/activity/BugReportActivity.java | 14 | ||||
-rw-r--r-- | app/src/main/res/layout/bug_report.xml | 6 | ||||
-rw-r--r-- | core/src/main/res/values/strings.xml | 1 |
3 files changed, 21 insertions, 0 deletions
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"/> + <Button + android:id="@+id/btn_export_logcat" + android:text="@string/export_logs" + android:layout_width="match_parent" + android:layout_height="wrap_content"/> + <TextView android:layout_marginTop="8dp" android:id="@+id/crash_report_logs" diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 8cb9f7b84..a97ce1339 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -489,6 +489,7 @@ <string name="view_mailing_list">View mailing list</string> <string name="bug_report_title">Report bug</string> <string name="open_bug_tracker">Open bug tracker</string> + <string name="export_logs">Export logs</string> <string name="copy_to_clipboard">Copy to clipboard</string> <string name="copied_to_clipboard">Copied to clipboard</string> <string name="experimental_pref">Experimental</string> |