summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChih-Chung Chang <chihchung@google.com>2012-07-03 12:49:45 +0800
committerChih-Chung Chang <chihchung@google.com>2012-07-03 18:31:13 +0800
commit4ebfbc28bc94084b27c87914450699bc5c474d1a (patch)
treef394d8cb6fb196710740060888bf2e63cbd7dab9 /src
parent7aac26484af3d40df81e1d08c673bd925856a7fa (diff)
downloadandroid_packages_apps_Snap-4ebfbc28bc94084b27c87914450699bc5c474d1a.tar.gz
android_packages_apps_Snap-4ebfbc28bc94084b27c87914450699bc5c474d1a.tar.bz2
android_packages_apps_Snap-4ebfbc28bc94084b27c87914450699bc5c474d1a.zip
Remove dependencies on APIs only exist on newer platforms.
Change-Id: I606a23863247454051dd183ddf6b77f6bc882685
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/app/MoviePlayer.java8
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java5
-rw-r--r--src/com/android/gallery3d/ui/ActionModeHandler.java5
-rw-r--r--src/com/android/gallery3d/ui/PositionController.java2
-rw-r--r--src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java18
5 files changed, 27 insertions, 11 deletions
diff --git a/src/com/android/gallery3d/app/MoviePlayer.java b/src/com/android/gallery3d/app/MoviePlayer.java
index 660c4d953..f2dc9ad20 100644
--- a/src/com/android/gallery3d/app/MoviePlayer.java
+++ b/src/com/android/gallery3d/app/MoviePlayer.java
@@ -58,6 +58,10 @@ public class MoviePlayer implements
private static final String KEY_VIDEO_POSITION = "video-position";
private static final String KEY_RESUMEABLE_TIME = "resumeable-timeout";
+ // These are constants in KeyEvent, appearing on API level 11.
+ private static final int KEYCODE_MEDIA_PLAY = 126;
+ private static final int KEYCODE_MEDIA_PAUSE = 127;
+
// Copied from MediaPlaybackService in the Music Player app.
private static final String SERVICECMD = "com.android.music.musicservicecommand";
private static final String CMDNAME = "command";
@@ -411,12 +415,12 @@ public class MoviePlayer implements
playVideo();
}
return true;
- case KeyEvent.KEYCODE_MEDIA_PAUSE:
+ case KEYCODE_MEDIA_PAUSE:
if (mVideoView.isPlaying()) {
pauseVideo();
}
return true;
- case KeyEvent.KEYCODE_MEDIA_PLAY:
+ case KEYCODE_MEDIA_PLAY:
if (!mVideoView.isPlaying()) {
playVideo();
}
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 22b01637e..3b6a7704b 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -321,10 +321,9 @@ public class PhotoPage extends ActivityState implements
}
}
- @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+ @TargetApi(ApiHelper.VERSION_CODES.JELLY_BEAN)
private void setNfcBeamPushUris(Uri[] uris) {
- if (mNfcAdapter != null &&
- Build.VERSION.SDK_INT >= ApiHelper.VERSION_CODES.JELLY_BEAN) {
+ if (mNfcAdapter != null && ApiHelper.HAS_SET_BEAM_PUSH_URIS) {
mNfcAdapter.setBeamPushUris(uris, (Activity)mActivity);
}
}
diff --git a/src/com/android/gallery3d/ui/ActionModeHandler.java b/src/com/android/gallery3d/ui/ActionModeHandler.java
index 2a0157a4b..190b2b8c6 100644
--- a/src/com/android/gallery3d/ui/ActionModeHandler.java
+++ b/src/com/android/gallery3d/ui/ActionModeHandler.java
@@ -227,10 +227,9 @@ public class ActionModeHandler implements ActionMode.Callback {
return operation;
}
- @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+ @TargetApi(ApiHelper.VERSION_CODES.JELLY_BEAN)
private void setNfcBeamPushUris(Uri[] uris) {
- if (mNfcAdapter != null &&
- Build.VERSION.SDK_INT >= ApiHelper.VERSION_CODES.JELLY_BEAN) {
+ if (mNfcAdapter != null && ApiHelper.HAS_SET_BEAM_PUSH_URIS) {
mNfcAdapter.setBeamPushUris(uris, (Activity)mActivity);
}
}
diff --git a/src/com/android/gallery3d/ui/PositionController.java b/src/com/android/gallery3d/ui/PositionController.java
index 6d334709d..9b77d6814 100644
--- a/src/com/android/gallery3d/ui/PositionController.java
+++ b/src/com/android/gallery3d/ui/PositionController.java
@@ -19,8 +19,8 @@ package com.android.gallery3d.ui;
import android.content.Context;
import android.graphics.Rect;
import android.util.Log;
-import android.widget.OverScroller;
+import com.android.gallery3d.common.OverScroller;
import com.android.gallery3d.common.Utils;
import com.android.gallery3d.util.GalleryUtils;
import com.android.gallery3d.util.RangeArray;
diff --git a/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java b/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java
index 5f45f1683..a04313b8b 100644
--- a/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java
+++ b/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java
@@ -16,13 +16,20 @@
package com.android.gallery3d.ui;
+import android.annotation.TargetApi;
import android.graphics.RectF;
import android.graphics.SurfaceTexture;
import android.opengl.GLES11Ext;
+import com.android.gallery3d.common.ApiHelper;
+
public abstract class SurfaceTextureScreenNail implements ScreenNail,
SurfaceTexture.OnFrameAvailableListener {
private static final String TAG = "SurfaceTextureScreenNail";
+ // This constant is not available in API level before 15, but it was just an
+ // oversight.
+ private static final int GL_TEXTURE_EXTERNAL_OES = 0x8D65;
+
protected ExtTexture mExtTexture;
private SurfaceTexture mSurfaceTexture;
private int mWidth, mHeight;
@@ -33,16 +40,23 @@ public abstract class SurfaceTextureScreenNail implements ScreenNail,
}
public void acquireSurfaceTexture() {
- mExtTexture = new ExtTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES);
+ mExtTexture = new ExtTexture(GL_TEXTURE_EXTERNAL_OES);
mExtTexture.setSize(mWidth, mHeight);
mSurfaceTexture = new SurfaceTexture(mExtTexture.getId());
- mSurfaceTexture.setDefaultBufferSize(mWidth, mHeight);
+ setDefaultBufferSize(mSurfaceTexture, mWidth, mHeight);
mSurfaceTexture.setOnFrameAvailableListener(this);
synchronized (this) {
mHasTexture = true;
}
}
+ @TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
+ private static void setDefaultBufferSize(SurfaceTexture st, int width, int height) {
+ if (ApiHelper.HAS_SET_DEFALT_BUFFER_SIZE) {
+ st.setDefaultBufferSize(width, height);
+ }
+ }
+
public SurfaceTexture getSurfaceTexture() {
return mSurfaceTexture;
}