summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2012-06-28 11:10:02 +0800
committerOwen Lin <owenlin@google.com>2012-06-28 18:35:03 +0800
commitbfe478b2fdbc3526ce465a18b30fe5195fa1fe8a (patch)
tree2dbca953a5f0ccb9fd67a0146ad900b5eec9b8a1
parentd09121f9fb7cf571a6b71c4174835dd4b7359595 (diff)
downloadandroid_packages_apps_Snap-bfe478b2fdbc3526ce465a18b30fe5195fa1fe8a.tar.gz
android_packages_apps_Snap-bfe478b2fdbc3526ce465a18b30fe5195fa1fe8a.tar.bz2
android_packages_apps_Snap-bfe478b2fdbc3526ce465a18b30fe5195fa1fe8a.zip
Don't use Build.VERSION_CODES.
Since they won't be available on old platform. bug: 6752318 Change-Id: I55a9e83dbf05b93c83c68cb31f6edcbc29793283
-rw-r--r--gallerycommon/src/com/android/gallery3d/common/ApiHelper.java14
-rw-r--r--src/com/android/gallery3d/app/CropImage.java3
-rw-r--r--src/com/android/gallery3d/app/MoviePlayer.java5
-rw-r--r--src/com/android/gallery3d/app/Wallpaper.java6
-rw-r--r--src/com/android/gallery3d/data/LocalImage.java3
-rw-r--r--src/com/android/gallery3d/ui/GLRootView.java3
6 files changed, 20 insertions, 14 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java b/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
index c42c5fed6..85b092576 100644
--- a/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
+++ b/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
@@ -16,13 +16,21 @@
package com.android.gallery3d.common;
-import android.annotation.TargetApi;
import android.os.Build;
import android.provider.MediaStore.MediaColumns;
import android.view.View;
-@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public class ApiHelper {
+ public static interface VERSION_CODES {
+ // These value are copied from Build.VERSION_CODES
+ public static final int GINGERBREAD_MR1 = 10;
+ public static final int HONEYCOMB = 11;
+ public static final int HONEYCOMB_MR1 = 12;
+ public static final int HONEYCOMB_MR2 = 13;
+ public static final int ICE_CREAM_SANDWICH = 14;
+ public static final int ICE_CREAM_SANDWICH_MR1 = 15;
+ public static final int JELLY_BEAN = 16;
+ }
public static final boolean HAS_VIEW_SYSTEM_UI_FLAG_LAYOUT_STABLE =
hasField(View.class, "SYSTEM_UI_FLAG_LAYOUT_STABLE");
@@ -34,7 +42,7 @@ public class ApiHelper {
hasField(MediaColumns.class, "WIDTH");
public static final boolean HAS_REUSING_BITMAP_IN_BITMAP_REGION_DECODER =
- Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
+ Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN;
private static boolean hasField(Class<?> klass, String fieldName) {
try {
diff --git a/src/com/android/gallery3d/app/CropImage.java b/src/com/android/gallery3d/app/CropImage.java
index 294e285ea..f2646978a 100644
--- a/src/com/android/gallery3d/app/CropImage.java
+++ b/src/com/android/gallery3d/app/CropImage.java
@@ -33,7 +33,6 @@ import android.graphics.Rect;
import android.graphics.RectF;
import android.media.ExifInterface;
import android.net.Uri;
-import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
@@ -370,7 +369,7 @@ public class CropImage extends AbstractGalleryActivity {
}
}
- @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+ @TargetApi(ApiHelper.VERSION_CODES.JELLY_BEAN)
private static void setImageSize(ContentValues values, int width, int height) {
// The two fields are available since ICS but got published in JB
if (ApiHelper.HAS_MEDIA_COLUMNS_WIDTH_AND_HEIGHT) {
diff --git a/src/com/android/gallery3d/app/MoviePlayer.java b/src/com/android/gallery3d/app/MoviePlayer.java
index c0f0ce739..98d7a6434 100644
--- a/src/com/android/gallery3d/app/MoviePlayer.java
+++ b/src/com/android/gallery3d/app/MoviePlayer.java
@@ -29,7 +29,6 @@ import android.graphics.Color;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.net.Uri;
-import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.KeyEvent;
@@ -179,7 +178,7 @@ public class MoviePlayer implements
}
}
- @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+ @TargetApi(ApiHelper.VERSION_CODES.JELLY_BEAN)
private void setOnSystemUiVisibilityChangeListener() {
if (!ApiHelper.HAS_VIEW_SYSTEM_UI_FLAG_HIDE_NAVIGATION) return;
@@ -213,7 +212,7 @@ public class MoviePlayer implements
});
}
- @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+ @TargetApi(ApiHelper.VERSION_CODES.JELLY_BEAN)
private void showSystemUi(boolean visible) {
if (!ApiHelper.HAS_VIEW_SYSTEM_UI_FLAG_LAYOUT_STABLE) return;
diff --git a/src/com/android/gallery3d/app/Wallpaper.java b/src/com/android/gallery3d/app/Wallpaper.java
index d64eecdcf..1ece66c49 100644
--- a/src/com/android/gallery3d/app/Wallpaper.java
+++ b/src/com/android/gallery3d/app/Wallpaper.java
@@ -25,6 +25,8 @@ import android.os.Build;
import android.os.Bundle;
import android.view.Display;
+import com.android.gallery3d.common.ApiHelper;
+
/**
* Wallpaper picker for the gallery application. This just redirects to the
* standard pick action.
@@ -61,10 +63,10 @@ public class Wallpaper extends Activity {
}
@SuppressWarnings("deprecation")
- @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
+ @TargetApi(ApiHelper.VERSION_CODES.HONEYCOMB_MR2)
private Point getDefaultDisplaySize(Point size) {
Display d = getWindowManager().getDefaultDisplay();
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
+ if (Build.VERSION.SDK_INT >= ApiHelper.VERSION_CODES.HONEYCOMB_MR2) {
d.getSize(size);
} else {
size.set(d.getWidth(), d.getHeight());
diff --git a/src/com/android/gallery3d/data/LocalImage.java b/src/com/android/gallery3d/data/LocalImage.java
index c432ab44d..316e32469 100644
--- a/src/com/android/gallery3d/data/LocalImage.java
+++ b/src/com/android/gallery3d/data/LocalImage.java
@@ -25,7 +25,6 @@ import android.graphics.BitmapFactory;
import android.graphics.BitmapRegionDecoder;
import android.media.ExifInterface;
import android.net.Uri;
-import android.os.Build;
import android.provider.MediaStore.Images;
import android.provider.MediaStore.Images.ImageColumns;
import android.provider.MediaStore.MediaColumns;
@@ -86,7 +85,7 @@ public class LocalImage extends LocalMediaItem {
updateWidthAndHeightProjection();
}
- @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+ @TargetApi(ApiHelper.VERSION_CODES.JELLY_BEAN)
private static void updateWidthAndHeightProjection() {
if (ApiHelper.HAS_MEDIA_COLUMNS_WIDTH_AND_HEIGHT) {
PROJECTION[INDEX_WIDTH] = MediaColumns.WIDTH;
diff --git a/src/com/android/gallery3d/ui/GLRootView.java b/src/com/android/gallery3d/ui/GLRootView.java
index 2068520aa..478cb4f87 100644
--- a/src/com/android/gallery3d/ui/GLRootView.java
+++ b/src/com/android/gallery3d/ui/GLRootView.java
@@ -21,7 +21,6 @@ import android.content.Context;
import android.graphics.Matrix;
import android.graphics.PixelFormat;
import android.opengl.GLSurfaceView;
-import android.os.Build;
import android.os.Process;
import android.os.SystemClock;
import android.util.AttributeSet;
@@ -539,7 +538,7 @@ public class GLRootView extends GLSurfaceView
}
@Override
- @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+ @TargetApi(ApiHelper.VERSION_CODES.JELLY_BEAN)
public void setLightsOutMode(boolean enabled) {
int flags = 0;
if (enabled) {