diff --git a/calculatorpp/project.properties b/calculatorpp/project.properties
index 3e8758ec..febda8cf 100644
--- a/calculatorpp/project.properties
+++ b/calculatorpp/project.properties
@@ -10,5 +10,5 @@
# Project target.
target=android-15
android.library.reference.1=../calculatorpp-service
-android.library.reference.2=gen-external-apklibs/org.solovyev.android_common_0.1.2
+android.library.reference.2=gen-external-apklibs/org.solovyev.android_common_0.1.3
diff --git a/calculatorpp/res/layout/unit_converter.xml b/calculatorpp/res/layout/unit_converter.xml
new file mode 100644
index 00000000..5c4a3273
--- /dev/null
+++ b/calculatorpp/res/layout/unit_converter.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/calculatorpp/res/menu/main_menu.xml b/calculatorpp/res/menu/main_menu.xml
index fd504271..551fbc35 100644
--- a/calculatorpp/res/menu/main_menu.xml
+++ b/calculatorpp/res/menu/main_menu.xml
@@ -8,12 +8,16 @@
+
+
+
\ No newline at end of file
diff --git a/calculatorpp/res/values/text_strings.xml b/calculatorpp/res/values/text_strings.xml
index 55f7e189..80242e51 100644
--- a/calculatorpp/res/values/text_strings.xml
+++ b/calculatorpp/res/values/text_strings.xml
@@ -195,6 +195,7 @@
Angle units changed to \'%s\'!
Numeral base changed to \'%s\'!
+ Conversion tool
\ No newline at end of file
diff --git a/calculatorpp/src/main/java/org/solovyev/android/NumeralBaseUnitType.java b/calculatorpp/src/main/java/org/solovyev/android/NumeralBaseUnitType.java
new file mode 100644
index 00000000..a0a222bf
--- /dev/null
+++ b/calculatorpp/src/main/java/org/solovyev/android/NumeralBaseUnitType.java
@@ -0,0 +1,83 @@
+package org.solovyev.android;
+
+import jscl.NumeralBase;
+import org.jetbrains.annotations.NotNull;
+
+import java.math.BigInteger;
+
+/**
+ * User: serso
+ * Date: 4/21/12
+ * Time: 8:00 PM
+ */
+public enum NumeralBaseUnitType implements UnitType {
+
+ bin(NumeralBase.bin),
+ oct(NumeralBase.oct),
+ dec(NumeralBase.dec),
+ hex(NumeralBase.hex);
+
+ @NotNull
+ private final NumeralBase numeralBase;
+
+ private NumeralBaseUnitType(@NotNull NumeralBase numeralBase) {
+ this.numeralBase = numeralBase;
+ }
+
+ @NotNull
+ public Unit createUnit(@NotNull String value) {
+ return UnitImpl.newInstance(value, this);
+ }
+
+ @NotNull
+ @Override
+ public Class getUnitValueClass() {
+ return String.class;
+ }
+
+ @NotNull
+ private static final Converter converter = new Converter();
+
+ @NotNull
+ public static Converter getConverter() {
+ return converter;
+ }
+
+ public static class Converter implements UnitConverter {
+
+ private Converter() {
+ }
+
+ @Override
+ public boolean isSupported(@NotNull UnitType> from, @NotNull UnitType to) {
+ return NumeralBaseUnitType.class.isAssignableFrom(from.getClass()) && NumeralBaseUnitType.class.isAssignableFrom(to.getClass());
+ }
+
+ @NotNull
+ @Override
+ public Unit convert(@NotNull Unit> from, @NotNull UnitType toType) {
+ if (!isSupported(from.getUnitType(), toType)) {
+ throw new IllegalArgumentException("Types are not supported!");
+ }
+
+ final NumeralBaseUnitType fromType = (NumeralBaseUnitType) from.getUnitType();
+ final NumeralBase fromNumeralBase = fromType.numeralBase;
+ final NumeralBase toNumeralBase = ((NumeralBaseUnitType) toType).numeralBase;
+ final String fromValue = (String) from.getValue();
+
+ final BigInteger decBigInteger = fromNumeralBase.toBigInteger(fromValue);
+ return UnitImpl.newInstance(toNumeralBase.toString(decBigInteger), (NumeralBaseUnitType) toType);
+ }
+ }
+
+ @NotNull
+ public static NumeralBaseUnitType valueOf(@NotNull NumeralBase nb ) {
+ for (NumeralBaseUnitType numeralBaseUnitType : values()) {
+ if ( numeralBaseUnitType.numeralBase == nb ) {
+ return numeralBaseUnitType;
+ }
+ }
+
+ throw new IllegalArgumentException(nb + " is not supported numeral base!");
+ }
+}
diff --git a/calculatorpp/src/main/java/org/solovyev/android/Unit.java b/calculatorpp/src/main/java/org/solovyev/android/Unit.java
new file mode 100644
index 00000000..c3a2d8a5
--- /dev/null
+++ b/calculatorpp/src/main/java/org/solovyev/android/Unit.java
@@ -0,0 +1,17 @@
+package org.solovyev.android;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * User: serso
+ * Date: 4/21/12
+ * Time: 7:54 PM
+ */
+public interface Unit {
+
+ @NotNull
+ V getValue();
+
+ @NotNull
+ UnitType getUnitType();
+}
diff --git a/calculatorpp/src/main/java/org/solovyev/android/UnitConverter.java b/calculatorpp/src/main/java/org/solovyev/android/UnitConverter.java
new file mode 100644
index 00000000..51785cc7
--- /dev/null
+++ b/calculatorpp/src/main/java/org/solovyev/android/UnitConverter.java
@@ -0,0 +1,42 @@
+package org.solovyev.android;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * User: serso
+ * Date: 4/21/12
+ * Time: 7:53 PM
+ */
+public interface UnitConverter {
+
+ boolean isSupported(@NotNull UnitType> from, @NotNull UnitType to);
+
+ @NotNull
+ Unit convert(@NotNull Unit> from, @NotNull UnitType toType);
+
+ public static class Dummy implements UnitConverter