mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-01 01:06:11 +00:00
Added enabling crash reports in debug info dialog
This commit is contained in:
parent
6802c7bff6
commit
c71abbc50b
2 changed files with 51 additions and 1 deletions
|
@ -24,6 +24,7 @@ import static android.app.Activity.RESULT_OK;
|
|||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
|
@ -40,6 +41,7 @@ import android.widget.Spinner;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -54,12 +56,16 @@ public class FragmentDialogDebug extends FragmentDialogBase {
|
|||
enabled = savedInstanceState.getBoolean("fair:enabled");
|
||||
|
||||
final Context context = getContext();
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.dialog_debug, null);
|
||||
final ImageButton ibInfo = view.findViewById(R.id.ibInfo);
|
||||
final EditText etIssue = view.findViewById(R.id.etIssue);
|
||||
final Spinner spAccount = view.findViewById(R.id.spAccount);
|
||||
final CheckBox cbContact = view.findViewById(R.id.cbContact);
|
||||
final CheckBox cbSend = view.findViewById(R.id.cbSend);
|
||||
final CheckBox cbCrashReports = view.findViewById(R.id.cbCrashReports);
|
||||
final ImageButton ibCrashReports = view.findViewById(R.id.ibCrashReports);
|
||||
|
||||
ibInfo.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -68,6 +74,17 @@ public class FragmentDialogDebug extends FragmentDialogBase {
|
|||
}
|
||||
});
|
||||
|
||||
boolean crash_reports = prefs.getBoolean("crash_reports", false);
|
||||
cbCrashReports.setVisibility(crash_reports ? View.GONE : View.VISIBLE);
|
||||
|
||||
ibCrashReports.setVisibility(crash_reports ? View.GONE : View.VISIBLE);
|
||||
ibCrashReports.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Helper.viewFAQ(v.getContext(), 104);
|
||||
}
|
||||
});
|
||||
|
||||
final ArrayAdapter<EntityAccount> adapterAccount;
|
||||
etIssue.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
|
@ -147,6 +164,14 @@ public class FragmentDialogDebug extends FragmentDialogBase {
|
|||
if (account != null)
|
||||
args.putString("account", account.id + "/" + account.name + "/" + account.user);
|
||||
|
||||
if (cbCrashReports.isChecked()) {
|
||||
prefs.edit()
|
||||
.remove("crash_report_count")
|
||||
.putBoolean("crash_reports", true)
|
||||
.apply();
|
||||
Log.setCrashReporting(true);
|
||||
}
|
||||
|
||||
sendResult(RESULT_OK);
|
||||
}
|
||||
})
|
||||
|
|
|
@ -116,6 +116,31 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbSend" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbCrashReports"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_crash_reports"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ibCrashReports"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvSendRemark" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/ibCrashReports"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/title_info"
|
||||
android:padding="6dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:tooltipText="@string/title_info"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/cbCrashReports"
|
||||
app:srcCompat="@drawable/twotone_info_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvQuestion"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -125,6 +150,6 @@
|
|||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textStyle="italic|bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSendRemark" />
|
||||
app:layout_constraintTop_toBottomOf="@id/ibCrashReports" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
|
|
Loading…
Reference in a new issue