Handle text animation in different display situations.
Bug: 31623549
Test: Manually pull down animation in 4 situations.
Create different controllers to handle when display
-Is empty
-Has input and quick result
-Has input but no quick result
-Is only displaying the result
Start using reverseLayout instead of stackFromEnd (had issues).
Change-Id: I72de7f22f8eda035ef82edeb44b57c06acc1be95
diff --git a/src/com/android/calculator2/CalculatorResult.java b/src/com/android/calculator2/CalculatorResult.java
index 29c20f7..bfabfce 100644
--- a/src/com/android/calculator2/CalculatorResult.java
+++ b/src/com/android/calculator2/CalculatorResult.java
@@ -113,6 +113,7 @@
private float mNoEllipsisCredit;
// Fraction of digit width saved by both replacing ellipsis with digit
// and avoiding scientific notation.
+ private boolean mShouldRequireResult = true;
private static final int MAX_WIDTH = 100;
// Maximum number of digits displayed.
public static final int MAX_LEADING_ZEROES = 6;
@@ -307,7 +308,7 @@
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
- if (mEvaluator != null) {
+ if (mEvaluator != null && mShouldRequireResult) {
final CalculatorExpr expr = mEvaluator.getExpr(mIndex);
if (expr != null && expr.hasInterestingOps()) {
mEvaluator.requireResult(mIndex, this, this);
@@ -315,6 +316,10 @@
}
}
+ public void setShouldRequireResult(boolean should) {
+ mShouldRequireResult = should;
+ }
+
// From Evaluator.CharMetricsInfo.
@Override
public float separatorChars(String s, int len) {