summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2012-06-28 20:38:15 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-06-28 20:38:15 -0700
commit1fb473e5f9f61c3117e639286b2d62b2c34d0dbb (patch)
treefd7bff12d7ff44b4801a5c45050793e7a303a7f0 /src
parent9d9450fdf1efeb7a906d21913ba859218514dd29 (diff)
parenta67532ff46d69b39936f209ce73682363b0a43c0 (diff)
downloadandroid_packages_apps_Snap-1fb473e5f9f61c3117e639286b2d62b2c34d0dbb.tar.gz
android_packages_apps_Snap-1fb473e5f9f61c3117e639286b2d62b2c34d0dbb.tar.bz2
android_packages_apps_Snap-1fb473e5f9f61c3117e639286b2d62b2c34d0dbb.zip
Merge "Don't use Display.getSize()."
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/app/Wallpaper.java18
-rw-r--r--src/com/android/gallery3d/util/GalleryUtils.java2
2 files changed, 16 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/app/Wallpaper.java b/src/com/android/gallery3d/app/Wallpaper.java
index c08c1d705..d64eecdcf 100644
--- a/src/com/android/gallery3d/app/Wallpaper.java
+++ b/src/com/android/gallery3d/app/Wallpaper.java
@@ -16,11 +16,14 @@
package com.android.gallery3d.app;
+import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Point;
import android.net.Uri;
+import android.os.Build;
import android.os.Bundle;
+import android.view.Display;
/**
* Wallpaper picker for the gallery application. This just redirects to the
@@ -57,6 +60,18 @@ public class Wallpaper extends Activity {
}
}
+ @SuppressWarnings("deprecation")
+ @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
+ private Point getDefaultDisplaySize(Point size) {
+ Display d = getWindowManager().getDefaultDisplay();
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
+ d.getSize(size);
+ } else {
+ size.set(d.getWidth(), d.getHeight());
+ }
+ return size;
+ }
+
@SuppressWarnings("fallthrough")
@Override
protected void onResume() {
@@ -78,8 +93,7 @@ public class Wallpaper extends Activity {
case STATE_PHOTO_PICKED: {
int width = getWallpaperDesiredMinimumWidth();
int height = getWallpaperDesiredMinimumHeight();
- Point size = new Point();
- getWindowManager().getDefaultDisplay().getSize(size);
+ Point size = getDefaultDisplaySize(new Point());
float spotlightX = (float) size.x / width;
float spotlightY = (float) size.y / height;
Intent request = new Intent(CropImage.ACTION_CROP)
diff --git a/src/com/android/gallery3d/util/GalleryUtils.java b/src/com/android/gallery3d/util/GalleryUtils.java
index 1d70914ce..1291ee9f7 100644
--- a/src/com/android/gallery3d/util/GalleryUtils.java
+++ b/src/com/android/gallery3d/util/GalleryUtils.java
@@ -16,7 +16,6 @@
package com.android.gallery3d.util;
-import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
@@ -24,7 +23,6 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
-import android.content.res.Resources;
import android.net.Uri;
import android.os.ConditionVariable;
import android.os.Environment;