Consider error message invalid for ActionMode/ContextMenu operations.
Test: Manually verified that the floating menu never appears in error
states.
Fixes: 34888339
Change-Id: If240fb25f45d67df6562d3cd164ad5efbdf66842
diff --git a/src/com/android/calculator2/CalculatorResult.java b/src/com/android/calculator2/CalculatorResult.java
index a8ab291..1eede10 100644
--- a/src/com/android/calculator2/CalculatorResult.java
+++ b/src/com/android/calculator2/CalculatorResult.java
@@ -64,8 +64,7 @@
private boolean mScrollable = false;
// A scrollable result is currently displayed.
private boolean mValid = false;
- // The result holds something valid; either a a number or an error
- // message.
+ // The result holds a valid number (not an error message).
// A suffix of "Pos" denotes a pixel offset. Zero represents a scroll position
// in which the decimal point is just barely visible on the right of the display.
private int mCurrentPos;// Position of right of display relative to decimal point, in pixels.
@@ -596,7 +595,7 @@
@Override
public void onError(long index, int resourceId) {
mStoreToMemoryRequested = false;
- mValid = true;
+ mValid = false;
setLongClickable(false);
mScrollable = false;
final String msg = getContext().getString(resourceId);