diff options
Diffstat (limited to 'photoviewer')
3 files changed, 7 insertions, 31 deletions
diff --git a/photoviewer/src/com/android/ex/photo/Intents.java b/photoviewer/src/com/android/ex/photo/Intents.java index be90b69..0e64730 100644 --- a/photoviewer/src/com/android/ex/photo/Intents.java +++ b/photoviewer/src/com/android/ex/photo/Intents.java @@ -20,7 +20,6 @@ package com.android.ex.photo; import android.content.ContentProvider; import android.content.Context; import android.content.Intent; -import android.text.TextUtils; import com.android.ex.photo.fragments.PhotoViewFragment; @@ -33,7 +32,6 @@ public class Intents { public static final String EXTRA_PHOTO_ID = "photo_id"; public static final String EXTRA_PHOTOS_URI = "photos_uri"; public static final String EXTRA_RESOLVED_PHOTO_URI = "resolved_photo_uri"; - public static final String EXTRA_PHOTO_NAME = "photo_name"; public static final String EXTRA_PROJECTION = "projection"; public static final String EXTRA_THUMBNAIL_URI = "thumbnail_uri"; @@ -67,8 +65,6 @@ public class Intents { public static class PhotoViewIntentBuilder { private final Intent mIntent; - /** The name of the photo being displayed */ - private String mPhotoName; /** The index of the photo to show */ private Integer mPhotoIndex; /** The URI of the group of photos to display */ @@ -84,12 +80,6 @@ public class Intents { mIntent = new Intent(context, cls); } - /** Sets the photo name */ - public PhotoViewIntentBuilder setPhotoName(String photoName) { - mPhotoName = photoName; - return this; - } - /** Sets the photo index */ public PhotoViewIntentBuilder setPhotoIndex(Integer photoIndex) { mPhotoIndex = photoIndex; @@ -132,10 +122,6 @@ public class Intents { mIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); - if (mPhotoName != null) { - mIntent.putExtra(EXTRA_PHOTO_NAME, mPhotoName); - } - if (mPhotoIndex != null) { mIntent.putExtra(EXTRA_PHOTO_INDEX, (int) mPhotoIndex); } diff --git a/photoviewer/src/com/android/ex/photo/PhotoViewActivity.java b/photoviewer/src/com/android/ex/photo/PhotoViewActivity.java index aa8029e..7a4c6a9 100644 --- a/photoviewer/src/com/android/ex/photo/PhotoViewActivity.java +++ b/photoviewer/src/com/android/ex/photo/PhotoViewActivity.java @@ -116,8 +116,6 @@ public class PhotoViewActivity extends Activity implements private int mPhotoIndex; /** The query projection to use; may be {@code null} */ private String[] mProjection; - /** The name of the particular photo being viewed. */ - private String mPhotoName; /** The total number of photos; only valid if {@link #mIsEmpty} is {@code false}. */ private int mAlbumCount = ALBUM_COUNT_UNKNOWN; /** {@code true} if the view is empty. Otherwise, {@code false}. */ @@ -161,13 +159,6 @@ public class PhotoViewActivity extends Activity implements mFullScreen = savedInstanceState.getBoolean(STATE_FULLSCREEN_KEY, false); } - // album name; if not set, use a default name - if (mIntent.hasExtra(Intents.EXTRA_PHOTO_NAME)) { - mPhotoName = mIntent.getStringExtra(Intents.EXTRA_PHOTO_NAME); - } else { - mPhotoName = getResources().getString(R.string.photo_view_default_title); - } - // uri of the photos to view; optional if (mIntent.hasExtra(Intents.EXTRA_PHOTOS_URI)) { mPhotosUri = mIntent.getStringExtra(Intents.EXTRA_PHOTOS_URI); @@ -207,6 +198,7 @@ public class PhotoViewActivity extends Activity implements mActionBarHideDelayTime = getResources().getInteger( R.integer.action_bar_delay_time_in_millis); actionBar.addOnMenuVisibilityListener(this); + actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); mActionBarHideHandler = new Handler(); } @@ -483,6 +475,7 @@ public class PhotoViewActivity extends Activity implements */ protected void updateActionBar(PhotoViewFragment fragment) { final int position = mViewPager.getCurrentItem() + 1; + final String title; final String subtitle; final boolean hasAlbumCount = mAlbumCount >= 0; @@ -490,7 +483,9 @@ public class PhotoViewActivity extends Activity implements if (cursor != null) { final int photoNameIndex = cursor.getColumnIndex(PhotoContract.PhotoViewColumns.NAME); - mPhotoName = cursor.getString(photoNameIndex); + title = cursor.getString(photoNameIndex); + } else { + title = null; } if (mIsEmpty || !hasAlbumCount || position <= 0) { @@ -500,8 +495,8 @@ public class PhotoViewActivity extends Activity implements } final ActionBar actionBar = getActionBar(); - - actionBar.setTitle(mPhotoName); + actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE); + actionBar.setTitle(title); actionBar.setSubtitle(subtitle); } diff --git a/photoviewer/src/com/android/ex/photo/adapters/PhotoPagerAdapter.java b/photoviewer/src/com/android/ex/photo/adapters/PhotoPagerAdapter.java index 28756c1..3cc387f 100644 --- a/photoviewer/src/com/android/ex/photo/adapters/PhotoPagerAdapter.java +++ b/photoviewer/src/com/android/ex/photo/adapters/PhotoPagerAdapter.java @@ -32,7 +32,6 @@ import com.android.ex.photo.provider.PhotoContract; */ public class PhotoPagerAdapter extends BaseCursorPagerAdapter { private int mContentUriIndex; - private int mPhotoNameIndex; private int mThumbnailUriIndex; public PhotoPagerAdapter(Context context, FragmentManager fm, Cursor c) { @@ -42,14 +41,12 @@ public class PhotoPagerAdapter extends BaseCursorPagerAdapter { @Override public Fragment getItem(Context context, Cursor cursor, int position) { final String photoUri = cursor.getString(mContentUriIndex); - final String photoName = cursor.getString(mPhotoNameIndex); final String thumbnailUri = cursor.getString(mThumbnailUriIndex); // create new PhotoViewFragment final PhotoViewIntentBuilder builder = Intents.newPhotoViewFragmentIntentBuilder(mContext); builder - .setPhotoName(photoName) .setResolvedPhotoUri(photoUri) .setThumbnailUri(thumbnailUri); @@ -62,8 +59,6 @@ public class PhotoPagerAdapter extends BaseCursorPagerAdapter { newCursor.getColumnIndex(PhotoContract.PhotoViewColumns.CONTENT_URI); mThumbnailUriIndex = newCursor.getColumnIndex(PhotoContract.PhotoViewColumns.THUMBNAIL_URI); - mPhotoNameIndex = - newCursor.getColumnIndex(PhotoContract.PhotoViewColumns.NAME); return super.swapCursor(newCursor); } |