summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-03-01 12:43:02 -0800
committerWinson Chung <winsonc@google.com>2011-03-01 12:43:18 -0800
commitfbb3d9b55e50e8661c45c4284026f3bb05fa95fc (patch)
treec2b8c9e152de276d8f3c189006a9b9b47bdef39e
parent60b753b4cfa709efa55e05cdcd62a993330f3684 (diff)
downloadandroid_packages_apps_Trebuchet-fbb3d9b55e50e8661c45c4284026f3bb05fa95fc.tar.gz
android_packages_apps_Trebuchet-fbb3d9b55e50e8661c45c4284026f3bb05fa95fc.tar.bz2
android_packages_apps_Trebuchet-fbb3d9b55e50e8661c45c4284026f3bb05fa95fc.zip
Adding "Shop" text beside market icon.
Change-Id: I3a3a167185879b0723b51f08325ff8b09d4ebd71
-rw-r--r--res/layout-xlarge-land/all_apps_tabbed.xml14
-rw-r--r--res/layout-xlarge-port/all_apps_tabbed.xml14
-rw-r--r--res/values/strings.xml2
-rw-r--r--src/com/android/launcher2/Launcher.java47
4 files changed, 63 insertions, 14 deletions
diff --git a/res/layout-xlarge-land/all_apps_tabbed.xml b/res/layout-xlarge-land/all_apps_tabbed.xml
index d03a57158..12cb26677 100644
--- a/res/layout-xlarge-land/all_apps_tabbed.xml
+++ b/res/layout-xlarge-land/all_apps_tabbed.xml
@@ -44,12 +44,20 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="invisible"/>
- <ImageView
+ <TextView
android:id="@+id/market_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
- android:onClick="onClickAppMarketButton"/>
+ android:gravity="center"
+ android:paddingRight="22dp"
+ android:text="@string/market"
+ android:textColor="@color/workspace_all_apps_and_delete_zone_text_color"
+ android:textSize="18sp"
+ android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color"
+ android:shadowDx="0.0"
+ android:shadowDy="0.0"
+ android:shadowRadius="2.0" />
</FrameLayout>
<com.android.launcher2.DeleteZone
android:id="@+id/all_apps_delete_zone"
@@ -64,7 +72,7 @@
android:paddingRight="22dp"
launcher:direction="horizontal"
- android:gravity="center_horizontal|center_vertical"
+ android:gravity="center"
android:textColor="@color/workspace_all_apps_and_delete_zone_text_color"
android:textSize="18sp"
android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color"
diff --git a/res/layout-xlarge-port/all_apps_tabbed.xml b/res/layout-xlarge-port/all_apps_tabbed.xml
index 269fa1275..03c9fa199 100644
--- a/res/layout-xlarge-port/all_apps_tabbed.xml
+++ b/res/layout-xlarge-port/all_apps_tabbed.xml
@@ -44,12 +44,20 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="invisible"/>
- <ImageView
+ <TextView
android:id="@+id/market_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
- android:onClick="onClickAppMarketButton"/>
+ android:gravity="center"
+ android:paddingRight="22dp"
+ android:text="@string/market"
+ android:textColor="@color/workspace_all_apps_and_delete_zone_text_color"
+ android:textSize="18sp"
+ android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color"
+ android:shadowDx="0.0"
+ android:shadowDy="0.0"
+ android:shadowRadius="2.0" />
</FrameLayout>
<com.android.launcher2.DeleteZone
android:id="@+id/all_apps_delete_zone"
@@ -64,7 +72,7 @@
android:paddingRight="22dp"
launcher:direction="horizontal"
- android:gravity="center_horizontal|center_vertical"
+ android:gravity="center"
android:textColor="@color/workspace_all_apps_and_delete_zone_text_color"
android:textSize="18sp"
android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6dcaa5748..880f04581 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -72,6 +72,8 @@
<string name="all_apps_no_games">No games found.</string>
<!-- Message to show when there are no downloaded apps [CHAR_LIMIT=50] -->
<string name="all_apps_no_downloads">You have no downloaded applications.</string>
+ <!-- Market button text [CHAR LIMIT=32] -->
+ <string name="market">Shop</string>
<!-- Customization Drawer -->
<!-- The format string for the dimensions of a widget in the drawer -->
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 261569ef6..d5bf7c5b4 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1038,6 +1038,11 @@ public final class Launcher extends Activity
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 @@ public final class Launcher extends Activity
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 @@ public final class Launcher extends Activity
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 @@ public final class Launcher extends Activity
}
}
+ 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 @@ public final class Launcher extends Activity
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);
}
/**