diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2016-11-23 23:33:12 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-11-23 23:33:12 +0000 |
commit | a22908741beddd5b62a927f6aeae4bafce0bafc6 (patch) | |
tree | 914cf08a952778c115aff175b8dd78c95ffad1c1 /src | |
parent | 8cd0df82b6e66cd3fdddaeba3d7d6d6cd84b76e6 (diff) | |
parent | efa259a77ebd74199e1f02723f49aba1c810a9a6 (diff) | |
download | android_packages_apps_ExactCalculator-a22908741beddd5b62a927f6aeae4bafce0bafc6.tar.gz android_packages_apps_ExactCalculator-a22908741beddd5b62a927f6aeae4bafce0bafc6.tar.bz2 android_packages_apps_ExactCalculator-a22908741beddd5b62a927f6aeae4bafce0bafc6.zip |
Merge "Initialize the RecyclerView as INVISIBLE." into ub-calculator-euler
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/calculator2/DragController.java | 9 | ||||
-rw-r--r-- | src/com/android/calculator2/HistoryFragment.java | 12 |
2 files changed, 13 insertions, 8 deletions
diff --git a/src/com/android/calculator2/DragController.java b/src/com/android/calculator2/DragController.java index 4cc755e..6fb1837 100644 --- a/src/com/android/calculator2/DragController.java +++ b/src/com/android/calculator2/DragController.java @@ -86,6 +86,9 @@ public final class DragController { public void animateViews(float yFraction, RecyclerView recyclerView, int itemCount) { final HistoryAdapter.ViewHolder vh = (HistoryAdapter.ViewHolder) recyclerView.findViewHolderForAdapterPosition(0); + if (yFraction > 0) { + recyclerView.setVisibility(View.VISIBLE); + } if (vh != null && !EvaluatorStateUtils.isDisplayEmpty(mEvaluator)) { final CalculatorFormula formula = vh.getFormula(); final CalculatorResult result = vh.getResult(); @@ -154,10 +157,10 @@ public final class DragController { } /** - * Reset all initialized values whenever the History fragment is closed because the - * DisplayState may change. + * Reset all initialized values and set recyclerview to INVISIBLE to avoid flickering. */ - public void resetAnimationInitialized() { + public void initializeAnimation(RecyclerView recyclerView) { + recyclerView.setVisibility(View.INVISIBLE); mAnimationInitialized = false; } diff --git a/src/com/android/calculator2/HistoryFragment.java b/src/com/android/calculator2/HistoryFragment.java index 1d13a98..b8682ce 100644 --- a/src/com/android/calculator2/HistoryFragment.java +++ b/src/com/android/calculator2/HistoryFragment.java @@ -51,8 +51,6 @@ public class HistoryFragment extends Fragment { public void onClosed() { // TODO: only cancel historical evaluations mEvaluator.cancelAll(true); - - mDragController.resetAnimationInitialized(); } @Override @@ -168,10 +166,14 @@ public class HistoryFragment extends Fragment { } mAdapter.notifyDataSetChanged(); + } + + @Override + public void onStart() { + super.onStart(); - // Initialize the current expression element to dimensions that match the display to - // avoid flickering and scrolling when elements expand on drag start. - mDragController.animateViews(1.0f, mRecyclerView, mAdapter.getItemCount()); + // The orientation may have changed. + mDragController.initializeAnimation(mRecyclerView); } @Override |