diff --git a/calculatorpp/AndroidManifest.xml b/calculatorpp/AndroidManifest.xml
index 2816ecec..f182a0d4 100644
--- a/calculatorpp/AndroidManifest.xml
+++ b/calculatorpp/AndroidManifest.xml
@@ -57,5 +57,11 @@
+
+
\ No newline at end of file
diff --git a/calculatorpp/pom.xml b/calculatorpp/pom.xml
index fa08d93c..5fa5f331 100644
--- a/calculatorpp/pom.xml
+++ b/calculatorpp/pom.xml
@@ -85,6 +85,11 @@
+
+ ch.acra
+ acra
+ 4.3.0
+
com.google.android
diff --git a/calculatorpp/res/values/text_strings.xml b/calculatorpp/res/values/text_strings.xml
index 86f2e78c..3349f144 100644
--- a/calculatorpp/res/values/text_strings.xml
+++ b/calculatorpp/res/values/text_strings.xml
@@ -211,5 +211,12 @@
Result
Other
Derivatives/Integrals
+ Calculator++ has been crashed…
+ Calculator++ crash report confirmation
+
+ Unfortunately, Calculator++ has been crashed.\n\n
+ In order to fix the problem we need some information about it. It\'s highly recommended to send crash report via email (after pressing \'Ok\' button you will see all sent data in the new window).\n\n
+ Do you want to send crash report via email?
+
\ No newline at end of file
diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java
index 4483076f..f704d90c 100644
--- a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java
+++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java
@@ -58,9 +58,6 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
*/
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
-
- CalculatorApplication.registerOnRemoteStackTrace();
-
/*final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);*/
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java
index 9bf6b74f..8dd7ef8c 100644
--- a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java
+++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java
@@ -1,132 +1,138 @@
-package org.solovyev.android.calculator;
-
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.net.Uri;
-import android.preference.PreferenceManager;
-import android.text.method.LinkMovementMethod;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.TextView;
-import net.robotmedia.billing.BillingController;
-import org.jetbrains.annotations.NotNull;
-import org.solovyev.android.ads.AdsController;
-import org.solovyev.android.calculator.history.AndroidCalculatorHistory;
-import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
-
-/**
- * User: serso
- * Date: 12/1/11
- * Time: 1:21 PM
- */
-public class CalculatorApplication extends android.app.Application {
-
- private static final String paypalDonateUrl = "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=se%2esolovyev%40gmail%2ecom&lc=RU&item_name=Android%20Calculator¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted";
-
- public static final String AD_FREE_PRODUCT_ID = "ad_free";
- public static final String AD_FREE_P_KEY = "org.solovyev.android.calculator_ad_free";
-
- public static final String ADMOB_USER_ID = "a14f02cf9c80cbc";
- public static final String REMOTE_STACK_TRACE_URL = "http://calculatorpp.com/crash_reports/upload.php";
-
- @NotNull
- private static CalculatorApplication instance;
-
- public CalculatorApplication() {
- instance = this;
- }
-
- @NotNull
- public static CalculatorApplication getInstance() {
- return instance;
- }
-
- @Override
- public void onCreate() {
- final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
-
- setTheme(preferences);
-
- super.onCreate();
-
- final AndroidCalculator calculator = new AndroidCalculator();
-
- CalculatorLocatorImpl.getInstance().init(calculator,
- new AndroidCalculatorEngine(this),
- new AndroidCalculatorClipboard(this),
- new AndroidCalculatorNotifier(this),
- new AndroidCalculatorHistory(this, calculator));
-
- CalculatorLocatorImpl.getInstance().getCalculator().init();
-
- AdsController.getInstance().init(ADMOB_USER_ID, AD_FREE_PRODUCT_ID, new BillingController.IConfiguration() {
-
- @Override
- public byte[] getObfuscationSalt() {
- return new byte[]{81, -114, 32, -127, -32, -104, -40, -15, -47, 57, -13, -41, -33, 67, -114, 7, -11, 53, 126, 82};
- }
-
- @Override
- public String getPublicKey() {
- return CalculatorSecurity.getPK();
- }
- });
-
- CalculatorPreferences.setDefaultValues(preferences);
- }
-
- private void setTheme(@NotNull SharedPreferences preferences) {
- final CalculatorPreferences.Gui.Theme theme = CalculatorPreferences.Gui.getTheme(preferences);
- setTheme(theme.getThemeId());
- }
-
- public static void showDonationDialog(@NotNull final Context context) {
- final LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(LAYOUT_INFLATER_SERVICE);
- final View view = layoutInflater.inflate(R.layout.donate, null);
-
- final TextView donate = (TextView) view.findViewById(R.id.donateText);
- donate.setMovementMethod(LinkMovementMethod.getInstance());
-
- final AlertDialog.Builder builder = new AlertDialog.Builder(context)
- .setCancelable(true)
- .setNegativeButton(R.string.c_cancel, null)
- .setPositiveButton(R.string.c_donate, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- final Intent i = new Intent(Intent.ACTION_VIEW);
- i.setData(Uri.parse(paypalDonateUrl));
- context.startActivity(i);
- }
- })
- .setView(view);
-
- builder.create().show();
- }
-
- public static void registerOnRemoteStackTrace() {
- //Thread.setDefaultUncaughtExceptionHandler(new CustomExceptionHandler(null, REMOTE_STACK_TRACE_URL));
- }
-
- @NotNull
- public CalculatorActivityHelper createActivityHelper(int layoutResId, @NotNull String logTag) {
- return new CalculatorActivityHelperImpl(layoutResId, logTag);
- }
-
- @NotNull
- public CalculatorFragmentHelper createFragmentHelper(int layoutId) {
- return new CalculatorFragmentHelperImpl(layoutId);
- }
-
- @NotNull
- public CalculatorFragmentHelper createFragmentHelper(int layoutId, int titleResId) {
- return new CalculatorFragmentHelperImpl(layoutId, titleResId);
- }
- @NotNull
- public CalculatorFragmentHelper createFragmentHelper(int layoutId, int titleResId, boolean listenersOnCreate) {
- return new CalculatorFragmentHelperImpl(layoutId, titleResId, listenersOnCreate);
- }
-
-}
+package org.solovyev.android.calculator;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.net.Uri;
+import android.preference.PreferenceManager;
+import android.text.method.LinkMovementMethod;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.TextView;
+import net.robotmedia.billing.BillingController;
+import org.acra.ACRA;
+import org.acra.ReportingInteractionMode;
+import org.acra.annotation.ReportsCrashes;
+import org.jetbrains.annotations.NotNull;
+import org.solovyev.android.ads.AdsController;
+import org.solovyev.android.calculator.history.AndroidCalculatorHistory;
+import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
+
+/**
+ * User: serso
+ * Date: 12/1/11
+ * Time: 1:21 PM
+ */
+@ReportsCrashes(formKey = "",
+ mailTo = "se.solovyev+programming+calculatorpp+crashes@gmail.com",
+ mode = ReportingInteractionMode.DIALOG,
+ resToastText = R.string.crashed,
+ resDialogTitle = R.string.crash_dialog_title,
+ resDialogText = R.string.crash_dialog_text)
+public class CalculatorApplication extends android.app.Application {
+
+ private static final String paypalDonateUrl = "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=se%2esolovyev%40gmail%2ecom&lc=RU&item_name=Android%20Calculator¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted";
+
+ public static final String AD_FREE_PRODUCT_ID = "ad_free";
+ public static final String AD_FREE_P_KEY = "org.solovyev.android.calculator_ad_free";
+
+ public static final String ADMOB_USER_ID = "a14f02cf9c80cbc";
+
+ @NotNull
+ private static CalculatorApplication instance;
+
+ public CalculatorApplication() {
+ instance = this;
+ }
+
+ @NotNull
+ public static CalculatorApplication getInstance() {
+ return instance;
+ }
+
+ @Override
+ public void onCreate() {
+ ACRA.init(this);
+
+ final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
+
+ setTheme(preferences);
+
+ super.onCreate();
+
+ final AndroidCalculator calculator = new AndroidCalculator();
+
+ CalculatorLocatorImpl.getInstance().init(calculator,
+ new AndroidCalculatorEngine(this),
+ new AndroidCalculatorClipboard(this),
+ new AndroidCalculatorNotifier(this),
+ new AndroidCalculatorHistory(this, calculator));
+
+ CalculatorLocatorImpl.getInstance().getCalculator().init();
+
+ AdsController.getInstance().init(ADMOB_USER_ID, AD_FREE_PRODUCT_ID, new BillingController.IConfiguration() {
+
+ @Override
+ public byte[] getObfuscationSalt() {
+ return new byte[]{81, -114, 32, -127, -32, -104, -40, -15, -47, 57, -13, -41, -33, 67, -114, 7, -11, 53, 126, 82};
+ }
+
+ @Override
+ public String getPublicKey() {
+ return CalculatorSecurity.getPK();
+ }
+ });
+
+ CalculatorPreferences.setDefaultValues(preferences);
+ }
+
+ private void setTheme(@NotNull SharedPreferences preferences) {
+ final CalculatorPreferences.Gui.Theme theme = CalculatorPreferences.Gui.getTheme(preferences);
+ setTheme(theme.getThemeId());
+ }
+
+ public static void showDonationDialog(@NotNull final Context context) {
+ final LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(LAYOUT_INFLATER_SERVICE);
+ final View view = layoutInflater.inflate(R.layout.donate, null);
+
+ final TextView donate = (TextView) view.findViewById(R.id.donateText);
+ donate.setMovementMethod(LinkMovementMethod.getInstance());
+
+ final AlertDialog.Builder builder = new AlertDialog.Builder(context)
+ .setCancelable(true)
+ .setNegativeButton(R.string.c_cancel, null)
+ .setPositiveButton(R.string.c_donate, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ final Intent i = new Intent(Intent.ACTION_VIEW);
+ i.setData(Uri.parse(paypalDonateUrl));
+ context.startActivity(i);
+ }
+ })
+ .setView(view);
+
+ builder.create().show();
+ }
+
+ @NotNull
+ public CalculatorActivityHelper createActivityHelper(int layoutResId, @NotNull String logTag) {
+ return new CalculatorActivityHelperImpl(layoutResId, logTag);
+ }
+
+ @NotNull
+ public CalculatorFragmentHelper createFragmentHelper(int layoutId) {
+ return new CalculatorFragmentHelperImpl(layoutId);
+ }
+
+ @NotNull
+ public CalculatorFragmentHelper createFragmentHelper(int layoutId, int titleResId) {
+ return new CalculatorFragmentHelperImpl(layoutId, titleResId);
+ }
+ @NotNull
+ public CalculatorFragmentHelper createFragmentHelper(int layoutId, int titleResId, boolean listenersOnCreate) {
+ return new CalculatorFragmentHelperImpl(layoutId, titleResId, listenersOnCreate);
+ }
+
+}