diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorButton.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorButton.java
index 833deff1..247a88d7 100644
--- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorButton.java
+++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorButton.java
@@ -26,21 +26,10 @@ import android.content.Context;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-
-import org.solovyev.android.calculator.R;
-
import java.util.HashMap;
import java.util.Map;
-import static org.solovyev.android.calculator.CalculatorSpecialButton.cursor_left;
-import static org.solovyev.android.calculator.CalculatorSpecialButton.cursor_right;
-import static org.solovyev.android.calculator.CalculatorSpecialButton.functions_detached;
-import static org.solovyev.android.calculator.CalculatorSpecialButton.history_detached;
-import static org.solovyev.android.calculator.CalculatorSpecialButton.like;
-import static org.solovyev.android.calculator.CalculatorSpecialButton.open_app;
-import static org.solovyev.android.calculator.CalculatorSpecialButton.operators_detached;
-import static org.solovyev.android.calculator.CalculatorSpecialButton.settings_detached;
-import static org.solovyev.android.calculator.CalculatorSpecialButton.vars_detached;
+import static org.solovyev.android.calculator.CalculatorSpecialButton.*;
/**
* User: serso
@@ -80,7 +69,7 @@ public enum CalculatorButton {
multiplication(R.id.cpp_button_multiplication, "*"),
division(R.id.cpp_button_division, "/"),
plus(R.id.cpp_button_plus, "+"),
- subtraction(R.id.cpp_button_subtraction, "-"),
+ subtraction(R.id.cpp_button_subtraction, "−"),
percent(R.id.cpp_button_percent, "%"),
power(R.id.cpp_button_power, "^"),
diff --git a/android-app/src/main/res/layout/cpp_simple_button_subtraction.xml b/android-app/src/main/res/layout/cpp_simple_button_minus.xml
similarity index 91%
rename from android-app/src/main/res/layout/cpp_simple_button_subtraction.xml
rename to android-app/src/main/res/layout/cpp_simple_button_minus.xml
index 5ec8cd5c..9c17039b 100644
--- a/android-app/src/main/res/layout/cpp_simple_button_subtraction.xml
+++ b/android-app/src/main/res/layout/cpp_simple_button_minus.xml
@@ -24,4 +24,6 @@
\ No newline at end of file
+ xmlns:tools="http://schemas.android.com/tools"
+ a:text="−"
+ tools:ignore="HardcodedText" />
\ No newline at end of file
diff --git a/android-app/src/main/res/layout/cpp_simple_keyboard.xml b/android-app/src/main/res/layout/cpp_simple_keyboard.xml
index e4295a90..29dc52b9 100644
--- a/android-app/src/main/res/layout/cpp_simple_keyboard.xml
+++ b/android-app/src/main/res/layout/cpp_simple_keyboard.xml
@@ -95,7 +95,7 @@
-
+
diff --git a/android-app/src/main/res/layout/cpp_simple_keyboard_lockscreen.xml b/android-app/src/main/res/layout/cpp_simple_keyboard_lockscreen.xml
index 7a8abd54..cb64c518 100644
--- a/android-app/src/main/res/layout/cpp_simple_keyboard_lockscreen.xml
+++ b/android-app/src/main/res/layout/cpp_simple_keyboard_lockscreen.xml
@@ -95,7 +95,7 @@
-
+
diff --git a/android-app/src/main/res/layout/cpp_simple_keyboard_lockscreen_collapsed.xml b/android-app/src/main/res/layout/cpp_simple_keyboard_lockscreen_collapsed.xml
index 8205a8be..fbe250ec 100644
--- a/android-app/src/main/res/layout/cpp_simple_keyboard_lockscreen_collapsed.xml
+++ b/android-app/src/main/res/layout/cpp_simple_keyboard_lockscreen_collapsed.xml
@@ -59,7 +59,7 @@
-
+
diff --git a/android-app/src/main/res/layout/onscreen_keyboard.xml b/android-app/src/main/res/layout/onscreen_keyboard.xml
index 997d2783..ef5e6a5b 100644
--- a/android-app/src/main/res/layout/onscreen_keyboard.xml
+++ b/android-app/src/main/res/layout/onscreen_keyboard.xml
@@ -66,7 +66,7 @@
-
+
diff --git a/core/src/main/java/org/solovyev/android/calculator/math/MathType.java b/core/src/main/java/org/solovyev/android/calculator/math/MathType.java
index c7459c5f..5cd54c58 100644
--- a/core/src/main/java/org/solovyev/android/calculator/math/MathType.java
+++ b/core/src/main/java/org/solovyev/android/calculator/math/MathType.java
@@ -25,15 +25,13 @@ package org.solovyev.android.calculator.math;
import jscl.JsclMathEngine;
import jscl.NumeralBase;
import jscl.math.function.Constants;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
import org.solovyev.android.calculator.CalculatorParseException;
import org.solovyev.android.calculator.Locator;
import org.solovyev.common.JPredicate;
import org.solovyev.common.collections.Collections;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
@@ -82,16 +80,51 @@ public enum MathType {
}
},
- unary_operation(500, false, false, MathGroupType.operation, "-", "="),
- binary_operation(600, false, false, MathGroupType.operation, "-", "+", "*", "×", "∙", "/", "^") {
+ unary_operation(500, false, false, MathGroupType.operation, "−", "-", "=") {
+ @Nullable
@Override
protected String getSubstituteToJscl(@Nonnull String match) {
- if (match.equals("×") || match.equals("∙")) {
- return "*";
+ if (match.equals("−")) {
+ return "-";
} else {
return null;
}
}
+
+ @Nullable
+ @Override
+ protected String getSubstituteFromJscl(@Nonnull String match) {
+ if (match.equals("-")) {
+ return "−";
+ } else {
+ return null;
+ }
+ }
+ },
+
+ binary_operation(600, false, false, MathGroupType.operation, "−", "-", "+", "*", "×", "∙", "/", "^") {
+ @Nullable
+ @Override
+ protected String getSubstituteFromJscl(@Nonnull String match) {
+ if (match.equals("-")) {
+ return "−";
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ protected String getSubstituteToJscl(@Nonnull String match) {
+ switch (match) {
+ case "×":
+ case "∙":
+ return "*";
+ case "−":
+ return "-";
+ default:
+ return null;
+ }
+ }
},
open_group_symbol(800, true, false, MathGroupType.other, "[", "(", "{") {
@@ -149,7 +182,7 @@ public enum MathType {
digit(1125, true, true, MathGroupType.number) {
- private final List tokens = new ArrayList(16);
+ private final List tokens = new ArrayList<>(16);
{
for (Character character : NumeralBase.hex.getAcceptableCharacters()) {
tokens.add(character.toString());