From ed46d77c16cd80357f4a0feada2435dfba8104a6 Mon Sep 17 00:00:00 2001 From: Yuli Huang Date: Tue, 27 Mar 2012 12:10:27 +0800 Subject: Fix b/6212093: Title wasn't updated for orientation changes. Change-Id: I407cfb8f2bde5bab302045188f4f511bdcd2347a b:6212093 --- src/com/android/gallery3d/app/PhotoPage.java | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index 7daf5df0c..3a18dd2e4 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -322,25 +322,15 @@ public class PhotoPage extends ActivityState } } - private void setTitle(String title) { - if (title == null) return; - boolean showTitle = mActivity.getAndroidContext().getResources().getBoolean( - R.bool.show_action_bar_title); - if (showTitle) - mActionBar.setTitle(title); - else - mActionBar.setTitle(""); - } - private void updateCurrentPhoto(MediaItem photo) { if (mCurrentPhoto == photo) return; mCurrentPhoto = photo; if (mCurrentPhoto == null) return; updateMenuOperations(); + updateTitle(); if (mShowDetails) { mDetailsHelper.reloadDetails(mModel.getCurrentIndex()); } - setTitle(photo.getName()); mPhotoView.showVideoPlayIcon( photo.getMediaType() == MediaObject.MEDIA_TYPE_VIDEO); @@ -349,6 +339,16 @@ public class PhotoPage extends ActivityState } } + private void updateTitle() { + if (mCurrentPhoto == null) return; + boolean showTitle = mActivity.getAndroidContext().getResources().getBoolean( + R.bool.show_action_bar_title); + if (showTitle && mCurrentPhoto.getName() != null) + mActionBar.setTitle(mCurrentPhoto.getName()); + else + mActionBar.setTitle(""); + } + private void updateMenuOperations() { if (mMenu == null) return; MenuItem item = mMenu.findItem(R.id.action_slideshow); @@ -470,6 +470,7 @@ public class PhotoPage extends ActivityState mMenu = menu; mShowBars = true; updateMenuOperations(); + updateTitle(); return true; } -- cgit v1.2.3