Initial changes to restore AllApps.

- Removes unused all apps code due to dynamic grid/spacing
- Attempts to use CellLayout instead of PagedViewCellLayout

Change-Id: I3c49bca9fc35dfeaf250591fd63bc7f36119968f
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 514ce93..76c9a32 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -54,6 +54,14 @@
 
 import java.util.ArrayList;
 
+interface Page {
+    public int getPageChildCount();
+    public View getChildOnPageAt(int i);
+    public void removeAllViewsOnPage();
+    public void removeViewOnPageAt(int i);
+    public int indexOfChildOnPage(View v);
+}
+
 /**
  * An abstraction of the original Workspace which supports browsing through a
  * sequential list of "pages"
@@ -196,6 +204,7 @@
     // Page Indicator
     private int mPageIndicatorViewId;
     private PageIndicator mPageIndicator;
+    private boolean mAllowPagedViewAnimations = true;
 
     // The viewport whether the pages are to be contained (the actual view may be larger than the
     // viewport)
@@ -209,6 +218,7 @@
     protected int REORDERING_ZOOM_IN_OUT_DURATION = 250;
     private int REORDERING_SIDE_PAGE_HOVER_TIMEOUT = 80;
     private float mMinScale = 1f;
+    private boolean mUseMinScale = false;
     protected View mDragView;
     protected AnimatorSet mZoomInOutAnim;
     private Runnable mSidePageHoverRunnable;
@@ -321,14 +331,14 @@
         ViewGroup parent = (ViewGroup) getParent();
         if (mPageIndicator == null && mPageIndicatorViewId > -1) {
             mPageIndicator = (PageIndicator) parent.findViewById(mPageIndicatorViewId);
-            mPageIndicator.removeAllMarkers();
+            mPageIndicator.removeAllMarkers(mAllowPagedViewAnimations);
 
             ArrayList<Integer> markers = new ArrayList<Integer>();
             for (int i = 0; i < getChildCount(); ++i) {
                 markers.add(getPageIndicatorMarker(i));
             }
 
-            mPageIndicator.addMarkers(markers);
+            mPageIndicator.addMarkers(markers, mAllowPagedViewAnimations);
             mPageIndicator.setOnClickListener((Launcher) getContext());
         }
     }
@@ -374,6 +384,7 @@
 
     public void setMinScale(float f) {
         mMinScale = f;
+        mUseMinScale = true;
         requestLayout();
     }
 
@@ -723,10 +734,17 @@
         // viewport, we can be at most one and a half screens offset once we scale down
         DisplayMetrics dm = getResources().getDisplayMetrics();
         int maxSize = Math.max(dm.widthPixels, dm.heightPixels);
-        int parentWidthSize = (int) (1.5f * maxSize);
-        int parentHeightSize = maxSize;
-        int scaledWidthSize = (int) (parentWidthSize / mMinScale);
-        int scaledHeightSize = (int) (parentHeightSize / mMinScale);
+        int parentWidthSize, parentHeightSize;
+        int scaledWidthSize, scaledHeightSize;
+        if (mUseMinScale) {
+            parentWidthSize = (int) (1.5f * maxSize);
+            parentHeightSize = maxSize;
+            scaledWidthSize = (int) (parentWidthSize / mMinScale);
+            scaledHeightSize = (int) (parentHeightSize / mMinScale);
+        } else {
+            scaledWidthSize = widthSize;
+            scaledHeightSize = heightSize;
+        }
         mViewport.set(0, 0, widthSize, heightSize);
 
         if (widthMode == MeasureSpec.UNSPECIFIED || heightMode == MeasureSpec.UNSPECIFIED) {
@@ -786,8 +804,13 @@
                 childWidthMode = MeasureSpec.EXACTLY;
                 childHeightMode = MeasureSpec.EXACTLY;
 
-                childWidth = getViewportWidth();
-                childHeight = getViewportHeight();
+                if (mUseMinScale) {
+                    childWidth = getViewportWidth();
+                    childHeight = getViewportHeight();
+                } else {
+                    childWidth = widthSize - getPaddingLeft() - getPaddingRight();
+                    childHeight = heightSize - getPaddingTop() - getPaddingBottom();
+                }
             }
 
             final int childWidthMeasureSpec =
@@ -930,13 +953,22 @@
         }
     }
 
+    protected void enablePagedViewAnimations() {
+        mAllowPagedViewAnimations = true;
+
+    }
+    protected void disablePagedViewAnimations() {
+        mAllowPagedViewAnimations = false;
+    }
+
     @Override
     public void onChildViewAdded(View parent, View child) {
         // Update the page indicator, we don't update the page indicator as we
         // add/remove pages
         if (mPageIndicator != null && !isReordering(false)) {
             int pageIndex = indexOfChild(child);
-            mPageIndicator.addMarker(pageIndex, getPageIndicatorMarker(pageIndex));
+            mPageIndicator.addMarker(pageIndex, getPageIndicatorMarker(pageIndex),
+                    mAllowPagedViewAnimations);
         }
 
         // This ensures that when children are added, they get the correct transforms / alphas
@@ -957,7 +989,7 @@
         // Update the page indicator, we don't update the page indicator as we
         // add/remove pages
         if (mPageIndicator != null && !isReordering(false)) {
-            mPageIndicator.removeMarker(index);
+            mPageIndicator.removeMarker(index, mAllowPagedViewAnimations);
         }
     }
 
@@ -987,7 +1019,7 @@
         // Update the page indicator, we don't update the page indicator as we
         // add/remove pages
         if (mPageIndicator != null) {
-            mPageIndicator.removeAllMarkers();
+            mPageIndicator.removeAllMarkers(mAllowPagedViewAnimations);
         }
 
         super.removeAllViewsInLayout();