From e16558a99e4bc0c9b78ee0587c4b4ac92c672eb0 Mon Sep 17 00:00:00 2001 From: huiyan Date: Thu, 21 Apr 2016 16:47:32 +0800 Subject: Gallery2: Fix menu icon is missing when change language on Videos page. If the gallery is in background ,the video page is saved to the stack. After the language change, the Gallery is destroyed. If gallery start again, the video page is restored from the stack. But the action bar is set to don't display the home as up in onResume, which set the navigation icon to null, so the menu icon can't display. If albumpage is started by Video option, the action bar set to display home option. If albumpage is start by others(albumnsetpage), the action bar set to display home as up option,to display menu icon or up icon rightly in action bar. Besides, fix to display the right title with the different language. Change-Id: Ieec0bd47400f6c0b698f5c2e842dc1038d9addcf CRs-Fixed: 1002171 --- res/values/strings.xml | 6 +++--- src/com/android/gallery3d/app/AlbumPage.java | 8 ++++++-- src/com/android/gallery3d/app/GalleryActionBar.java | 11 +++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 336962488..6cc605496 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1168,9 +1168,9 @@ CHAR LIMIT = NONE] --> Soften - Timeline - Albums - Videos + @string/timeline_title + @string/albums_title + @string/videos_title @string/app_name diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index 44fe2a650..4d2e291c1 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -498,8 +498,12 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster boolean enableHomeButton = (mActivity.getStateManager().getStateCount() > 1) | mParentMediaSetString != null; //GalleryActionBar actionBar = mActivity.getGalleryActionBar(); - mActionBar.setDisplayOptions(enableHomeButton, true); - + if (mIsVideoScreen) { + //if from video screen, show display navigation icon as home and title + mActionBar.setDisplayHome(true, true); + } else { + mActionBar.setDisplayOptions(enableHomeButton, true); + } Toolbar toolBar = mActivity.getToolbar(); if (enableHomeButton && toolBar != null) { toolBar.setNavigationContentDescription("back"); diff --git a/src/com/android/gallery3d/app/GalleryActionBar.java b/src/com/android/gallery3d/app/GalleryActionBar.java index 1e8458738..71bb6381a 100644 --- a/src/com/android/gallery3d/app/GalleryActionBar.java +++ b/src/com/android/gallery3d/app/GalleryActionBar.java @@ -329,6 +329,17 @@ public class GalleryActionBar { mActionBar.setHomeButtonEnabled(displayHomeAsUp); } + public void setDisplayHome(boolean displayHome, boolean showTitle) { + if (mActionBar == null) return; + int options = 0; + if (displayHome) options |= ActionBar.DISPLAY_SHOW_HOME; + if (showTitle) options |= ActionBar.DISPLAY_SHOW_TITLE; + + mActionBar.setDisplayOptions(options, + ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); + mActionBar.setHomeButtonEnabled(displayHome); + } + public void setTitle(String title) { if (mActionBar != null) mActionBar.setTitle(title); } -- cgit v1.2.3