diff options
author | John Hoford <hoford@google.com> | 2013-10-12 00:02:42 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-10-12 00:02:43 +0000 |
commit | dfe30aa6d008c2aff9fa42a6706867bd2f147425 (patch) | |
tree | 95d94d5e17e203df9e7a615df8fceeedefb4e400 /src/com/android/gallery3d/filtershow/pipeline | |
parent | 4c107f27eee1c6778c32b3f01f3c628cbcaf0b26 (diff) | |
parent | ef4c2131c02f77d9fc508c7b26989a7f9b03862e (diff) | |
download | android_packages_apps_Gallery2-dfe30aa6d008c2aff9fa42a6706867bd2f147425.tar.gz android_packages_apps_Gallery2-dfe30aa6d008c2aff9fa42a6706867bd2f147425.tar.bz2 android_packages_apps_Gallery2-dfe30aa6d008c2aff9fa42a6706867bd2f147425.zip |
Merge "fix showing wrong image post save" into gb-ub-photos-carlsbad
Diffstat (limited to 'src/com/android/gallery3d/filtershow/pipeline')
-rw-r--r-- | src/com/android/gallery3d/filtershow/pipeline/ImageSavingTask.java | 23 | ||||
-rw-r--r-- | src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java | 6 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/filtershow/pipeline/ImageSavingTask.java b/src/com/android/gallery3d/filtershow/pipeline/ImageSavingTask.java index a771530b6..5fa89ac6d 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/ImageSavingTask.java +++ b/src/com/android/gallery3d/filtershow/pipeline/ImageSavingTask.java @@ -49,6 +49,10 @@ public class ImageSavingTask extends ProcessingTask { int current; } + static class UpdatePreviewSaved implements Update { + Uri uri; + } + static class URIResult implements Result { Uri uri; } @@ -84,12 +88,19 @@ public class ImageSavingTask extends ProcessingTask { // We create a small bitmap showing the result that we can // give to the notification UpdateBitmap updateBitmap = new UpdateBitmap(); - updateBitmap.bitmap = createNotificationBitmap(sourceUri, preset); + updateBitmap.bitmap = createNotificationBitmap(previewImage, sourceUri, preset); postUpdate(updateBitmap); SaveImage saveImage = new SaveImage(mProcessingService, sourceUri, selectedUri, destinationFile, previewImage, new SaveImage.Callback() { @Override + public void onPreviewSaved(Uri uri){ + UpdatePreviewSaved previewSaved = new UpdatePreviewSaved(); + previewSaved.uri = uri; + postUpdate(previewSaved); + } + + @Override public void onProgress(int max, int current) { UpdateProgress updateProgress = new UpdateProgress(); updateProgress.max = max; @@ -112,6 +123,10 @@ public class ImageSavingTask extends ProcessingTask { @Override public void onUpdate(Update message) { + if (message instanceof UpdatePreviewSaved){ + Uri uri = ((UpdatePreviewSaved) message).uri; + mProcessingService.completePreviewSaveImage(uri); + } if (message instanceof UpdateBitmap) { Bitmap bitmap = ((UpdateBitmap) message).bitmap; mProcessingService.updateNotificationWithBitmap(bitmap); @@ -122,9 +137,13 @@ public class ImageSavingTask extends ProcessingTask { } } - private Bitmap createNotificationBitmap(Uri sourceUri, ImagePreset preset) { + private Bitmap createNotificationBitmap(Bitmap preview, Uri sourceUri, ImagePreset preset) { int notificationBitmapSize = Resources.getSystem().getDimensionPixelSize( android.R.dimen.notification_large_icon_width); + if (preview != null) { + return Bitmap.createScaledBitmap(preview, + notificationBitmapSize, notificationBitmapSize, true); + } Bitmap bitmap = ImageLoader.loadConstrainedBitmap(sourceUri, getContext(), notificationBitmapSize, null, true); CachingPipeline pipeline = new CachingPipeline(FiltersManager.getManager(), "Thumb"); diff --git a/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java b/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java index c6a4f80b1..68574bd7e 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java +++ b/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java @@ -261,6 +261,12 @@ public class ProcessingService extends Service { mNotifyMgr.notify(mNotificationId, mBuilder.build()); } + public void completePreviewSaveImage(Uri result) { + if (!mNeedsAlive && !mFiltershowActivity.isSimpleEditAction()) { + mFiltershowActivity.completeSaveImage(result); + } + } + public void completeSaveImage(Uri result) { if (SHOW_IMAGE) { // TODO: we should update the existing image in Gallery instead |