mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 12:47:26 +01:00
New option: Crash Reports.
This commit is contained in:
parent
12f52ec4fd
commit
2d0aa76d34
@ -173,7 +173,8 @@ dependencies {
|
||||
implementation 'net.lingala.zip4j:zip4j:2.7.0'
|
||||
implementation 'org.apache.commons:commons-io:1.3.2'
|
||||
|
||||
implementation 'com.github.razir.progressbutton:progressbutton:2.1.0'
|
||||
implementation "androidx.startup:startup-runtime:1.0.0"
|
||||
implementation 'com.github.FunkyMuse:Crashy:1.1.0'
|
||||
|
||||
|
||||
/**** Builds and flavors ****/
|
||||
|
@ -409,6 +409,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=".services.SubmitPostService"
|
||||
android:enabled="true"
|
||||
|
@ -95,6 +95,7 @@ public class LoginActivity extends BaseActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
int llll = 0 / 0;
|
||||
|
||||
setImmersiveModeNotApplicable();
|
||||
|
||||
|
@ -0,0 +1,45 @@
|
||||
package ml.docilealligator.infinityforreddit.adapters;
|
||||
|
||||
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;
|
||||
|
||||
public class CrashReportsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
private List<String> crashReports;
|
||||
|
||||
public CrashReportsRecyclerViewAdapter(List<String> crashReports) {
|
||||
this.crashReports = crashReports;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder 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 RecyclerView.ViewHolder holder, int position) {
|
||||
((CrashReportViewHolder) holder).crashReportTextView.setText(crashReports.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return crashReports == null ? 0 : crashReports.size();
|
||||
}
|
||||
|
||||
private class CrashReportViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView crashReportTextView;
|
||||
public CrashReportViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
crashReportTextView = (TextView) itemView;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
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 ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.adapters.CrashReportsRecyclerViewAdapter;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
* Use the {@link CrashReportsFragment#newInstance} factory method to
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class CrashReportsFragment extends Fragment {
|
||||
|
||||
private Activity activity;
|
||||
|
||||
public CrashReportsFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
RecyclerView recyclerView = (RecyclerView) inflater.inflate(R.layout.fragment_crash_reports, container, false);
|
||||
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(activity));
|
||||
recyclerView.setAdapter(new CrashReportsRecyclerViewAdapter(CrashyReporter.INSTANCE.getLogsAsStrings()));
|
||||
|
||||
return recyclerView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
activity = (Activity) context;
|
||||
}
|
||||
}
|
6
app/src/main/res/layout/fragment_crash_reports.xml
Normal file
6
app/src/main/res/layout/fragment_crash_reports.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".settings.CrashReportsFragment" />
|
8
app/src/main/res/layout/item_crash_report.xml
Normal file
8
app/src/main/res/layout/item_crash_report.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default" />
|
@ -556,6 +556,7 @@
|
||||
<string name="settings_hide_favorite_subreddits_sections_title">Hide Favorite Subreddits Section</string>
|
||||
<string name="settings_hide_subscribed_subreddits_sections_title">Hide Subscribed Subreddits Section</string>
|
||||
<string name="settings_default_search_result_tab">Default Search Result Tab</string>
|
||||
<string name="settings_crash_reports_title">Crash Reports</string>
|
||||
|
||||
<string name="no_link_available">Cannot get the link</string>
|
||||
|
||||
|
@ -46,4 +46,8 @@
|
||||
app:key="restore_settings"
|
||||
app:title="@string/settings_restore_settings_title" />
|
||||
|
||||
<Preference
|
||||
app:title="@string/settings_crash_reports_title"
|
||||
app:fragment="ml.docilealligator.infinityforreddit.settings.CrashReportsFragment" />
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user