Merge "Use translucent decor theme attributes in Launcher3." into jb-ub-now-indigo-rose
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 07346f0..e3312d5 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -492,10 +492,12 @@
             int width, height;
             cellToPoint(fra.mCellX, fra.mCellY, mTempLocation);
             View child = getChildAt(fra.mCellX, fra.mCellY);
-            int centerX = mTempLocation[0] + mCellWidth / 2;
-            int centerY = mTempLocation[1] + previewOffset / 2 +
-                    child.getPaddingTop() + grid.folderBackgroundOffset;
+
             if (child != null) {
+                int centerX = mTempLocation[0] + mCellWidth / 2;
+                int centerY = mTempLocation[1] + previewOffset / 2 +
+                        child.getPaddingTop() + grid.folderBackgroundOffset;
+
                 // Draw outer ring, if it exists
                 if (FolderIcon.HAS_OUTER_RING) {
                     d = FolderRingAnimator.sSharedOuterRingDrawable;
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 6af3bea..2e29ae2 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -833,7 +833,7 @@
         if (mOnResumeState == State.WORKSPACE) {
             showWorkspace(false);
         } else if (mOnResumeState == State.APPS_CUSTOMIZE) {
-            showAllApps(false, AppsCustomizePagedView.ContentType.Applications);
+            showAllApps(false, AppsCustomizePagedView.ContentType.Applications, false);
         }
         mOnResumeState = State.NONE;
 
@@ -888,10 +888,7 @@
             // Resets the previous all apps icon press state
             mAppsCustomizeContent.resetDrawableState();
         }
-        // Reset AllApps to its initial state
-        if (mAppsCustomizeTabHost != null) {
-            mAppsCustomizeTabHost.reset();
-        }
+
         // It is possible that widgets can receive updates while launcher is not in the foreground.
         // Consequently, the widgets will be inflated in the orientation of the foreground activity
         // (framework issue). On resuming, we ensure that any widgets are inflated for the current
@@ -1156,7 +1153,7 @@
         widgetButton.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View arg0) {
-                showAllApps(true, AppsCustomizePagedView.ContentType.Widgets);
+                showAllApps(true, AppsCustomizePagedView.ContentType.Widgets, true);
             }
         });
         widgetButton.setOnTouchListener(getHapticFeedbackTouchListener());
@@ -2169,7 +2166,7 @@
                 final String shortcutClass = intent.getComponent().getClassName();
 
                 if (shortcutClass.equals(WidgetAdder.class.getName())) {
-                    showAllApps(true, AppsCustomizePagedView.ContentType.Widgets);
+                    showAllApps(true, AppsCustomizePagedView.ContentType.Widgets, true);
                     return;
                 } else if (shortcutClass.equals(MemoryDumpActivity.class.getName())) {
                     MemoryDumpActivity.startDump(this);
@@ -2259,7 +2256,7 @@
      * @param v The view that was clicked.
      */
     public void onClickAllAppsButton(View v) {
-        showAllApps(true, AppsCustomizePagedView.ContentType.Applications);
+        showAllApps(true, AppsCustomizePagedView.ContentType.Applications, true);
     }
 
     public void onTouchDownAllAppsButton(View v) {
@@ -3070,10 +3067,13 @@
     public void onWorkspaceShown(boolean animated) {
     }
 
-    void showAllApps(boolean animated,
-                     AppsCustomizePagedView.ContentType contentType) {
+    void showAllApps(boolean animated, AppsCustomizePagedView.ContentType contentType,
+                     boolean resetPageToZero) {
         if (mState != State.WORKSPACE) return;
 
+        if (resetPageToZero) {
+            mAppsCustomizeTabHost.reset();
+        }
         showAppsCustomizeHelper(animated, false, contentType);
         mAppsCustomizeTabHost.requestFocus();