diff options
| author | Chih-Chung Chang <chihchung@google.com> | 2012-07-13 14:57:26 +0800 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-07-13 01:01:50 -0700 |
| commit | 840ae396bac4ff8ff34e88c8d2a1773cb112a4b6 (patch) | |
| tree | e1fee077cf4377eba296f9874d945554ffa64435 /src/com/android | |
| parent | 1b10bf568327fa6c6c1ddbfd98cb17524bebfd46 (diff) | |
| download | android_packages_apps_Gallery2-840ae396bac4ff8ff34e88c8d2a1773cb112a4b6.tar.gz android_packages_apps_Gallery2-840ae396bac4ff8ff34e88c8d2a1773cb112a4b6.tar.bz2 android_packages_apps_Gallery2-840ae396bac4ff8ff34e88c8d2a1773cb112a4b6.zip | |
Only use SurfaceTexture.release and setIconAttribute on newer platforms.
Bug: 6706784
Change-Id: Ic1bb2bb27c3184d791de566d88dbade039fb9d87
Diffstat (limited to 'src/com/android')
| -rw-r--r-- | src/com/android/gallery3d/app/AbstractGalleryActivity.java | 18 | ||||
| -rw-r--r-- | src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java | 9 |
2 files changed, 22 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/app/AbstractGalleryActivity.java b/src/com/android/gallery3d/app/AbstractGalleryActivity.java index 24d5dbcdf..6b0b106aa 100644 --- a/src/com/android/gallery3d/app/AbstractGalleryActivity.java +++ b/src/com/android/gallery3d/app/AbstractGalleryActivity.java @@ -171,17 +171,27 @@ public class AbstractGalleryActivity extends Activity implements GalleryActivity dialog.cancel(); } }; - mAlertDialog = new AlertDialog.Builder(this) - .setIconAttribute(android.R.attr.alertDialogIcon) + AlertDialog.Builder builder = new AlertDialog.Builder(this) .setTitle(R.string.no_external_storage_title) .setMessage(R.string.no_external_storage) .setNegativeButton(android.R.string.cancel, onClick) - .setOnCancelListener(onCancel) - .show(); + .setOnCancelListener(onCancel); + if (ApiHelper.HAS_SET_ICON_ATTRIBUTE) { + setAlertDialogIconAttribute(builder); + } else { + builder.setIcon(android.R.drawable.ic_dialog_alert); + } + mAlertDialog = builder.show(); registerReceiver(mMountReceiver, mMountFilter); } } + @TargetApi(ApiHelper.VERSION_CODES.HONEYCOMB) + private static void setAlertDialogIconAttribute( + AlertDialog.Builder builder) { + builder.setIconAttribute(android.R.attr.alertDialogIcon); + } + @Override protected void onStop() { super.onStop(); diff --git a/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java b/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java index a04313b8b..dd9b7ce1f 100644 --- a/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java +++ b/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java @@ -57,6 +57,13 @@ public abstract class SurfaceTextureScreenNail implements ScreenNail, } } + @TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) + private static void releaseSurfaceTexture(SurfaceTexture st) { + if (ApiHelper.HAS_RELEASE_SURFACE_TEXTURE) { + st.release(); + } + } + public SurfaceTexture getSurfaceTexture() { return mSurfaceTexture; } @@ -67,7 +74,7 @@ public abstract class SurfaceTextureScreenNail implements ScreenNail, } mExtTexture.recycle(); mExtTexture = null; - mSurfaceTexture.release(); + releaseSurfaceTexture(mSurfaceTexture); mSurfaceTexture = null; } |
