From f65bfb700b19dbd2b0936d583c1493477e6d8a25 Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Thu, 19 Jun 2014 10:55:28 -0700 Subject: [PATCH] Fix ActionBar#isShowing when called before first layout Fix a regression introduced by the new hide offset API addition where an action bar height of 0 (not yet measured) would cause the bar to be considered hidden. Bug 14574446 Change-Id: Ic8e22923ab59df6078136daa336e074c4b7adaf5 --- core/java/com/android/internal/app/WindowDecorActionBar.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/java/com/android/internal/app/WindowDecorActionBar.java b/core/java/com/android/internal/app/WindowDecorActionBar.java index 87a80ace347fb..7bd316f315194 100644 --- a/core/java/com/android/internal/app/WindowDecorActionBar.java +++ b/core/java/com/android/internal/app/WindowDecorActionBar.java @@ -830,7 +830,9 @@ public class WindowDecorActionBar extends ActionBar implements } public boolean isShowing() { - return mNowShowing && getHideOffset() < getHeight(); + final int height = getHeight(); + // Take into account the case where the bar has a 0 height due to not being measured yet. + return mNowShowing && (height == 0 || getHideOffset() < height); } void animateToMode(boolean toActionMode) {