diff options
| author | Owen Lin <owenlin@google.com> | 2012-08-07 17:38:47 +0800 |
|---|---|---|
| committer | Owen Lin <owenlin@google.com> | 2012-08-08 12:03:55 +0800 |
| commit | ba04cb7a9c5e57a166f8057950711ec7b8da2ba4 (patch) | |
| tree | 0ef5adca86a3e7fc463304e2973ed76f8fc0a972 /src | |
| parent | 28038df8ccc1422541276974e9cf140fd4b76f1e (diff) | |
| download | android_packages_apps_Gallery2-ba04cb7a9c5e57a166f8057950711ec7b8da2ba4.tar.gz android_packages_apps_Gallery2-ba04cb7a9c5e57a166f8057950711ec7b8da2ba4.tar.bz2 android_packages_apps_Gallery2-ba04cb7a9c5e57a166f8057950711ec7b8da2ba4.zip | |
Guard the usage of MenuItem.setShowAsAction in MenuHelper.
bug: 6927642
Change-Id: I3907ac2f86d38c15b681185abee5906ce243339a
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/gallery3d/util/HelpUtils.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/util/HelpUtils.java b/src/com/android/gallery3d/util/HelpUtils.java index 2f02642fa..a029b3c26 100644 --- a/src/com/android/gallery3d/util/HelpUtils.java +++ b/src/com/android/gallery3d/util/HelpUtils.java @@ -16,6 +16,7 @@ package com.android.gallery3d.util; +import android.annotation.TargetApi; import android.content.Context; import android.content.Intent; import android.content.pm.PackageInfo; @@ -25,6 +26,8 @@ import android.text.TextUtils; import android.util.Log; import android.view.MenuItem; +import com.android.gallery3d.common.ApiHelper; + import java.util.Locale; /** @@ -96,7 +99,7 @@ public class HelpUtils { // Set the intent to the help menu item, show the help menu item in the overflow // menu, and make it visible. helpMenuItem.setIntent(intent); - helpMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); + setMenuItemShowAsAction(helpMenuItem); helpMenuItem.setVisible(true); // return that the help menu item is visible (i.e., true) @@ -104,6 +107,13 @@ public class HelpUtils { } } + @TargetApi(ApiHelper.VERSION_CODES.HONEYCOMB) + private static void setMenuItemShowAsAction(MenuItem menuItem) { + if (ApiHelper.HAS_MENU_ITEM_SHOW_AS_ACTION) { + menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); + } + } + /** * Adds two query parameters into the Uri, namely the language code and the version code * of the app's package as gotten via the context. |
