From d916fe4cbd1f749c33c1cca7970bce59050c735a Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Wed, 23 May 2018 08:25:33 -0700 Subject: Import translations. DO NOT MERGE Auto-generated-cl: translation import Bug: 64712476 Change-Id: Idff7ab7700bd2af33eb35120f97faa5fedd76b03 --- res/values-bn/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/values-bn/strings.xml b/res/values-bn/strings.xml index 7cd4318..1387b25 100644 --- a/res/values-bn/strings.xml +++ b/res/values-bn/strings.xml @@ -75,7 +75,7 @@ "(±১ শেষের ডিজিটের মধ্যে)" "লিডিং সংখ্যায় উত্তর" "ভগ্নাংশ হিসাবে উত্তর" - "মুক্ত উৎস লাইসেন্সগুলি" + "ওপেন সোর্স লাইসেন্স" "ইতিহাস" "সাফ করুন" "ইতিহাস" -- cgit v1.2.3 From bdfd38cfcb497efc5c3dd5e945909ee34878318a Mon Sep 17 00:00:00 2001 From: Annie Chin Date: Thu, 2 Nov 2017 16:47:43 -0700 Subject: Refuse to open history if in ANIMATE state. -Hopefully addresses the failing assertion in isResultLayout without any further defensive fixes. Bug: 34711428 Bug: 35316164 Bug: 79182188 Test: Swipe down history while an error evaluation is in progress. No longer crashes. Change-Id: I7e924deb13c9cc4ca2487224d59d86a046ca019b (cherry picked from b5cfb17556050d977d2f9aedba29923cff44aa32) --- src/com/android/calculator2/Calculator.java | 21 ++++++++++++++------- src/com/android/calculator2/DragLayout.java | 17 ++++++++--------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/com/android/calculator2/Calculator.java b/src/com/android/calculator2/Calculator.java index 392447c..81ab1f6 100644 --- a/src/com/android/calculator2/Calculator.java +++ b/src/com/android/calculator2/Calculator.java @@ -535,9 +535,6 @@ public class Calculator extends Activity } public boolean isResultLayout() { - if (mCurrentState == CalculatorState.ANIMATE) { - throw new AssertionError("impossible state"); - } // Note that ERROR has INPUT, not RESULT layout. return mCurrentState == CalculatorState.INIT_FOR_RESULT || mCurrentState == CalculatorState.RESULT; @@ -1339,7 +1336,14 @@ public class Calculator extends Activity */ private boolean prepareForHistory() { if (mCurrentState == CalculatorState.ANIMATE) { - throw new AssertionError("onUserInteraction should have ended animation"); + // End the current animation and signal that preparation has failed. + // onUserInteraction is unreliable and onAnimationEnd() is asynchronous, so we + // aren't guaranteed to be out of the ANIMATE state by the time prepareForHistory is + // called. + if (mCurrentAnimator != null) { + mCurrentAnimator.end(); + } + return false; } else if (mCurrentState == CalculatorState.EVALUATE) { // Cancel current evaluation cancelIfEvaluating(true /* quiet */ ); @@ -1366,12 +1370,15 @@ public class Calculator extends Activity } private void showHistoryFragment() { - final FragmentManager manager = getFragmentManager(); - if (manager == null || manager.isDestroyed()) { + if (getHistoryFragment() != null) { + // If the fragment already exists, do nothing. return; } - if (getHistoryFragment() != null || !prepareForHistory()) { + final FragmentManager manager = getFragmentManager(); + if (manager == null || manager.isDestroyed() || !prepareForHistory()) { + // If the history fragment can not be shown, close the draglayout. + mDragLayout.setClosed(); return; } diff --git a/src/com/android/calculator2/DragLayout.java b/src/com/android/calculator2/DragLayout.java index e34c4da..74b0a8e 100644 --- a/src/com/android/calculator2/DragLayout.java +++ b/src/com/android/calculator2/DragLayout.java @@ -209,14 +209,11 @@ public class DragLayout extends ViewGroup { return mIsOpen; } - private void setClosed() { - if (mIsOpen) { - mIsOpen = false; - mHistoryFrame.setVisibility(View.INVISIBLE); - - if (mCloseCallback != null) { - mCloseCallback.onClose(); - } + public void setClosed() { + mIsOpen = false; + mHistoryFrame.setVisibility(View.INVISIBLE); + if (mCloseCallback != null) { + mCloseCallback.onClose(); } } @@ -350,7 +347,9 @@ public class DragLayout extends ViewGroup { settleToOpen = releasedChild.getTop() > -(mVerticalRange / 2); } - if (mDragHelper.settleCapturedViewAt(0, settleToOpen ? 0 : -mVerticalRange)) { + // If the view is not visible, then settle it closed, not open. + if (mDragHelper.settleCapturedViewAt(0, settleToOpen && mIsOpen ? 0 + : -mVerticalRange)) { ViewCompat.postInvalidateOnAnimation(DragLayout.this); } } -- cgit v1.2.3