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 | 4bbfbebdfb584a0c3e348f60f7a95476c43b67f6 (patch) | |
tree | e5ca8f765888ecf11858de09f8b6d433275aa989 /src | |
parent | e242e1b75bbf2aff9cac6cae024829f215554046 (diff) | |
download | android_packages_apps_Snap-4bbfbebdfb584a0c3e348f60f7a95476c43b67f6.tar.gz android_packages_apps_Snap-4bbfbebdfb584a0c3e348f60f7a95476c43b67f6.tar.bz2 android_packages_apps_Snap-4bbfbebdfb584a0c3e348f60f7a95476c43b67f6.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. |