Merge "Close open folders before moving to -1" into jb-ub-now-indigo-rose
diff --git a/res/drawable-hdpi/ic_allapps.png b/res/drawable-hdpi/ic_allapps.png
index 073bb30..f55aabf 100644
--- a/res/drawable-hdpi/ic_allapps.png
+++ b/res/drawable-hdpi/ic_allapps.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_allapps_off.png b/res/drawable-hdpi/ic_allapps_off.png
deleted file mode 100644
index bbc4d7d..0000000
--- a/res/drawable-hdpi/ic_allapps_off.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_allapps_pressed.png b/res/drawable-hdpi/ic_allapps_pressed.png
index a43b9e1..bbc4d7d 100644
--- a/res/drawable-hdpi/ic_allapps_pressed.png
+++ b/res/drawable-hdpi/ic_allapps_pressed.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_allapps.png b/res/drawable-mdpi/ic_allapps.png
index 8c5efd7..d95f1bf 100644
--- a/res/drawable-mdpi/ic_allapps.png
+++ b/res/drawable-mdpi/ic_allapps.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_allapps_off.png b/res/drawable-mdpi/ic_allapps_off.png
deleted file mode 100644
index e24b9d7..0000000
--- a/res/drawable-mdpi/ic_allapps_off.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_allapps_pressed.png b/res/drawable-mdpi/ic_allapps_pressed.png
index 18375ab..e24b9d7 100644
--- a/res/drawable-mdpi/ic_allapps_pressed.png
+++ b/res/drawable-mdpi/ic_allapps_pressed.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_allapps.png b/res/drawable-xhdpi/ic_allapps.png
index 21c4252..0e4316c 100644
--- a/res/drawable-xhdpi/ic_allapps.png
+++ b/res/drawable-xhdpi/ic_allapps.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_allapps_off.png b/res/drawable-xhdpi/ic_allapps_off.png
deleted file mode 100644
index 2b13330..0000000
--- a/res/drawable-xhdpi/ic_allapps_off.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_allapps_pressed.png b/res/drawable-xhdpi/ic_allapps_pressed.png
index 3bbcbce..2b13330 100644
--- a/res/drawable-xhdpi/ic_allapps_pressed.png
+++ b/res/drawable-xhdpi/ic_allapps_pressed.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_allapps.png b/res/drawable-xxhdpi/ic_allapps.png
index 021832a..9d5d80c 100644
--- a/res/drawable-xxhdpi/ic_allapps.png
+++ b/res/drawable-xxhdpi/ic_allapps.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_allapps_off.png b/res/drawable-xxhdpi/ic_allapps_off.png
deleted file mode 100644
index b6a34a8..0000000
--- a/res/drawable-xxhdpi/ic_allapps_off.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_allapps_pressed.png b/res/drawable-xxhdpi/ic_allapps_pressed.png
index 9c7b636..b6a34a8 100644
--- a/res/drawable-xxhdpi/ic_allapps_pressed.png
+++ b/res/drawable-xxhdpi/ic_allapps_pressed.png
Binary files differ
diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml
index 86fc1ed..77ea2e9 100644
--- a/res/layout-land/launcher.xml
+++ b/res/layout-land/launcher.xml
@@ -57,7 +57,7 @@
         <!-- The Workspace cling must appear under the AppsCustomizePagedView below to ensure
              that it is still visible during the transition to AllApps and doesn't overlay on
              top of that view. -->
-        <FrameLayout
+        <com.android.launcher3.ScrimView
             android:id="@+id/cling_scrim"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml
index ef2f3ac..6fbf7c7 100644
--- a/res/layout-port/launcher.xml
+++ b/res/layout-port/launcher.xml
@@ -64,7 +64,7 @@
         <!-- The Workspace cling must appear under the AppsCustomizePagedView below to ensure
              that it is still visible during the transition to AllApps and doesn't overlay on
              top of that view. -->
-        <FrameLayout
+        <com.android.launcher3.ScrimView
             android:id="@+id/cling_scrim"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
@@ -85,6 +85,8 @@
             android:layout_height="match_parent"
             android:visibility="gone" />
 
+        <!-- This is the search bar voice button proxy view.  It allows us to have a larger
+             touch target than the microphone constrained by the search bar bounds. -->
         <com.android.launcher3.DrawableStateProxyView
             android:id="@+id/voice_button_proxy"
             android:layout_width="0dp"
diff --git a/res/layout-port/search_bar.xml b/res/layout-port/search_bar.xml
index 69dd61a..1c96ca3 100644
--- a/res/layout-port/search_bar.xml
+++ b/res/layout-port/search_bar.xml
@@ -17,6 +17,8 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
     style="@style/SearchDropTargetBar"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:background="@drawable/search_frame">
    <!-- Global search icon -->
    <com.android.launcher3.HolographicLinearLayout
diff --git a/src/com/android/launcher3/AppWidgetResizeFrame.java b/src/com/android/launcher3/AppWidgetResizeFrame.java
index 02958d0..fcb04ea 100644
--- a/src/com/android/launcher3/AppWidgetResizeFrame.java
+++ b/src/com/android/launcher3/AppWidgetResizeFrame.java
@@ -95,13 +95,13 @@
         mLeftHandle = new ImageView(context);
         mLeftHandle.setImageResource(R.drawable.widget_resize_handle_left);
         lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 
-                Gravity.START | Gravity.CENTER_VERTICAL);
+                Gravity.LEFT | Gravity.CENTER_VERTICAL);
         addView(mLeftHandle, lp);
 
         mRightHandle = new ImageView(context);
         mRightHandle.setImageResource(R.drawable.widget_resize_handle_right);
         lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 
-                Gravity.END | Gravity.CENTER_VERTICAL);
+                Gravity.RIGHT | Gravity.CENTER_VERTICAL);
         addView(mRightHandle, lp);
 
         mTopHandle = new ImageView(context);
diff --git a/src/com/android/launcher3/DragLayer.java b/src/com/android/launcher3/DragLayer.java
index 9c649ed..3c955cb 100644
--- a/src/com/android/launcher3/DragLayer.java
+++ b/src/com/android/launcher3/DragLayer.java
@@ -107,7 +107,7 @@
             final FrameLayout.LayoutParams flp = (FrameLayout.LayoutParams) child.getLayoutParams();
             if (child instanceof Insettable) {
                 ((Insettable)child).setInsets(insets);
-            } else  {
+            } else {
                 flp.topMargin += (insets.top - mInsets.top);
                 flp.leftMargin += (insets.left - mInsets.left);
                 flp.rightMargin += (insets.right - mInsets.right);
diff --git a/src/com/android/launcher3/DynamicGrid.java b/src/com/android/launcher3/DynamicGrid.java
index 0756c88..33eb595 100644
--- a/src/com/android/launcher3/DynamicGrid.java
+++ b/src/com/android/launcher3/DynamicGrid.java
@@ -359,14 +359,14 @@
         boolean hasVerticalBarLayout = isVerticalBarLayout();
 
         // Layout the search bar space
-        View searchBarSpace = launcher.findViewById(R.id.qsb_bar);
-        lp = (FrameLayout.LayoutParams) searchBarSpace.getLayoutParams();
+        View searchBar = launcher.getSearchBar();
+        lp = (FrameLayout.LayoutParams) searchBar.getLayoutParams();
         if (hasVerticalBarLayout) {
             // Vertical search bar
             lp.gravity = Gravity.TOP | Gravity.LEFT;
             lp.width = searchBarSpaceHeightPx;
             lp.height = LayoutParams.MATCH_PARENT;
-            searchBarSpace.setPadding(
+            searchBar.setPadding(
                     0, 2 * edgeMarginPx, 0,
                     2 * edgeMarginPx);
         } else {
@@ -374,19 +374,19 @@
             lp.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
             lp.width = searchBarSpaceWidthPx;
             lp.height = searchBarSpaceHeightPx;
-            searchBarSpace.setPadding(
+            searchBar.setPadding(
                     2 * edgeMarginPx,
                     2 * edgeMarginPx,
                     2 * edgeMarginPx, 0);
         }
-        searchBarSpace.setLayoutParams(lp);
+        searchBar.setLayoutParams(lp);
 
         // Layout the search bar
-        View searchBar = launcher.getQsbBar();
-        lp = (FrameLayout.LayoutParams) searchBar.getLayoutParams();
-        lp.width = LayoutParams.MATCH_PARENT;
-        lp.height = LayoutParams.MATCH_PARENT;
-        searchBar.setLayoutParams(lp);
+        View qsbBar = launcher.getQsbBar();
+        LayoutParams vglp = qsbBar.getLayoutParams();
+        vglp.width = LayoutParams.MATCH_PARENT;
+        vglp.height = LayoutParams.MATCH_PARENT;
+        qsbBar.setLayoutParams(vglp);
 
         // Layout the voice proxy
         View voiceButtonProxy = launcher.findViewById(R.id.voice_button_proxy);
diff --git a/src/com/android/launcher3/InstallShortcutReceiver.java b/src/com/android/launcher3/InstallShortcutReceiver.java
index b4d6ea5..821c15f 100644
--- a/src/com/android/launcher3/InstallShortcutReceiver.java
+++ b/src/com/android/launcher3/InstallShortcutReceiver.java
@@ -224,6 +224,7 @@
             data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
 
         // Queue the item up for adding if launcher has not loaded properly yet
+        LauncherAppState.setApplicationContext(context.getApplicationContext());
         LauncherAppState app = LauncherAppState.getInstance();
         boolean launcherNotLoaded = (app.getDynamicGrid() == null);
 
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 182f217..bf12d79 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -3265,7 +3265,8 @@
 
     public View getQsbBar() {
         if (mQsbBar == null) {
-            mQsbBar = mInflater.inflate(R.layout.qsb_bar, mSearchDropTargetBar);
+            mQsbBar = mInflater.inflate(R.layout.search_bar, mSearchDropTargetBar, false);
+            mSearchDropTargetBar.addView(mQsbBar);
         }
         return mQsbBar;
     }
diff --git a/src/com/android/launcher3/ScrimView.java b/src/com/android/launcher3/ScrimView.java
new file mode 100644
index 0000000..6831fe3
--- /dev/null
+++ b/src/com/android/launcher3/ScrimView.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher3;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.graphics.Rect;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.FrameLayout;
+
+public class ScrimView extends FrameLayout implements Insettable {
+
+    public ScrimView(Context context) {
+        this(context, null, 0);
+    }
+
+    public ScrimView(Context context, AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public ScrimView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    @Override
+    public void setInsets(Rect insets) {
+        // Do nothing
+    }
+}
diff --git a/src/com/android/launcher3/UninstallShortcutReceiver.java b/src/com/android/launcher3/UninstallShortcutReceiver.java
index 00fa631..ccea4ec 100644
--- a/src/com/android/launcher3/UninstallShortcutReceiver.java
+++ b/src/com/android/launcher3/UninstallShortcutReceiver.java
@@ -78,6 +78,7 @@
             PendingUninstallShortcutInfo pendingInfo) {
         final Intent data = pendingInfo.data;
 
+        LauncherAppState.setApplicationContext(context.getApplicationContext());
         LauncherAppState app = LauncherAppState.getInstance();
         synchronized (app) { // TODO: make removeShortcut internally threadsafe
             removeShortcut(context, data);
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 0eca3af..ab52c4e 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -1030,12 +1030,14 @@
             if (mCustomContentCallbacks != null) {
                 mCustomContentCallbacks.onShow();
                 mCustomContentShowTime = System.currentTimeMillis();
+                mLauncher.setVoiceButtonProxyVisible(false);
             }
         } else if (hasCustomContent() && getNextPage() != 0 && mCustomContentShowing) {
             mCustomContentShowing = false;
             if (mCustomContentCallbacks != null) {
                 mCustomContentCallbacks.onHide();
                 mLauncher.resetQSBScroll();
+                mLauncher.setVoiceButtonProxyVisible(true);
             }
         }
     }