Loading src/com/android/calculator2/Calculator.java +19 −7 Original line number Diff line number Diff line Loading @@ -445,13 +445,12 @@ public class Calculator extends Activity } } // Add the given button id to input expression. // If appropriate, clear the expression before doing so. private void addKeyToExpr(int id) { if (mCurrentState == CalculatorState.ERROR) { setState(CalculatorState.INPUT); } else if (mCurrentState == CalculatorState.RESULT) { if (KeyMaps.isBinary(id) || KeyMaps.isSuffix(id)) { /** * Switch to INPUT from RESULT state in response to input of the specified button_id. * View.NO_ID is treated as an incomplete function id. */ private void switchToInput(int button_id) { if (KeyMaps.isBinary(button_id) || KeyMaps.isSuffix(button_id)) { mEvaluator.collapse(); } else { announceClearedForAccessibility(); Loading @@ -459,6 +458,15 @@ public class Calculator extends Activity } setState(CalculatorState.INPUT); } // Add the given button id to input expression. // If appropriate, clear the expression before doing so. private void addKeyToExpr(int id) { if (mCurrentState == CalculatorState.ERROR) { setState(CalculatorState.INPUT); } else if (mCurrentState == CalculatorState.RESULT) { switchToInput(id); } if (!mEvaluator.append(id)) { // TODO: Some user visible feedback? } Loading Loading @@ -916,6 +924,10 @@ public class Calculator extends Activity int current = 0; int len = moreChars.length(); boolean lastWasDigit = false; if (mCurrentState == CalculatorState.RESULT && len != 0) { // Clear display immediately for incomplete function name. switchToInput(KeyMaps.keyForChar(moreChars.charAt(current))); } while (current < len) { char c = moreChars.charAt(current); int k = KeyMaps.keyForChar(c); Loading Loading
src/com/android/calculator2/Calculator.java +19 −7 Original line number Diff line number Diff line Loading @@ -445,13 +445,12 @@ public class Calculator extends Activity } } // Add the given button id to input expression. // If appropriate, clear the expression before doing so. private void addKeyToExpr(int id) { if (mCurrentState == CalculatorState.ERROR) { setState(CalculatorState.INPUT); } else if (mCurrentState == CalculatorState.RESULT) { if (KeyMaps.isBinary(id) || KeyMaps.isSuffix(id)) { /** * Switch to INPUT from RESULT state in response to input of the specified button_id. * View.NO_ID is treated as an incomplete function id. */ private void switchToInput(int button_id) { if (KeyMaps.isBinary(button_id) || KeyMaps.isSuffix(button_id)) { mEvaluator.collapse(); } else { announceClearedForAccessibility(); Loading @@ -459,6 +458,15 @@ public class Calculator extends Activity } setState(CalculatorState.INPUT); } // Add the given button id to input expression. // If appropriate, clear the expression before doing so. private void addKeyToExpr(int id) { if (mCurrentState == CalculatorState.ERROR) { setState(CalculatorState.INPUT); } else if (mCurrentState == CalculatorState.RESULT) { switchToInput(id); } if (!mEvaluator.append(id)) { // TODO: Some user visible feedback? } Loading Loading @@ -916,6 +924,10 @@ public class Calculator extends Activity int current = 0; int len = moreChars.length(); boolean lastWasDigit = false; if (mCurrentState == CalculatorState.RESULT && len != 0) { // Clear display immediately for incomplete function name. switchToInput(KeyMaps.keyForChar(moreChars.charAt(current))); } while (current < len) { char c = moreChars.charAt(current); int k = KeyMaps.keyForChar(c); Loading