Merge pull request #3886 from ByteHamster/export-logcat
Added 'Export logs' button to bug report page
This commit is contained in:
commit
b80bb03d27
|
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -490,6 +490,7 @@
|
|||
<string name="visit_user_forum">Visit user forum</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>
|
||||
|
|
Loading…
Reference in New Issue