diff options
author | Owen Lin <owenlin@google.com> | 2012-06-27 15:28:07 +0800 |
---|---|---|
committer | Owen Lin <owenlin@google.com> | 2012-06-27 15:36:34 +0800 |
commit | a67532ff46d69b39936f209ce73682363b0a43c0 (patch) | |
tree | 1e2e1f6b3461437ed59f9e3361e03758e5c799e4 /src | |
parent | 8ba7701ccacfe48c9632abbf51fac891edb72774 (diff) | |
download | android_packages_apps_Snap-a67532ff46d69b39936f209ce73682363b0a43c0.tar.gz android_packages_apps_Snap-a67532ff46d69b39936f209ce73682363b0a43c0.tar.bz2 android_packages_apps_Snap-a67532ff46d69b39936f209ce73682363b0a43c0.zip |
Don't use Display.getSize().
Change-Id: I9b5c9021bae2b58d2815a909c97104f215d4d2e8
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/gallery3d/app/Wallpaper.java | 18 | ||||
-rw-r--r-- | src/com/android/gallery3d/util/GalleryUtils.java | 2 |
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; |