Tweaking spacing and layout of AllApps/Customize in portrait.

- Also added workaround for tab label not being initially selected
- Added fix for initial layout of PagedViews preventing side pages from having proper alpha
- Marking widget dims format string as not translatable

Change-Id: I74a5410b88e2766816a87b14e64058b4288c214d
diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java
index 368306f..aff8ddd 100644
--- a/src/com/android/launcher2/AllAppsTabbed.java
+++ b/src/com/android/launcher2/AllAppsTabbed.java
@@ -127,6 +127,9 @@
             }
         });
 
+        // TEMP: Working around a bug in tab host where the current tab does not initially have a
+        // highlight on it by selecting something else, then selecting the actual tab we want..
+        setCurrentTab(1);
         setCurrentTab(0);
 
         // It needs to be INVISIBLE so that it will be measured in the layout.
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 989ee25..d7c2f5b 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -350,6 +350,9 @@
                 }
             });
     
+            // TEMP: Working around a bug in tab host where the current tab does not initially have
+            // a highlight on it by selecting something else, then selecting the actual tab we want..
+            mHomeCustomizationDrawer.setCurrentTab(1);
             mHomeCustomizationDrawer.setCurrentTab(0);
         }
         setupViews();
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 8332053..97bbbdf 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -406,6 +406,14 @@
                     int halfChildWidth = (childWidth / 2);
                     int childCenter = getChildOffset(i) + halfChildWidth;
 
+                    // On the first layout, we may not have a width nor a proper offset, so for now
+                    // we should just assume full page width (and calculate the offset according to
+                    // that).
+                    if (childWidth <= 0) {
+                        childWidth = getMeasuredWidth();
+                        childCenter = (i * childWidth) + (childWidth / 2);
+                    }
+
                     int d = halfChildWidth;
                     int distanceFromScreenCenter = childCenter - screenCenter;
                     if (distanceFromScreenCenter > 0) {
@@ -419,6 +427,9 @@
                     }
                     d += mPageSpacing;
 
+                    // Preventing potential divide-by-zero
+                    d = Math.max(1, d);
+
                     float dimAlpha = (float) (Math.abs(distanceFromScreenCenter)) / d;
                     dimAlpha = Math.max(0.0f, Math.min(1.0f, (dimAlpha * dimAlpha)));
                     float alpha = 1.0f - dimAlpha;
@@ -1237,6 +1248,7 @@
             // Load any pages that are necessary for the current window of views
             loadAssociatedPages(mCurrentPage);
             mDirtyPageAlpha = true;
+            updateAdjacentPagesAlpha();
             requestLayout();
         }
     }
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index ac5c1b9..0d07048 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -717,8 +717,10 @@
             finalAlpha = 0.0f;
             extraShrinkFactor = 0.1f;
         } else if (shrinkPosition == ShrinkPosition.SHRINK_TO_MIDDLE) {
-             newY = screenHeight / 2 - scaledPageHeight / 2;
-             finalAlpha = 1.0f;
+            newY = screenHeight / 2 - scaledPageHeight / 2;
+            finalAlpha = 1.0f;
+        } else if (shrinkPosition == ShrinkPosition.SHRINK_TO_TOP) {
+            newY = screenHeight / 10;
         }
 
         // We animate all the screens to the centered position in workspace