From 318b11da01ad843ad63d82b4ac87eb1eaa84b9dc Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Wed, 8 Jul 2020 12:32:49 +0800 Subject: View crash reports in Settings -> About -> Crash Reports. --- app/src/main/AndroidManifest.xml | 10 ++++ .../infinityforreddit/Message/ComposeMessage.java | 3 -- .../Settings/CrashReportsFragment.java | 54 ++++++++++++++++++++++ .../Settings/CrashReportsRecyclerViewAdapter.java | 46 ++++++++++++++++++ .../main/res/layout/fragment_acknowledgement.xml | 2 +- app/src/main/res/layout/fragment_crash_reports.xml | 6 +++ app/src/main/res/layout/item_crash_report.xml | 8 ++++ app/src/main/res/values/strings.xml | 4 ++ app/src/main/res/xml/about_preferences.xml | 5 ++ 9 files changed, 134 insertions(+), 4 deletions(-) create mode 100644 app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsFragment.java create mode 100644 app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsRecyclerViewAdapter.java create mode 100644 app/src/main/res/layout/fragment_crash_reports.xml create mode 100644 app/src/main/res/layout/item_crash_report.xml (limited to 'app/src') diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4d30b837..ca502970 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -328,6 +328,16 @@ android:resource="@xml/file_paths" /> + + + + { + private List crashReports; + + public CrashReportsRecyclerViewAdapter(List crashReports) { + this.crashReports = crashReports; + } + + @NonNull + @Override + public CrashReportViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new CrashReportViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_crash_report, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull CrashReportViewHolder holder, int position) { + holder.crashReportTextView.setText(crashReports.get(holder.getAdapterPosition())); + } + + @Override + public int getItemCount() { + return crashReports == null ? 0 : crashReports.size(); + } + + class CrashReportViewHolder extends RecyclerView.ViewHolder { + TextView crashReportTextView; + + public CrashReportViewHolder(@NonNull View itemView) { + super(itemView); + crashReportTextView = (TextView) itemView; + } + } +} diff --git a/app/src/main/res/layout/fragment_acknowledgement.xml b/app/src/main/res/layout/fragment_acknowledgement.xml index b6d17db9..716c69e8 100644 --- a/app/src/main/res/layout/fragment_acknowledgement.xml +++ b/app/src/main/res/layout/fragment_acknowledgement.xml @@ -3,4 +3,4 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/recycler_view_acknowledgement_fragment" - tools:context="ml.docilealligator.infinityforreddit.Settings.AcknowledgementFragment"/> + tools:context="ml.docilealligator.infinityforreddit.Settings.AcknowledgementFragment" /> diff --git a/app/src/main/res/layout/fragment_crash_reports.xml b/app/src/main/res/layout/fragment_crash_reports.xml new file mode 100644 index 00000000..2c768908 --- /dev/null +++ b/app/src/main/res/layout/fragment_crash_reports.xml @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/app/src/main/res/layout/item_crash_report.xml b/app/src/main/res/layout/item_crash_report.xml new file mode 100644 index 00000000..e8b46fd6 --- /dev/null +++ b/app/src/main/res/layout/item_crash_report.xml @@ -0,0 +1,8 @@ + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0f53debb..23c3e314 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -425,6 +425,8 @@ Share Share this app to other people if you enjoy it Infinity For Reddit + Crash Reports + See the error logs and send them to me when you report bugs Version %s Customization Light Theme @@ -828,5 +830,7 @@ Try loading the video on Redgifs %1$s pts + + Hello blank fragment diff --git a/app/src/main/res/xml/about_preferences.xml b/app/src/main/res/xml/about_preferences.xml index a73f9aaa..6561eec3 100644 --- a/app/src/main/res/xml/about_preferences.xml +++ b/app/src/main/res/xml/about_preferences.xml @@ -45,6 +45,11 @@ app:title="@string/settings_share_title" app:summary="@string/settings_share_summary" /> + +