Launcher tweaks.

- Updating search bar bg
- Removing clings from the layout if they are already dismissed
- Tweaking cling description paddings for languages that are more verbase
- Tweaking wallpaper picker gallery spacing

Change-Id: I801cdf4b1d0cc49a53113318d7b9075f6fa218bd
diff --git a/src/com/android/launcher2/Cling.java b/src/com/android/launcher2/Cling.java
index 4f37cb9..09c5062 100644
--- a/src/com/android/launcher2/Cling.java
+++ b/src/com/android/launcher2/Cling.java
@@ -62,10 +62,6 @@
 
     private Paint mErasePaint;
 
-    private View mWorkspaceDesc1;
-    private View mWorkspaceDesc2;
-    private View mAllAppsDesc;
-
     public Cling(Context context) {
         this(context, null, 0);
     }
@@ -98,10 +94,6 @@
                 r.getDimensionPixelSize(R.dimen.toolbar_button_horizontal_padding);
             mButtonBarHeight = r.getDimensionPixelSize(R.dimen.button_bar_height);
 
-            mWorkspaceDesc1 = findViewById(R.id.workspace_cling_move_item);
-            mWorkspaceDesc2 = findViewById(R.id.workspace_cling_open_all_apps);
-            mAllAppsDesc = findViewById(R.id.all_apps_cling_add_item);
-
             mErasePaint = new Paint();
             mErasePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
             mErasePaint.setColor(0xFFFFFF);
@@ -140,11 +132,6 @@
             double diff = Math.sqrt(Math.pow(event.getX() - pos[0], 2) +
                     Math.pow(event.getY() - pos[1], 2));
             if (diff < mRevealRadius) {
-                if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT)) {
-                    // Do nothing
-                } else if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT)) {
-                    // Do nothing
-                }
                 return false;
             }
         } else if (mDrawIdentifier.equals(FOLDER_PORTRAIT) ||
@@ -167,7 +154,7 @@
             DisplayMetrics metrics = new DisplayMetrics();
             mLauncher.getWindowManager().getDefaultDisplay().getMetrics(metrics);
 
-            // Draw the background
+            // Initialize the draw buffer (to allow punching through)
             Bitmap b = Bitmap.createBitmap(getMeasuredWidth(), getMeasuredHeight(),
                     Bitmap.Config.ARGB_8888);
             Canvas c = new Canvas(b);
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 318601d..3c2c3da 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -77,10 +77,10 @@
 import android.view.View;
 import android.view.View.OnLongClickListener;
 import android.view.ViewGroup;
+import android.view.ViewParent;
 import android.view.WindowManager;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.animation.AccelerateDecelerateInterpolator;
-import android.view.animation.AccelerateInterpolator;
 import android.view.animation.DecelerateInterpolator;
 import android.view.inputmethod.InputMethodManager;
 import android.widget.Advanceable;
@@ -3130,41 +3130,56 @@
             anim.start();
         }
     }
+    private void removeCling(int id) {
+        final View cling = findViewById(id);
+        if (cling != null) {
+            final ViewGroup parent = (ViewGroup) cling.getParent();
+            parent.post(new Runnable() {
+                @Override
+                public void run() {
+                    parent.removeView(cling);
+                }
+            });
+        }
+    }
     public void showFirstRunWorkspaceCling() {
-        if (!isClingsEnabled()) return;
-
         // Enable the clings only if they have not been dismissed before
         SharedPreferences prefs =
             getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE);
-        if (!prefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false)) {
+        if (isClingsEnabled() && !prefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false)) {
             initCling(R.id.workspace_cling, null, false, 0);
+        } else {
+            removeCling(R.id.workspace_cling);
         }
     }
     public void showFirstRunAllAppsCling(int[] position) {
-        if (!isClingsEnabled()) return;
-
         // Enable the clings only if they have not been dismissed before
         SharedPreferences prefs =
             getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE);
-        if (!prefs.getBoolean(Cling.ALLAPPS_CLING_DISMISSED_KEY, false)) {
+        if (isClingsEnabled() && !prefs.getBoolean(Cling.ALLAPPS_CLING_DISMISSED_KEY, false)) {
             initCling(R.id.all_apps_cling, position, true, 0);
+        } else {
+            removeCling(R.id.all_apps_cling);
         }
     }
     public Cling showFirstRunFoldersCling() {
-        if (!isClingsEnabled()) return null;
-
         // Enable the clings only if they have not been dismissed before
         SharedPreferences prefs =
             getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE);
         Cling cling = null;
-        if (!prefs.getBoolean(Cling.FOLDER_CLING_DISMISSED_KEY, false)) {
+        if (isClingsEnabled() && !prefs.getBoolean(Cling.FOLDER_CLING_DISMISSED_KEY, false)) {
             cling = initCling(R.id.folder_cling, null, true, 0);
+        } else {
+            removeCling(R.id.folder_cling);
         }
         return cling;
     }
     public boolean isFolderClingVisible() {
         Cling cling = (Cling) findViewById(R.id.folder_cling);
-        return cling.getVisibility() == View.VISIBLE;
+        if (cling != null) {
+            return cling.getVisibility() == View.VISIBLE;
+        }
+        return false;
     }
     public void dismissWorkspaceCling(View v) {
         Cling cling = (Cling) findViewById(R.id.workspace_cling);