Fix result overlap, clear logic, display bugs, etc.

Adjust result padding to prevent overlapping with options menu,
resulting in inability to access options menu.

Reset state correctly after clear, preventing occasional crashes.
Do this at end of animation to prevent animation glitches.
Have clear but the display in a state in which COPY does
nothing interesting.

Treat a not-known-to-be-exact zero result better.  Before this
we displayed it as just "0", giving the mistaken impression of
exactness.  It is unclear whether we should display it as "0.00000000"
or add an exponent to indicate the real evaluation precision.
The former probably works better for beginners; the latter for
experts.  We now do the former, which is probably right.

Also correctly save and restore not-yet analyzed characters.

Change-Id: Iac46d0d3b5a06f61beb6af7d4f0910e43284f52b
diff --git a/src/com/android/calculator2/CalculatorResult.java b/src/com/android/calculator2/CalculatorResult.java
index 6fac5a6..279c75e 100644
--- a/src/com/android/calculator2/CalculatorResult.java
+++ b/src/com/android/calculator2/CalculatorResult.java
@@ -64,6 +64,9 @@
     private Evaluator mEvaluator;
     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.
     private int mCurrentPos;// Position of right of display relative
                             // to decimal point, in pixels.
                             // Large positive values mean the decimal
@@ -193,6 +196,7 @@
     }
 
     void displayError(int resourceId) {
+        mValid = true;
         mScrollable = false;
         setText(resourceId);
     }
@@ -201,6 +205,7 @@
 
     // Return entire result (within reason) up to current displayed precision.
     public String getFullText() {
+        if (!mValid) return "";
         if (!mScrollable) return getText().toString();
         int currentCharPos = getCurrentCharPos();
         return KeyMaps.translateResult(
@@ -248,6 +253,7 @@
     }
 
     void clear() {
+        mValid = false;
         setText("");
     }
 
@@ -267,6 +273,7 @@
         } else {
             setText(result);
         }
+        mValid = true;
         mScrollable = true;
     }