summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Boehm <hboehm@google.com>2015-10-11 13:43:16 (GMT)
committerAndroid Git Automerger <android-git-automerger@android.com>2015-10-11 13:43:16 (GMT)
commitb7be7bfdec8d4823a448c45fe164e9640ea3e83f (patch)
tree20d1abda14e1ed86455c555d9989f0d1c5fe9a8b
parentbd905403f4b4d71bc9c361baf62c91c4f09401c7 (diff)
parentb7bd34886fb39401b6e38ad97634655a0d025902 (diff)
downloadandroid_packages_apps_ExactCalculator-b7be7bfdec8d4823a448c45fe164e9640ea3e83f.zip
android_packages_apps_ExactCalculator-b7be7bfdec8d4823a448c45fe164e9640ea3e83f.tar.gz
android_packages_apps_ExactCalculator-b7be7bfdec8d4823a448c45fe164e9640ea3e83f.tar.bz2
am b7bd3488: Merge "Announce when formula has been completely deleted." into mnc-dr-dev
* commit 'b7bd34886fb39401b6e38ad97634655a0d025902': Announce when formula has been completely deleted.
-rw-r--r--res/values/strings.xml15
-rw-r--r--src/com/android/calculator2/Calculator.java13
2 files changed, 20 insertions, 8 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 959b979..50bc983 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -118,6 +118,10 @@
<string name="eq" translatable="false">=</string>
<!-- Clear button to clear the currently entered expression. [CHAR_LIMIT=4] -->
<string name="clr">clr</string>
+ <!--
+ Announced when all characters are removed from Formula, e.g. after clear. [CHAR_LIMIT=NONE]
+ -->
+ <string name="cleared">cleared</string>
<!-- Delete button to remove last entered token. [CHAR_LIMIT=4] -->
<string name="del">del</string>
<!-- Toggle button to show/hide inverse functions. [CHAR_LIMIT=4] -->
@@ -197,9 +201,12 @@
<!-- Content description for '=' button. [CHAR_LIMIT=NONE] -->
<string name="desc_eq">equals</string>
- <!-- Content description for "clr" button. [CHAR_LIMIT=NONE] -->
+ <!-- Content description for "clr" button. Deletes entire formula. [CHAR_LIMIT=NONE] -->
<string name="desc_clr">clear</string>
- <!-- Content description for "del" button. [CHAR_LIMIT=NONE] -->
+ <!--
+ Content description for "del" button. Deletes single character. Should differ
+ from desc_clr. [CHAR_LIMIT=NONE]
+ -->
<string name="desc_del">delete</string>
<!-- Content description for "inv" button to show inverse functions. [CHAR_LIMIT=NONE] -->
<string name="desc_inv_off">show inverse functions</string>
@@ -221,7 +228,7 @@
be used, e.g. "Division by 0". Exceeding the limit will result in a truncated string.
[CHAR_LIMIT=20]
- -->
+ -->
<string name="error_zero_divide">Can\'t divide by 0</string>
<!-- Toast shown when text is copied to the clipboard. [CHAR_LIMIT=40] -->
@@ -239,7 +246,7 @@
"timing out".
[CHAR_LIMIT=40]
- -->
+ -->
<string name="ok_remove_timeout">Use longer timeouts</string>
<!-- Button label to dismiss informative text message. [CHAR_LIMIT=40] -->
<string name="dismiss">Dismiss</string>
diff --git a/src/com/android/calculator2/Calculator.java b/src/com/android/calculator2/Calculator.java
index 035f5b9..99ef032 100644
--- a/src/com/android/calculator2/Calculator.java
+++ b/src/com/android/calculator2/Calculator.java
@@ -454,7 +454,7 @@ public class Calculator extends Activity
if (KeyMaps.isBinary(id) || KeyMaps.isSuffix(id)) {
mEvaluator.collapse();
} else {
- announceClearForAccessibility();
+ announceClearedForAccessibility();
mEvaluator.clear();
}
setState(CalculatorState.INPUT);
@@ -653,6 +653,11 @@ public class Calculator extends Activity
} else {
mEvaluator.delete();
}
+ if (mEvaluator.getExpr().isEmpty()
+ && (mUnprocessedChars == null || mUnprocessedChars.isEmpty())) {
+ // Resulting formula won't be announced, since it's empty.
+ announceClearedForAccessibility();
+ }
redisplayAfterFormulaChange();
}
@@ -710,8 +715,8 @@ public class Calculator extends Activity
animatorSet.start();
}
- private void announceClearForAccessibility() {
- mResultText.announceForAccessibility(getResources().getString(R.string.desc_clr));
+ private void announceClearedForAccessibility() {
+ mResultText.announceForAccessibility(getResources().getString(R.string.cleared));
}
private void onClear() {
@@ -719,7 +724,7 @@ public class Calculator extends Activity
return;
}
cancelIfEvaluating(true);
- announceClearForAccessibility();
+ announceClearedForAccessibility();
reveal(mCurrentButton, R.color.calculator_accent_color, new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {