Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7bd3488 authored by Hans Boehm's avatar Hans Boehm Committed by Android (Google) Code Review
Browse files

Merge "Announce when formula has been completely deleted." into mnc-dr-dev

parents 3d4a67d1 4d63cfce
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -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>
+9 −4
Original line number Diff line number Diff line
@@ -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) {