From 4fb2e3cc20feecc18932473b0a24ccb8391916a1 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Thu, 9 Jul 2020 12:13:45 +0800 Subject: Add updated Crashy. --- app/build.gradle | 4 ++ app/src/main/AndroidManifest.xml | 10 ++++ .../Settings/CrashReportsFragment.java | 54 ++++++++++++++++++++++ .../Settings/CrashReportsRecyclerViewAdapter.java | 46 ++++++++++++++++++ app/src/main/res/values/strings.xml | 2 + app/src/main/res/xml/about_preferences.xml | 5 ++ 6 files changed, 121 insertions(+) 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 diff --git a/app/build.gradle b/app/build.gradle index 76f05962..edf08528 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -87,6 +87,10 @@ dependencies { implementation 'com.google.code.gson:gson:2.8.6' implementation 'me.zhanghai.android.fastscroll:library:1.1.2' implementation "com.thefuntasty.hauler:core:3.1.0" + // androidX startup for auto-init + implementation "androidx.startup:startup-runtime:1.0.0-alpha01" + //crashy + implementation 'com.github.CraZyLegenD:Crashy:1.0.4' def toroVersion = '3.7.0.2010003' implementation "im.ene.toro3:toro:$toroVersion" 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; + } + } +} \ 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 54763f42..eed910f4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -429,6 +429,8 @@ r/Infinity_For_Reddit Share Share this app to other people if you enjoy it + Crash Reports + See the error logs and send them to me when you report bugs Infinity For Reddit Version %s Customization 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" /> + +