Don't layout removed scrap views

This CL also changes the addView logic in demo LM. Previously, removed
views were not added. Now, RV takes care of this so LM can simply add them.

Bug: 17783492
Change-Id: I375405ef888fd43f9da0e1a1c13ae54bae381b44
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/widget/AnimatedRecyclerView.java b/samples/Support7Demos/src/com/example/android/supportv7/widget/AnimatedRecyclerView.java
index 1125685..50fe1e1 100644
--- a/samples/Support7Demos/src/com/example/android/supportv7/widget/AnimatedRecyclerView.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/widget/AnimatedRecyclerView.java
@@ -219,9 +219,7 @@
                 View v = recycler.getViewForPosition(mFirstPosition + i);
 
                 RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) v.getLayoutParams();
-                if (!mPredictiveAnimationsEnabled || !params.isItemRemoved()) {
-                    addView(v);
-                }
+                addView(v);
                 measureChild(v, 0, 0);
                 bottom = top + v.getMeasuredHeight();
                 v.layout(left, top, right, bottom);
@@ -230,7 +228,7 @@
                 }
             }
 
-            if (mAnimationsEnabled && mPredictiveAnimationsEnabled) {
+            if (mAnimationsEnabled && mPredictiveAnimationsEnabled && !state.isPreLayout()) {
                 // Now that we've run a full layout, figure out which views were not used
                 // (cached in previousViews). For each of these views, position it where
                 // it would go, according to its position relative to the visible
@@ -249,6 +247,9 @@
                         View view = previousViews.get(i).itemView;
                         RecyclerView.LayoutParams params =
                                 (RecyclerView.LayoutParams) view.getLayoutParams();
+                        if (params.isItemRemoved()) {
+                            continue;
+                        }
                         int position = params.getViewPosition();
                         int newTop;
                         if (position < mFirstPosition) {