summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-03-01 13:14:58 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-03-01 13:14:58 -0800
commit1a16489badd44caf06e757c31c71c2aff1e355fd (patch)
tree36b47b09459a15375110923ffc787d13c178718f
parent79b50a089dc1ee6b8351423b651bf52bd6a6c55a (diff)
parentfbb3d9b55e50e8661c45c4284026f3bb05fa95fc (diff)
downloadandroid_packages_apps_Trebuchet-1a16489badd44caf06e757c31c71c2aff1e355fd.tar.gz
android_packages_apps_Trebuchet-1a16489badd44caf06e757c31c71c2aff1e355fd.tar.bz2
android_packages_apps_Trebuchet-1a16489badd44caf06e757c31c71c2aff1e355fd.zip
Merge "Adding "Shop" text beside market icon."
-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 850a3c352..166bec24d 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"
@@ -63,7 +71,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 f38caf680..115bdbe94 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"
@@ -63,7 +71,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 389fcca38..eedbd6a9e 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 3df8c4a6c..195b671e0 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1039,6 +1039,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);
+ }
+ });
}
}
@@ -3104,11 +3109,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
@@ -3118,12 +3119,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);
@@ -3134,6 +3160,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()));
@@ -3185,14 +3216,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);
}
/**