Revert "Revert "Speed up All Apps -> Workspace transition""

- also, undo enabling hardware layers for
    scroll indicator, which could have caused
    slowness
- fix bug where scroll indicator was not seen
    after the first visit to all apps
- eliminate a some needless hardware layer redraws
- making items under All Apps invisible when we're
    in All Apps
- making workspace spaces invisible if their alpha is 0
    to prevent more hardware layer rebuilding

This reverts commit 9753d13c7bda09c1203c611ac6717021037f39c3.

Change-Id: Ib908ae0b456b2d4b8a171991a95f20aea4749da1
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 9a140d2..184ea7a 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -176,6 +176,8 @@
     private int mScrollIndicatorPaddingLeft;
     private int mScrollIndicatorPaddingRight;
     private boolean mHasScrollIndicator = true;
+    private boolean mShouldShowScrollIndicator = false;
+    private boolean mShouldShowScrollIndicatorImmediately = false;
     protected static final int sScrollIndicatorFadeInDuration = 150;
     protected static final int sScrollIndicatorFadeOutDuration = 650;
     protected static final int sScrollIndicatorFlashDuration = 650;
@@ -767,7 +769,8 @@
                 for (int i = getChildCount() - 1; i >= 0; i--) {
                     final View v = getPageAt(i);
 
-                    if (leftScreen <= i && i <= rightScreen) {
+                    if (leftScreen <= i && i <= rightScreen &&
+                            v.getAlpha() > ViewConfiguration.ALPHA_THRESHOLD) {
                         v.setVisibility(VISIBLE);
                         drawChild(canvas, v, drawingTime);
                     } else {
@@ -1705,9 +1708,12 @@
     }
 
     protected void showScrollingIndicator(boolean immediately) {
+        mShouldShowScrollIndicator = true;
+        mShouldShowScrollIndicatorImmediately = true;
         if (getChildCount() <= 1) return;
         if (!isScrollingIndicatorEnabled()) return;
 
+        mShouldShowScrollIndicator = false;
         getScrollingIndicator();
         if (mScrollIndicator != null) {
             // Fade the indicator in
@@ -1779,6 +1785,9 @@
         if (mScrollIndicator != null) {
             updateScrollingIndicatorPosition();
         }
+        if (mShouldShowScrollIndicator) {
+            showScrollingIndicator(mShouldShowScrollIndicatorImmediately);
+        }
     }
 
     private void updateScrollingIndicatorPosition() {
@@ -1805,7 +1814,6 @@
             indicatorPos += indicatorCenterOffset;
         }
         mScrollIndicator.setTranslationX(indicatorPos);
-        mScrollIndicator.invalidate();
     }
 
     public void showScrollIndicatorTrack() {