diff --git a/android-app-core/pom.xml b/android-app-core/pom.xml
index 300fa660..e1f82e7e 100644
--- a/android-app-core/pom.xml
+++ b/android-app-core/pom.xml
@@ -59,6 +59,17 @@
support-v4
+
+ junit
+ junit
+
+
+
+ org.robolectric
+ robolectric
+ test
+
+
diff --git a/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/AbstractCalculatorWidgetProvider.java b/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/AbstractCalculatorWidgetProvider.java
index 30d56805..ae230ac4 100644
--- a/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/AbstractCalculatorWidgetProvider.java
+++ b/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/AbstractCalculatorWidgetProvider.java
@@ -41,6 +41,8 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider implem
@Nonnull
private ExternalCalculatorIntentHandler intentHandler = new CalculatorWidgetIntentHandler(this);
+ private boolean initialized = false;
+
/*
**********************************************************************
@@ -51,9 +53,6 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider implem
*/
protected AbstractCalculatorWidgetProvider() {
- final Class extends AppWidgetProvider> componentClass = this.getComponentClass();
-
- Locator.getInstance().getExternalListenersContainer().addExternalListener(componentClass);
}
/*
@@ -68,6 +67,12 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider implem
public void onEnabled(Context context) {
super.onEnabled(context);
+ if (!initialized) {
+ final Class extends AppWidgetProvider> componentClass = this.getComponentClass();
+ Locator.getInstance().getExternalListenersContainer().addExternalListener(componentClass);
+ initialized = true;
+ }
+
getCursorColor(context);
}
diff --git a/android-app/pom.xml b/android-app/pom.xml
index d1ba1c4a..b8776ad5 100644
--- a/android-app/pom.xml
+++ b/android-app/pom.xml
@@ -125,7 +125,6 @@
org.robolectric
robolectric
- 2.1.1
test
diff --git a/android-app/project.properties b/android-app/project.properties
deleted file mode 100644
index c2cbeb1a..00000000
--- a/android-app/project.properties
+++ /dev/null
@@ -1,35 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=android-17
-android.library.reference.1=../android-app-core
-android.library.reference.2=../android-app-widget
-android.library.reference.3=../android-app-onscreen
-android.library.reference.4=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-all_1.1.1-SNAPSHOT
-android.library.reference.5=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-ads_1.1.1-SNAPSHOT
-android.library.reference.6=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-core_1.1.1-SNAPSHOT
-android.library.reference.7=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-billing_1.1.1-SNAPSHOT
-android.library.reference.8=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-db_1.1.1-SNAPSHOT
-android.library.reference.9=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-security_1.1.1-SNAPSHOT
-android.library.reference.10=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-http_1.1.1-SNAPSHOT
-android.library.reference.11=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-lists_1.1.1-SNAPSHOT
-android.library.reference.12=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-views_1.1.1-SNAPSHOT
-android.library.reference.13=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-preferences_1.1.1-SNAPSHOT
-android.library.reference.14=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-menus_1.1.1-SNAPSHOT
-android.library.reference.15=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-other_1.1.1-SNAPSHOT
-android.library.reference.16=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-sherlock_1.1.1-SNAPSHOT
-android.library.reference.17=gen-external-apklibs/com.actionbarsherlock_actionbarsherlock_4.2.0
-android.library.reference.18=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-keyboards_1.1.1-SNAPSHOT
-android.library.reference.19=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-app_1.1.1-SNAPSHOT
-android.library.reference.20=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-networks_1.1.1-SNAPSHOT
-android.library.reference.21=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-fragments_1.1.1-SNAPSHOT
-android.library.reference.22=../android-app-widget/gen-external-apklibs/org.solovyev.android_android-common-tasks_1.1.1-SNAPSHOT
-
-
diff --git a/android-app/src/test/java/org/solovyev/android/calculator/AndroidCalculatorEditorViewTest.java b/android-app/src/test/java/org/solovyev/android/calculator/AndroidCalculatorEditorViewTest.java
index 6fd1f398..b507d7b8 100644
--- a/android-app/src/test/java/org/solovyev/android/calculator/AndroidCalculatorEditorViewTest.java
+++ b/android-app/src/test/java/org/solovyev/android/calculator/AndroidCalculatorEditorViewTest.java
@@ -1,18 +1,24 @@
package org.solovyev.android.calculator;
+import java.util.Date;
+import java.util.Random;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
-import org.robolectric.annotation.Config;
+import org.solovyev.common.text.Strings;
/**
* User: serso
* Date: 10/13/12
* Time: 1:11 PM
*/
-@Config(manifest = Config.DEFAULT)
@RunWith(value = RobolectricTestRunner.class)
public class AndroidCalculatorEditorViewTest {
@@ -34,7 +40,7 @@ public class AndroidCalculatorEditorViewTest {
@Test
public void testAsyncWork() throws Exception {
-/* final int threadNum = 10;
+ final int threadNum = 10;
final int count = 10;
final int maxTextLength = 100;
@@ -78,6 +84,6 @@ public class AndroidCalculatorEditorViewTest {
Assert.assertFalse(error.get());
} else {
Assert.fail("Too long execution!");
- }*/
+ }
}
}
diff --git a/android-app/src/test/java/org/solovyev/android/calculator/TextHighlighterTest.java b/android-app/src/test/java/org/solovyev/android/calculator/TextHighlighterTest.java
index a7ac75b0..0001db3c 100644
--- a/android-app/src/test/java/org/solovyev/android/calculator/TextHighlighterTest.java
+++ b/android-app/src/test/java/org/solovyev/android/calculator/TextHighlighterTest.java
@@ -9,7 +9,8 @@ package org.solovyev.android.calculator;
import android.graphics.Color;
import jscl.MathEngine;
import jscl.NumeralBase;
-import junit.framework.Assert;
+
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.solovyev.android.calculator.text.TextProcessor;
diff --git a/android-app/src/test/java/org/solovyev/android/calculator/plot/CalculatorGraph2dViewTest.java b/android-app/src/test/java/org/solovyev/android/calculator/plot/CalculatorGraph2dViewTest.java
index a5c92e07..e76b81ce 100644
--- a/android-app/src/test/java/org/solovyev/android/calculator/plot/CalculatorGraph2dViewTest.java
+++ b/android-app/src/test/java/org/solovyev/android/calculator/plot/CalculatorGraph2dViewTest.java
@@ -1,5 +1,8 @@
package org.solovyev.android.calculator.plot;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -14,7 +17,14 @@ public class CalculatorGraph2dViewTest {
@Test
public void testFormatTick() throws Exception {
assertEquals("23324", CalculatorGraph2dView.formatTick(23324.0f, 0));
- assertEquals("23324.1", CalculatorGraph2dView.formatTick(23324.1f, 1));
+
+ final DecimalFormat format = (DecimalFormat) DecimalFormat.getInstance();
+ final DecimalFormatSymbols decimalFormatSymbols = format.getDecimalFormatSymbols();
+ if (',' == decimalFormatSymbols.getDecimalSeparator()) {
+ assertEquals("23324,1", CalculatorGraph2dView.formatTick(23324.1f, 1));
+ } else if ('.' == decimalFormatSymbols.getDecimalSeparator()) {
+ assertEquals("23324.1", CalculatorGraph2dView.formatTick(23324.1f, 1));
+ }
}
@Test
diff --git a/android-app/src/test/java/org/solovyev/android/calculator/wizard/CalculatorWizardActivityTest.java b/android-app/src/test/java/org/solovyev/android/calculator/wizard/CalculatorWizardActivityTest.java
index d80bc71a..27893a6e 100644
--- a/android-app/src/test/java/org/solovyev/android/calculator/wizard/CalculatorWizardActivityTest.java
+++ b/android-app/src/test/java/org/solovyev/android/calculator/wizard/CalculatorWizardActivityTest.java
@@ -4,7 +4,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
-import org.robolectric.annotation.Config;
import org.robolectric.util.ActivityController;
import static org.junit.Assert.assertEquals;
@@ -15,7 +14,6 @@ import static org.junit.Assert.assertNotNull;
* Date: 6/17/13
* Time: 9:57 PM
*/
-@Config(manifest = "android-app/AndroidManifest.xml")
@RunWith(value = RobolectricTestRunner.class)
public class CalculatorWizardActivityTest {
@@ -26,11 +24,8 @@ public class CalculatorWizardActivityTest {
controller.create();
final CalculatorWizardActivity activity = controller.get();
- activity.onCreate(null);
assertNotNull(activity.getFlow());
assertNotNull(activity.getStep());
assertEquals(activity.getFlow().getFirstStep(), activity.getStep());
-
-
}
}
diff --git a/pom.xml b/pom.xml
index d509748b..d1d2065e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -181,6 +181,13 @@
4.11
+
+ org.robolectric
+ robolectric
+ 2.1.1
+ test
+
+
com.google.android
android
@@ -258,7 +265,9 @@
maven-surefire-plugin
2.15
- always
+ classes
+ 1
+ false