Fixed close tab NPE

 Bug: 3293676
 This was caused by two problems. The first was the code to determine
 the child draw order could break. This cleans up the logic to hopefully
 be clearer and fixes the problem, it is more robust. The root cause
 though was that you could have two tabs pending being closed due to
 a broken animation. This simply removes the animations completely for
 now, how tab open/close should be animated can be addressed in another CL

Change-Id: I06d993a093621bd086ae89162e332357c0e4d94c
diff --git a/src/com/android/browser/TabScrollView.java b/src/com/android/browser/TabScrollView.java
index 04ed5a3..f501e64 100644
--- a/src/com/android/browser/TabScrollView.java
+++ b/src/com/android/browser/TabScrollView.java
@@ -124,7 +124,6 @@
 
     void addTab(View tab) {
         mContentView.addView(tab);
-        animateIn(tab);
         tab.setActivated(false);
     }
 
@@ -135,7 +134,7 @@
         } else if (ix < mSelected) {
             mSelected--;
         }
-        animateOut(tab);
+        mContentView.removeView(tab);
     }
 
     private void ensureChildVisible(View child) {
@@ -172,25 +171,27 @@
         }
     }
 
-    private void animateIn(View tab) {
-        ObjectAnimator animator = ObjectAnimator.ofInt(tab, "TranslationX", 500, 0);
-        animator.setDuration(mAnimationDuration);
-        animator.start();
-    }
-
-    private void animateOut(final View tab) {
-        ObjectAnimator animator = ObjectAnimator.ofInt(
-                tab, "TranslationX", 0, getScrollX() - tab.getRight());
-        animator.setDuration(mAnimationDuration);
-        animator.addListener(new AnimatorListenerAdapter() {
-            @Override
-            public void onAnimationEnd(Animator animation) {
-                mContentView.removeView(tab);
-            }
-        });
-        animator.setInterpolator(new AccelerateInterpolator());
-        animator.start();
-    }
+// TODO: These animations are broken and don't work correctly, removing for now
+//       as animateOut is actually causing issues
+//    private void animateIn(View tab) {
+//        ObjectAnimator animator = ObjectAnimator.ofInt(tab, "TranslationX", 500, 0);
+//        animator.setDuration(mAnimationDuration);
+//        animator.start();
+//    }
+//
+//    private void animateOut(final View tab) {
+//        ObjectAnimator animator = ObjectAnimator.ofInt(
+//                tab, "TranslationX", 0, getScrollX() - tab.getRight());
+//        animator.setDuration(mAnimationDuration);
+//        animator.addListener(new AnimatorListenerAdapter() {
+//            @Override
+//            public void onAnimationEnd(Animator animation) {
+//                mContentView.removeView(tab);
+//            }
+//        });
+//        animator.setInterpolator(new AccelerateInterpolator());
+//        animator.start();
+//    }
 
     private void animateScroll(int newscroll) {
         ObjectAnimator animator = ObjectAnimator.ofInt(this, "scroll", getScrollX(), newscroll);