summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gallerycommon/src/com/android/gallery3d/common/ApiHelper.java3
-rw-r--r--src/com/android/gallery3d/ui/CustomMenu.java6
-rw-r--r--src/com/android/gallery3d/util/GalleryUtils.java9
3 files changed, 12 insertions, 6 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java b/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
index 06518108b..20098e4b4 100644
--- a/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
+++ b/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
@@ -67,6 +67,9 @@ public class ApiHelper {
public static final boolean HAS_REMOTE_VIEWS_SERVICE =
Build.VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB;
+ public static final boolean HAS_INTENT_EXTRA_LOCAL_ONLY =
+ Build.VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB;
+
private static boolean hasField(Class<?> klass, String fieldName) {
try {
klass.getDeclaredField(fieldName);
diff --git a/src/com/android/gallery3d/ui/CustomMenu.java b/src/com/android/gallery3d/ui/CustomMenu.java
index dd8e6abc4..15b3dc2c2 100644
--- a/src/com/android/gallery3d/ui/CustomMenu.java
+++ b/src/com/android/gallery3d/ui/CustomMenu.java
@@ -25,8 +25,6 @@ import android.widget.Button;
import android.widget.PopupMenu;
import android.widget.PopupMenu.OnMenuItemClickListener;
-import com.android.gallery3d.R;
-
import java.util.ArrayList;
public class CustomMenu implements OnMenuItemClickListener {
@@ -46,6 +44,7 @@ public class CustomMenu implements OnMenuItemClickListener {
mPopupMenu.getMenuInflater().inflate(menuId, mMenu);
mPopupMenu.setOnMenuItemClickListener(listener);
mButton.setOnClickListener(new OnClickListener() {
+ @Override
public void onClick(View v) {
mPopupMenu.show();
}
@@ -61,8 +60,6 @@ public class CustomMenu implements OnMenuItemClickListener {
}
}
-
-
private Context mContext;
private ArrayList<DropDownMenu> mMenus;
private OnMenuItemClickListener mListener;
@@ -82,6 +79,7 @@ public class CustomMenu implements OnMenuItemClickListener {
mListener = listener;
}
+ @Override
public boolean onMenuItemClick(MenuItem item) {
if (mListener != null) {
return mListener.onMenuItemClick(item);
diff --git a/src/com/android/gallery3d/util/GalleryUtils.java b/src/com/android/gallery3d/util/GalleryUtils.java
index 1291ee9f7..05198f41b 100644
--- a/src/com/android/gallery3d/util/GalleryUtils.java
+++ b/src/com/android/gallery3d/util/GalleryUtils.java
@@ -16,6 +16,7 @@
package com.android.gallery3d.util;
+import android.annotation.TargetApi;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
@@ -35,6 +36,7 @@ import android.view.WindowManager;
import com.android.gallery3d.R;
import com.android.gallery3d.app.PackagesMonitor;
+import com.android.gallery3d.common.ApiHelper;
import com.android.gallery3d.data.DataManager;
import com.android.gallery3d.data.MediaItem;
import com.android.gallery3d.util.ThreadPool.CancelListener;
@@ -288,6 +290,7 @@ public class GalleryUtils {
return durationValue;
}
+ @TargetApi(ApiHelper.VERSION_CODES.HONEYCOMB)
public static int determineTypeBits(Context context, Intent intent) {
int typeBits = 0;
String type = intent.resolveType(context);
@@ -304,8 +307,10 @@ public class GalleryUtils {
typeBits = DataManager.INCLUDE_ALL;
}
- if (intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false)) {
- typeBits |= DataManager.INCLUDE_LOCAL_ONLY;
+ if (ApiHelper.HAS_INTENT_EXTRA_LOCAL_ONLY) {
+ if (intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false)) {
+ typeBits |= DataManager.INCLUDE_LOCAL_ONLY;
+ }
}
return typeBits;