diff options
author | Ray Chen <raychen@google.com> | 2009-09-30 14:33:15 -0700 |
---|---|---|
committer | Ray Chen <raychen@google.com> | 2009-09-30 16:20:39 -0700 |
commit | bde544f0f430e8458b18ba7a2e1258935b25e1d3 (patch) | |
tree | 24241a613ace5a20dd722d946fd35931ac9582fc /src/com/android/camera | |
parent | afb66cac1dbe9a98ca51b031f5238d72e0f86f82 (diff) | |
download | LegacyCamera-bde544f0f430e8458b18ba7a2e1258935b25e1d3.zip LegacyCamera-bde544f0f430e8458b18ba7a2e1258935b25e1d3.tar.gz LegacyCamera-bde544f0f430e8458b18ba7a2e1258935b25e1d3.tar.bz2 |
Utilize thumbnail api to cancel thumbnail decoding, and replace BitmapManager's existing functions with BitmapFactory.
Diffstat (limited to 'src/com/android/camera')
-rw-r--r-- | src/com/android/camera/GalleryPicker.java | 1 | ||||
-rw-r--r-- | src/com/android/camera/ImageGallery.java | 2 | ||||
-rw-r--r-- | src/com/android/camera/ImageGetter.java | 8 | ||||
-rw-r--r-- | src/com/android/camera/ImageLoader.java | 7 | ||||
-rw-r--r-- | src/com/android/camera/ReviewImage.java | 2 | ||||
-rw-r--r-- | src/com/android/camera/ViewImage.java | 2 |
6 files changed, 17 insertions, 5 deletions
diff --git a/src/com/android/camera/GalleryPicker.java b/src/com/android/camera/GalleryPicker.java index 7c063d3..af6884d 100644 --- a/src/com/android/camera/GalleryPicker.java +++ b/src/com/android/camera/GalleryPicker.java @@ -311,6 +311,7 @@ public class GalleryPicker extends Activity { private void abortWorker() { if (mWorkerThread != null) { BitmapManager.instance().cancelThreadDecoding(mWorkerThread); + MediaStore.Images.Thumbnails.cancelThumbnailRequest(getContentResolver(), -1); mAbort = true; try { mWorkerThread.join(); diff --git a/src/com/android/camera/ImageGallery.java b/src/com/android/camera/ImageGallery.java index 8e0c97f..680d186 100644 --- a/src/com/android/camera/ImageGallery.java +++ b/src/com/android/camera/ImageGallery.java @@ -135,7 +135,7 @@ public class ImageGallery extends Activity implements setupInclusion(); - mLoader = new ImageLoader(mHandler); + mLoader = new ImageLoader(getContentResolver(), mHandler); } private void initializeFooterButtons() { diff --git a/src/com/android/camera/ImageGetter.java b/src/com/android/camera/ImageGetter.java index ecbc66a..08c9370 100644 --- a/src/com/android/camera/ImageGetter.java +++ b/src/com/android/camera/ImageGetter.java @@ -20,10 +20,12 @@ import com.android.camera.gallery.IImage; import com.android.camera.gallery.IImageList; import com.android.camera.gallery.VideoObject; +import android.content.ContentResolver; import android.graphics.Bitmap; import android.os.Handler; import android.os.Message; import android.os.Process; +import android.provider.MediaStore; /* * Here's the loading strategy. For any given image, load the thumbnail @@ -93,6 +95,8 @@ class ImageGetter { // True when the getter thread should exit. private boolean mDone = false; + private ContentResolver mCr; + private class ImageGetterRunnable implements Runnable { private Runnable callback(final int position, final int offset, @@ -219,7 +223,8 @@ class ImageGetter { } } - public ImageGetter() { + public ImageGetter(ContentResolver cr) { + mCr = cr; mGetterThread = new Thread(new ImageGetterRunnable()); mGetterThread.setName("ImageGettter"); mGetterThread.start(); @@ -230,6 +235,7 @@ class ImageGetter { Util.Assert(mGetterThread != null); mCancel = true; BitmapManager.instance().cancelThreadDecoding(mGetterThread); + MediaStore.Images.Thumbnails.cancelThumbnailRequest(mCr, -1); } // Cancels current loading (with waiting). diff --git a/src/com/android/camera/ImageLoader.java b/src/com/android/camera/ImageLoader.java index 4552123..c4d211f 100644 --- a/src/com/android/camera/ImageLoader.java +++ b/src/com/android/camera/ImageLoader.java @@ -18,8 +18,10 @@ package com.android.camera; import com.android.camera.gallery.IImage; +import android.content.ContentResolver; import android.graphics.Bitmap; import android.os.Handler; +import android.provider.MediaStore; import android.util.Log; import java.util.ArrayList; @@ -37,6 +39,7 @@ public class ImageLoader { // the worker thread and a done flag so we know when to exit private boolean mDone; private Thread mDecodeThread; + private ContentResolver mCr; public interface LoadedCallback { public void run(Bitmap result); @@ -102,7 +105,8 @@ public class ImageLoader { } } - public ImageLoader(Handler handler) { + public ImageLoader(ContentResolver cr, Handler handler) { + mCr = cr; start(); } @@ -160,6 +164,7 @@ public class ImageLoader { try { Thread t = mDecodeThread; BitmapManager.instance().cancelThreadDecoding(t); + MediaStore.Images.Thumbnails.cancelThumbnailRequest(mCr, -1); t.join(); mDecodeThread = null; } catch (InterruptedException ex) { diff --git a/src/com/android/camera/ReviewImage.java b/src/com/android/camera/ReviewImage.java index bf0a88f..0633b18 100644 --- a/src/com/android/camera/ReviewImage.java +++ b/src/com/android/camera/ReviewImage.java @@ -542,7 +542,7 @@ public class ReviewImage extends Activity implements View.OnClickListener { } private void makeGetter() { - mGetter = new ImageGetter(); + mGetter = new ImageGetter(getContentResolver()); } private IImageList buildImageListFromUri(Uri uri) { diff --git a/src/com/android/camera/ViewImage.java b/src/com/android/camera/ViewImage.java index 03d68ff..3ee3029 100644 --- a/src/com/android/camera/ViewImage.java +++ b/src/com/android/camera/ViewImage.java @@ -868,7 +868,7 @@ public class ViewImage extends Activity implements View.OnClickListener { } private void makeGetter() { - mGetter = new ImageGetter(); + mGetter = new ImageGetter(getContentResolver()); } private IImageList buildImageListFromUri(Uri uri) { |