Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2290874 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Initialize the RecyclerView as INVISIBLE." into ub-calculator-euler

parents 8cd0df82 efa259a7
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -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;
    }

+7 −5
Original line number Diff line number Diff line
@@ -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