Reattach header view after DPAD scroll.

A header view that was scrolled off screen using the DPAD would not be
reattached properly when scrolled back into view, due to the flag
recycledHeaderFooter. Solved this by using detachViewFromParent()
instead of removeViewInLayout(). Compare to
AbsListView.trackMotionScroll().

Change-Id: I0ac0ec0f9bf23bc62430c1f62ae7d1a8570b0a24
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index d2e55d9..6129ca3 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -2919,11 +2919,9 @@
             while (first.getBottom() < listTop) {
                 AbsListView.LayoutParams layoutParams = (LayoutParams) first.getLayoutParams();
                 if (recycleBin.shouldRecycleViewType(layoutParams.viewType)) {
-                    detachViewFromParent(first);
                     recycleBin.addScrapView(first, mFirstPosition);
-                } else {
-                    removeViewInLayout(first);
                 }
+                detachViewFromParent(first);
                 first = getChildAt(0);
                 mFirstPosition++;
             }
@@ -2950,11 +2948,9 @@
             while (last.getTop() > listBottom) {
                 AbsListView.LayoutParams layoutParams = (LayoutParams) last.getLayoutParams();
                 if (recycleBin.shouldRecycleViewType(layoutParams.viewType)) {
-                    detachViewFromParent(last);
                     recycleBin.addScrapView(last, mFirstPosition+lastIndex);
-                } else {
-                    removeViewInLayout(last);
                 }
+                detachViewFromParent(last);
                 last = getChildAt(--lastIndex);
             }
         }