Adding "Shop" text beside market icon.

Change-Id: I3a3a167185879b0723b51f08325ff8b09d4ebd71
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 261569e..d5bf7c5 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1038,6 +1038,11 @@
             View marketButton = findViewById(R.id.market_button);
             if (marketButton != null) {
                 allAppsInfoTarget.setOverlappingView(marketButton);
+                marketButton.setOnClickListener(new OnClickListener() {
+                    public void onClick(View v) {
+                        onClickAppMarketButton(v);
+                    }
+                });
             }
         }
 
@@ -3087,11 +3092,7 @@
         showWorkspace(true, layout);
     }
 
-    // if successful in getting icon, return it; otherwise, set button to use default drawable
-    private Drawable.ConstantState updateButtonWithIconFromExternalActivity(
-            int buttonId, ComponentName activityName, int fallbackDrawableId) {
-        ImageView button = (ImageView) findViewById(buttonId);
-        Drawable toolbarIcon = null;
+    private Drawable getExternalPackageToolbarIcon(ComponentName activityName) {
         try {
             PackageManager packageManager = getPackageManager();
             // Look for the toolbar icon specified in the activity meta-data
@@ -3101,12 +3102,37 @@
                 int iconResId = metaData.getInt(TOOLBAR_ICON_METADATA_NAME);
                 if (iconResId != 0) {
                     Resources res = packageManager.getResourcesForActivity(activityName);
-                    toolbarIcon = res.getDrawable(iconResId);
+                    return res.getDrawable(iconResId);
                 }
             }
         } catch (NameNotFoundException e) {
             // Do nothing
         }
+        return null;
+    }
+
+    // if successful in getting icon, return it; otherwise, set button to use default drawable
+    private Drawable.ConstantState updateTextButtonWithIconFromExternalActivity(
+            int buttonId, ComponentName activityName, int fallbackDrawableId) {
+        TextView button = (TextView) findViewById(buttonId);
+        Drawable toolbarIcon = getExternalPackageToolbarIcon(activityName);
+
+        // If we were unable to find the icon via the meta-data, use a generic one
+        if (toolbarIcon == null) {
+            button.setCompoundDrawablesWithIntrinsicBounds(fallbackDrawableId, 0, 0, 0);
+            return null;
+        } else {
+            button.setCompoundDrawablesWithIntrinsicBounds(toolbarIcon, null, null, null);
+            return toolbarIcon.getConstantState();
+        }
+    }
+
+    // if successful in getting icon, return it; otherwise, set button to use default drawable
+    private Drawable.ConstantState updateButtonWithIconFromExternalActivity(
+            int buttonId, ComponentName activityName, int fallbackDrawableId) {
+        ImageView button = (ImageView) findViewById(buttonId);
+        Drawable toolbarIcon = getExternalPackageToolbarIcon(activityName);
+
         // If we were unable to find the icon via the meta-data, use a generic one
         if (toolbarIcon == null) {
             button.setImageResource(fallbackDrawableId);
@@ -3117,6 +3143,11 @@
         }
     }
 
+    private void updateTextButtonWithDrawable(int buttonId, Drawable.ConstantState d) {
+        TextView button = (TextView) findViewById(buttonId);
+        button.setCompoundDrawables(d.newDrawable(getResources()), null, null, null);
+    }
+
     private void updateButtonWithDrawable(int buttonId, Drawable.ConstantState d) {
         ImageView button = (ImageView) findViewById(buttonId);
         button.setImageDrawable(d.newDrawable(getResources()));
@@ -3168,14 +3199,14 @@
             ComponentName activityName = intent.resolveActivity(getPackageManager());
             if (activityName != null) {
                 mAppMarketIntent = intent;
-                sAppMarketIcon = updateButtonWithIconFromExternalActivity(
+                sAppMarketIcon = updateTextButtonWithIconFromExternalActivity(
                         R.id.market_button, activityName, R.drawable.app_market_generic);
             }
         }
     }
 
     private void updateAppMarketIcon(Drawable.ConstantState d) {
-        updateButtonWithDrawable(R.id.market_button, d);
+        updateTextButtonWithDrawable(R.id.market_button, d);
     }
 
     /**