diff --git a/app/src/main/java/phone/vishnu/quotes/acra/ACRAErrorActivity.java b/app/src/main/java/phone/vishnu/quotes/acra/ACRAErrorActivity.java index 462a056..5be2fec 100644 --- a/app/src/main/java/phone/vishnu/quotes/acra/ACRAErrorActivity.java +++ b/app/src/main/java/phone/vishnu/quotes/acra/ACRAErrorActivity.java @@ -30,7 +30,6 @@ import android.widget.Button; import android.widget.TextView; import android.widget.Toast; -import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import com.google.android.material.textfield.TextInputEditText; import com.google.gson.GsonBuilder; @@ -38,8 +37,6 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.util.Date; -import org.acra.ReportField; -import org.acra.data.CrashReportData; import phone.vishnu.quotes.BuildConfig; import phone.vishnu.quotes.R; import phone.vishnu.quotes.activity.SplashActivity; @@ -47,7 +44,8 @@ public class ACRAErrorActivity extends AppCompatActivity { - private TextView stackTraceTV, + private TextView errorActivityTitleTV, + stackTraceTV, packageNameTV, versionNameTV, versionCodeTV, @@ -56,40 +54,6 @@ public class ACRAErrorActivity extends AppCompatActivity { private Button telegramButton, githubButton; private TextInputEditText userCommentTIE; - public static void openErrorActivity( - @NonNull Context context, @NonNull CrashReportData errorContent) { - - Intent intent = - new Intent(context, ACRAErrorActivity.class) - .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - - intent.putExtra( - Constants.ACRA_STACK_TRACE, - checkNullity(errorContent.getString(ReportField.STACK_TRACE))); - intent.putExtra( - Constants.ACRA_ANDROID_VERSION, - checkNullity(errorContent.getString(ReportField.ANDROID_VERSION))); - intent.putExtra( - Constants.ACRA_APP_VERSION_CODE, - checkNullity(errorContent.getString(ReportField.APP_VERSION_CODE))); - intent.putExtra( - Constants.ACRA_APP_VERSION_NAME, - checkNullity(errorContent.getString(ReportField.APP_VERSION_NAME))); - intent.putExtra( - Constants.ACRA_PACKAGE_NAME, - checkNullity(errorContent.getString(ReportField.PACKAGE_NAME))); - intent.putExtra( - Constants.ACRA_USER_APP_START_DATE, - checkNullity(errorContent.getString(ReportField.USER_APP_START_DATE))); - - context.startActivity(intent); - } - - private static String checkNullity(String s) { - // TODO - return s == null ? "Property not found" : s; - } - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -97,12 +61,10 @@ protected void onCreate(Bundle savedInstanceState) { if (!checkIntent(getIntent())) moveToSplash(); setContentView(R.layout.activity_acra_error); - setTitle( - String.format( - "%s %s", - getString(R.string.quotes_status_creator), getString(R.string.crashed))); + if (getSupportActionBar() != null) getSupportActionBar().setDisplayHomeAsUpEnabled(true); + errorActivityTitleTV = findViewById(R.id.errorActivityTitleTV); stackTraceTV = findViewById(R.id.errorActivityStackTraceTV); packageNameTV = findViewById(R.id.errorActivityPackageNameTV); versionNameTV = findViewById(R.id.errorActivityVersionNameTV); @@ -129,6 +91,10 @@ protected void onCreate(Bundle savedInstanceState) { e.printStackTrace(); } + errorActivityTitleTV.setText( + String.format( + "%s %s", + getString(R.string.quotes_status_creator), getString(R.string.crashed))); packageNameTV.setText( String.format( "%s %s", getString(R.string.package_name), BuildConfig.APPLICATION_ID)); diff --git a/app/src/main/java/phone/vishnu/quotes/acra/ACRAFactory.java b/app/src/main/java/phone/vishnu/quotes/acra/ACRAFactory.java deleted file mode 100644 index 4c59036..0000000 --- a/app/src/main/java/phone/vishnu/quotes/acra/ACRAFactory.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2019 - 2024 Vishnu Sanal. T - * - * This file is part of Quotes Status Creator. - * - * Quotes Status Creator is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package phone.vishnu.quotes.acra; - -import android.content.Context; -import androidx.annotation.NonNull; -import com.google.auto.service.AutoService; -import org.acra.config.CoreConfiguration; -import org.acra.sender.ReportSender; -import org.acra.sender.ReportSenderFactory; - -@AutoService(ReportSenderFactory.class) -public class ACRAFactory implements ReportSenderFactory { - - public ACRAFactory() {} - - @NonNull - @Override - public ReportSender create( - @NonNull Context context, @NonNull CoreConfiguration coreConfiguration) { - return new ACRASender(); - } -} diff --git a/app/src/main/java/phone/vishnu/quotes/acra/ACRASender.java b/app/src/main/java/phone/vishnu/quotes/acra/ACRASender.java deleted file mode 100644 index abc2b9f..0000000 --- a/app/src/main/java/phone/vishnu/quotes/acra/ACRASender.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2019 - 2024 Vishnu Sanal. T - * - * This file is part of Quotes Status Creator. - * - * Quotes Status Creator is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package phone.vishnu.quotes.acra; - -import android.content.Context; -import androidx.annotation.NonNull; -import org.acra.data.CrashReportData; -import org.acra.sender.ReportSender; - -class ACRASender implements ReportSender { - - @Override - public void send(@NonNull Context context, @NonNull CrashReportData errorContent) { - ACRAErrorActivity.openErrorActivity(context, errorContent); - } -} diff --git a/app/src/main/res/layout/activity_acra_error.xml b/app/src/main/res/layout/activity_acra_error.xml index 4e5ac8d..ad1ba96 100644 --- a/app/src/main/res/layout/activity_acra_error.xml +++ b/app/src/main/res/layout/activity_acra_error.xml @@ -17,6 +17,21 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> + + - \ No newline at end of file +