diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-02-10 15:44:04 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-02-10 15:44:04 -0800 |
commit | dee42a6e53cb1d0c7194b0cb92028cca353d7c5c (patch) | |
tree | 4fe26dbb188bf5ec71455fa71ce93470342269a0 /src/com/android/camera/ImageGallery2.java | |
parent | 8250896ab37545f4499da79f54c19af2e5018b80 (diff) | |
download | LegacyCamera-dee42a6e53cb1d0c7194b0cb92028cca353d7c5c.zip LegacyCamera-dee42a6e53cb1d0c7194b0cb92028cca353d7c5c.tar.gz LegacyCamera-dee42a6e53cb1d0c7194b0cb92028cca353d7c5c.tar.bz2 |
auto import from //branches/cupcake/...@130745
Diffstat (limited to 'src/com/android/camera/ImageGallery2.java')
-rw-r--r-- | src/com/android/camera/ImageGallery2.java | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/com/android/camera/ImageGallery2.java b/src/com/android/camera/ImageGallery2.java index 92e9c57..d58f04c 100644 --- a/src/com/android/camera/ImageGallery2.java +++ b/src/com/android/camera/ImageGallery2.java @@ -73,7 +73,6 @@ public class ImageGallery2 extends Activity { private Dialog mMediaScanningDialog; - private MenuItem mFlipItem; private MenuItem mSlideShowItem; private SharedPreferences mPrefs; @@ -187,7 +186,10 @@ public class ImageGallery2 extends Activity { private Runnable mDeletePhotoRunnable = new Runnable() { public void run() { mGvs.clearCache(); - mAllImages.removeImage(mSelectedImageGetter.getCurrentImage()); + IImage currentImage = mSelectedImageGetter.getCurrentImage(); + if (currentImage != null) { + mAllImages.removeImage(currentImage); + } mGvs.invalidate(); mGvs.requestLayout(); mGvs.start(); @@ -356,8 +358,10 @@ public class ImageGallery2 extends Activity { switch (requestCode) { case CROP_MSG: { if (Config.LOGV) Log.v(TAG, "onActivityResult " + data); - setResult(resultCode, data); - finish(); + if (resultCode == RESULT_OK) { + setResult(resultCode, data); + finish(); + } break; } case VIEW_MSG: { @@ -504,7 +508,6 @@ public class ImageGallery2 extends Activity { mThumbnailCheckThread = new CameraThread(new Runnable() { public void run() { android.content.res.Resources resources = getResources(); - boolean loadingVideos = mInclusion == ImageManager.INCLUDE_VIDEOS; final TextView progressTextView = (TextView) findViewById(R.id.loading_text); final String progressTextFormatString = resources.getString(R.string.loading_progress_format_string); @@ -547,7 +550,8 @@ public class ImageGallery2 extends Activity { return !mPausing; } }; - allImages(true).checkThumbnails(r); + ImageManager.IImageList imageList = allImages(true); + imageList.checkThumbnails(r, imageList.getCount()); mWakeLock.release(); mThumbnailCheckThread = null; mHandler.post(new Runnable() { @@ -572,12 +576,13 @@ public class ImageGallery2 extends Activity { @Override public boolean onCreateOptionsMenu(android.view.Menu menu) { MenuItem item; - MenuHelper.addCaptureMenuItems(menu, this); - if ((mInclusion & ImageManager.INCLUDE_IMAGES) != 0) { - mSlideShowItem = addSlideShowMenu(menu, 5); + if (! isPickIntent()) { + MenuHelper.addCaptureMenuItems(menu, this); + if ((mInclusion & ImageManager.INCLUDE_IMAGES) != 0) { + mSlideShowItem = addSlideShowMenu(menu, 5); + } } - mFlipItem = MenuHelper.addFlipOrientation(menu, this, mPrefs); item = menu.add(0, 0, 1000, R.string.camerasettings); item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @@ -599,9 +604,10 @@ public class ImageGallery2 extends Activity { if ((mInclusion & ImageManager.INCLUDE_IMAGES) != 0) { boolean videoSelected = isVideoSelected(); // TODO: Only enable slide show if there is at least one image in the folder. - mSlideShowItem.setEnabled(!videoSelected); + if (mSlideShowItem != null) { + mSlideShowItem.setEnabled(!videoSelected); + } } - MenuHelper.setFlipOrientationEnabled(this, mFlipItem); return true; } @@ -745,7 +751,7 @@ public class ImageGallery2 extends Activity { setVerticalScrollBarEnabled(true); initializeScrollbars(context.obtainStyledAttributes(android.R.styleable.View)); - mGestureDetector = new GestureDetector(new SimpleOnGestureListener() { + mGestureDetector = new GestureDetector(context, new SimpleOnGestureListener() { @Override public boolean onDown(MotionEvent e) { if (mScroller != null && !mScroller.isFinished()) { @@ -1037,7 +1043,7 @@ public class ImageGallery2 extends Activity { loadNext(); synchronized (ImageBlockManager.this) { - if (workCounter == mWorkCounter) { + if ((workCounter == mWorkCounter) && (! mDone)) { try { ImageBlockManager.this.wait(); } catch (InterruptedException ex) { |