summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/app
diff options
context:
space:
mode:
authorYuli Huang <yuli@google.com>2012-07-01 19:50:22 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-07-01 19:50:22 -0700
commit7eb805de51f5dd9a5dfa98fa3b2fb90ba2582210 (patch)
tree296ab93a497cecfd63d72456d6ca9266471fe488 /src/com/android/gallery3d/app
parente18dd7c80a69a8139a3397d2e6f97a1dce9f608c (diff)
parentfc86994f86f8cfb31e151c9e730dc1e9dc7b3349 (diff)
downloadandroid_packages_apps_Gallery2-7eb805de51f5dd9a5dfa98fa3b2fb90ba2582210.tar.gz
android_packages_apps_Gallery2-7eb805de51f5dd9a5dfa98fa3b2fb90ba2582210.tar.bz2
android_packages_apps_Gallery2-7eb805de51f5dd9a5dfa98fa3b2fb90ba2582210.zip
Merge "Do not use NfcAdapter API in old platforms."
Diffstat (limited to 'src/com/android/gallery3d/app')
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 17f57c204..22b01637e 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -16,6 +16,7 @@
package com.android.gallery3d.app;
+import android.annotation.TargetApi;
import android.app.ActionBar.OnMenuVisibilityListener;
import android.app.Activity;
import android.content.ActivityNotFoundException;
@@ -25,6 +26,7 @@ import android.content.Intent;
import android.graphics.Rect;
import android.net.Uri;
import android.nfc.NfcAdapter;
+import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -37,6 +39,7 @@ import android.widget.ShareActionProvider;
import android.widget.Toast;
import com.android.gallery3d.R;
+import com.android.gallery3d.common.ApiHelper;
import com.android.gallery3d.common.Utils;
import com.android.gallery3d.data.DataManager;
import com.android.gallery3d.data.FilterDeleteSet;
@@ -318,18 +321,24 @@ public class PhotoPage extends ActivityState implements
}
}
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+ private void setNfcBeamPushUris(Uri[] uris) {
+ if (mNfcAdapter != null &&
+ Build.VERSION.SDK_INT >= ApiHelper.VERSION_CODES.JELLY_BEAN) {
+ mNfcAdapter.setBeamPushUris(uris, (Activity)mActivity);
+ }
+ }
+
private void updateShareURI(Path path) {
if (mShareActionProvider != null) {
DataManager manager = mActivity.getDataManager();
int type = manager.getMediaType(path);
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType(MenuExecutor.getMimeType(type));
- intent.putExtra(Intent.EXTRA_STREAM, manager.getContentUri(path));
+ Uri uri = manager.getContentUri(path);
+ intent.putExtra(Intent.EXTRA_STREAM, uri);
mShareActionProvider.setShareIntent(intent);
- if (mNfcAdapter != null) {
- mNfcAdapter.setBeamPushUris(new Uri[]{manager.getContentUri(path)},
- (Activity)mActivity);
- }
+ setNfcBeamPushUris(new Uri[]{uri});
mPendingSharePath = null;
} else {
// This happens when ActionBar is not created yet.