summaryrefslogtreecommitdiffstats
path: root/src/com/android/calculator2/Evaluator.java
diff options
context:
space:
mode:
authorJustin Klaassen <justinklaassen@google.com>2015-05-07 10:30:57 -0700
committerJustin Klaassen <justinklaassen@google.com>2015-05-07 12:18:35 -0700
commitecc69fd8b95a5910ad7e8a934da9700a087fe050 (patch)
tree4a2cdafbe806fce8c03578d73a52142e3a907231 /src/com/android/calculator2/Evaluator.java
parenta544b64a5dc91d1439179bd4c0e1183a7624f612 (diff)
downloadandroid_packages_apps_ExactCalculator-ecc69fd8b95a5910ad7e8a934da9700a087fe050.tar.gz
android_packages_apps_ExactCalculator-ecc69fd8b95a5910ad7e8a934da9700a087fe050.tar.bz2
android_packages_apps_ExactCalculator-ecc69fd8b95a5910ad7e8a934da9700a087fe050.zip
Fix CHAR_LIMIT for strings
Bug: 20877857 Bug: 20815563 - Condensed strings to one string.xml with translatable="false". - Made functions and digits NOT localized. - Switched to U+2007 character for unknown digits. Change-Id: I51a108309ccfa9c40edd6f87f9e052ba7ee25e3a
Diffstat (limited to 'src/com/android/calculator2/Evaluator.java')
-rw-r--r--src/com/android/calculator2/Evaluator.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/com/android/calculator2/Evaluator.java b/src/com/android/calculator2/Evaluator.java
index 1d164b3..3b393ef 100644
--- a/src/com/android/calculator2/Evaluator.java
+++ b/src/com/android/calculator2/Evaluator.java
@@ -110,6 +110,7 @@ import java.util.Set;
import java.util.TimeZone;
class Evaluator {
+
private final Calculator mCalculator;
private final CalculatorResult mResult; // The result display View
private CalculatorExpr mExpr; // Current calculator expression
@@ -128,13 +129,16 @@ class Evaluator {
private boolean mDegreeMode; // Currently in degree (not radian) mode
private final Handler mTimeoutHandler;
- static final char MINUS = '\u2212';
-
static final BigInteger BIG_MILLION = BigInteger.valueOf(1000000);
-
- private final char decimalPt =
- DecimalFormatSymbols.getInstance().getDecimalSeparator();
+ /**
+ * Character used as a placeholder for digits that are currently unknown in a result that is
+ * being computed.
+ * <p/>
+ * Note: the character must correspond closely to the width of a digit, otherwise the UI will
+ * visibly shift once the computation is finished.
+ */
+ private static final char CHAR_DIGIT_UNKNOWN = '\u2007';
private static final int EXTRA_DIGITS = 20;
// Extra computed digits to minimize probably we will have
@@ -578,11 +582,8 @@ class Evaluator {
// Return a string with n placeholder characters.
private String getPadding(int n) {
StringBuilder padding = new StringBuilder();
- char something =
- mCalculator.getResources()
- .getString(R.string.guessed_digit).charAt(0);
for (int i = 0; i < n; ++i) {
- padding.append(something);
+ padding.append(CHAR_DIGIT_UNKNOWN);
}
return padding.toString();
}