From 3eb0a21071f7acae42077d11773f872ffd9628d3 Mon Sep 17 00:00:00 2001 From: Bobby Georgescu Date: Sat, 6 Oct 2012 01:06:43 -0700 Subject: Fix display of spinner and SQL exception for view intent Bug: 7288544 Bug: 7219163 Remove the query for photo DISPLAY_NAME in view intent since it is no longer used, and hide the spinner when launching PhotoPage via this intent. Change-Id: Id41ff3d623e7fd2e708b1042782333b48e8ba4a7 --- src/com/android/gallery3d/app/Gallery.java | 20 -------------------- src/com/android/gallery3d/app/PhotoPage.java | 8 ++++++-- 2 files changed, 6 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/com/android/gallery3d/app/Gallery.java b/src/com/android/gallery3d/app/Gallery.java index dadb32c48..6ca4bab2d 100644 --- a/src/com/android/gallery3d/app/Gallery.java +++ b/src/com/android/gallery3d/app/Gallery.java @@ -212,26 +212,6 @@ public final class Gallery extends AbstractGalleryActivity implements OnCancelLi } } - // Displays the filename as title, reading the filename from the interface: - // {@link android.provider.OpenableColumns#DISPLAY_NAME}. - AsyncQueryHandler queryHandler = new AsyncQueryHandler(getContentResolver()) { - @Override - protected void onQueryComplete(int token, Object cookie, Cursor cursor) { - try { - if ((cursor != null) && cursor.moveToFirst()) { - String displayName = cursor.getString(0); - - // Just show empty title if other apps don't set DISPLAY_NAME - setTitle((displayName == null) ? "" : displayName); - } - } finally { - Utils.closeSilently(cursor); - } - } - }; - queryHandler.startQuery(0, null, uri, new String[] {OpenableColumns.DISPLAY_NAME}, - null, null, null); - getStateManager().startState(PhotoPage.class, data); } } diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index 2a088b1fa..a219f51e4 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -149,6 +149,7 @@ public class PhotoPage extends ActivityState implements private MediaItem mCurrentPhoto = null; private MenuExecutor mMenuExecutor; private boolean mIsActive; + private boolean mShowSpinner; private String mSetPathString; // This is the original mSetPathString before adding the camera preview item. private String mOriginalSetPathString; @@ -339,6 +340,7 @@ public class PhotoPage extends ActivityState implements MSG_ALBUMPAGE_NONE) == MSG_ALBUMPAGE_STARTED; mCurrentIndex = data.getInt(KEY_INDEX_HINT, 0); if (mSetPathString != null) { + mShowSpinner = true; mAppBridge = (AppBridge) data.getParcelable(KEY_APP_BRIDGE); if (mAppBridge != null) { mShowBars = false; @@ -360,6 +362,7 @@ public class PhotoPage extends ActivityState implements if (SecureSource.isSecurePath(mSetPathString)) { mSecureAlbum = (SecureAlbum) mActivity.getDataManager() .getMediaSet(mSetPathString); + mShowSpinner = false; } if (data.getBoolean(KEY_SHOW_WHEN_LOCKED, false)) { // Set the flag to be on top of the lock screen. @@ -483,6 +486,7 @@ public class PhotoPage extends ActivityState implements mModel = new SinglePhotoDataAdapter(mActivity, mPhotoView, mediaItem); mPhotoView.setModel(mModel); updateCurrentPhoto(mediaItem); + mShowSpinner = false; } mPhotoView.setFilmMode(mStartInFilmstrip && mMediaSet.getMediaItemCount() > 1); @@ -1186,7 +1190,7 @@ public class PhotoPage extends ActivityState implements mPhotoView.pause(); mHandler.removeMessages(MSG_HIDE_BARS); mActionBar.removeOnMenuVisibilityListener(mMenuVisibilityListener); - if (mSecureAlbum == null) { + if (mShowSpinner) { mActionBar.disableAlbumModeMenu(true); } onCommitDeleteImage(); @@ -1271,7 +1275,7 @@ public class PhotoPage extends ActivityState implements mActionBar.setDisplayOptions( ((mSecureAlbum == null) && (mSetPathString != null)), false); mActionBar.addOnMenuVisibilityListener(mMenuVisibilityListener); - if (mSecureAlbum == null) { + if (mShowSpinner) { mActionBar.enableAlbumModeMenu( GalleryActionBar.ALBUM_FILMSTRIP_MODE_SELECTED, this); } -- cgit v1.2.3