aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/build.gradle4
-rw-r--r--app/src/main/AndroidManifest.xml10
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsFragment.java54
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsRecyclerViewAdapter.java46
-rw-r--r--app/src/main/res/values/strings.xml2
-rw-r--r--app/src/main/res/xml/about_preferences.xml5
6 files changed, 121 insertions, 0 deletions
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" />
</provider>
+ <provider
+ android:name="androidx.startup.InitializationProvider"
+ android:authorities="${applicationId}.androidx-startup"
+ android:exported="false"
+ tools:node="merge">
+ <meta-data
+ android:name="com.crazylegend.crashyreporter.initializer.CrashyInitializer"
+ android:value="androidx.startup" />
+ </provider>
+
<service
android:name=".Service.SubmitPostService"
android:enabled="true"
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsFragment.java
new file mode 100644
index 00000000..04bdc0e9
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsFragment.java
@@ -0,0 +1,54 @@
+package ml.docilealligator.infinityforreddit.Settings;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.crazylegend.crashyreporter.CrashyReporter;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import ml.docilealligator.infinityforreddit.R;
+
+public class CrashReportsFragment extends Fragment {
+
+ @BindView(R.id.recycler_view_crash_reports_fragment)
+ RecyclerView recyclerView;
+ private Activity activity;
+ private CrashReportsRecyclerViewAdapter adapter;
+ private LinearLayoutManager linearLayoutManager;
+
+ public CrashReportsFragment() {
+ // Required empty public constructor
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ View rootView = inflater.inflate(R.layout.fragment_crash_reports, container, false);
+
+ ButterKnife.bind(this, rootView);
+
+ adapter = new CrashReportsRecyclerViewAdapter(CrashyReporter.INSTANCE.getLogsAsStrings());
+ linearLayoutManager = new LinearLayoutManager(activity);
+ recyclerView.setLayoutManager(linearLayoutManager);
+ recyclerView.setAdapter(adapter);
+
+ return rootView;
+ }
+
+ @Override
+ public void onAttach(@NonNull Context context) {
+ super.onAttach(context);
+ this.activity = (Activity) context;
+ }
+} \ No newline at end of file
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsRecyclerViewAdapter.java
new file mode 100644
index 00000000..82c43795
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsRecyclerViewAdapter.java
@@ -0,0 +1,46 @@
+package ml.docilealligator.infinityforreddit.Settings;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import java.util.List;
+
+import ml.docilealligator.infinityforreddit.R;
+
+class CrashReportsRecyclerViewAdapter extends RecyclerView.Adapter<CrashReportsRecyclerViewAdapter.CrashReportViewHolder> {
+ private List<String> crashReports;
+
+ public CrashReportsRecyclerViewAdapter(List<String> 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 @@
<string name="settings_subreddit_summary">r/Infinity_For_Reddit</string>
<string name="settings_share_title">Share</string>
<string name="settings_share_summary">Share this app to other people if you enjoy it</string>
+ <string name="settings_crash_reports_title">Crash Reports</string>
+ <string name="settings_crash_reports_summary">See the error logs and send them to me when you report bugs</string>
<string name="settings_version_title">Infinity For Reddit</string>
<string name="settings_version_summary">Version %s</string>
<string name="settings_category_customization_title">Customization</string>
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
@@ -46,6 +46,11 @@
app:summary="@string/settings_share_summary" />
<Preference
+ app:title="@string/settings_crash_reports_title"
+ app:summary="@string/settings_crash_reports_summary"
+ app:fragment="ml.docilealligator.infinityforreddit.Settings.CrashReportsFragment" />
+
+ <Preference
android:key="version"
app:title="@string/settings_version_title"
app:summary="@string/settings_version_summary" />