diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-05-05 20:36:38 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2012-05-06 11:52:05 -0700 |
commit | 139e5aa1da51b27231ab36344cf2d0dafab23f1e (patch) | |
tree | a15bf78ea4fc0f31bf8c6793aa0072c04c12fca0 /core/java/com/android/internal/widget/ActionBarOverlayLayout.java | |
parent | d0c66f6a8f15bb95648b4306d2583575d0bb9935 (diff) | |
download | frameworks_base-139e5aa1da51b27231ab36344cf2d0dafab23f1e.zip frameworks_base-139e5aa1da51b27231ab36344cf2d0dafab23f1e.tar.gz frameworks_base-139e5aa1da51b27231ab36344cf2d0dafab23f1e.tar.bz2 |
Fix issue #6404215: New ActionBar auto-hide can conflict with application
The action bar now maintains separate states for the things that can
impact its visibility (calls from the app, action mode, system UI) so
that the changes in these won't incorrectly mix together.
Also added a hack to force the status bar to be shown when showing
the action bar for an action mode, when the UI is in a state where
the action bar would be shown with a gap above where the status bar
is.
Change-Id: Ib0950a7f585c5d2c9e77d11b237ba6e150f15ebd
Diffstat (limited to 'core/java/com/android/internal/widget/ActionBarOverlayLayout.java')
-rw-r--r-- | core/java/com/android/internal/widget/ActionBarOverlayLayout.java | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/core/java/com/android/internal/widget/ActionBarOverlayLayout.java b/core/java/com/android/internal/widget/ActionBarOverlayLayout.java index d1652df..a129496 100644 --- a/core/java/com/android/internal/widget/ActionBarOverlayLayout.java +++ b/core/java/com/android/internal/widget/ActionBarOverlayLayout.java @@ -22,6 +22,7 @@ import android.content.Context; import android.content.res.TypedArray; import android.graphics.Rect; import android.util.AttributeSet; +import android.util.Log; import android.view.View; import android.widget.FrameLayout; @@ -76,6 +77,26 @@ public class ActionBarOverlayLayout extends FrameLayout { } } + public void setShowingForActionMode(boolean showing) { + if (showing) { + // Here's a fun hack: if the status bar is currently being hidden, + // and the application has asked for stable content insets, then + // we will end up with the action mode action bar being shown + // without the status bar, but moved below where the status bar + // would be. Not nice. Trying to have this be positioned + // correctly is not easy (basically we need yet *another* content + // inset from the window manager to know where to put it), so + // instead we will just temporarily force the status bar to be shown. + if ((getWindowSystemUiVisibility() & (SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + | SYSTEM_UI_FLAG_LAYOUT_STABLE)) + == (SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | SYSTEM_UI_FLAG_LAYOUT_STABLE)) { + setDisabledSystemUiVisibility(SYSTEM_UI_FLAG_FULLSCREEN); + } + } else { + setDisabledSystemUiVisibility(0); + } + } + @Override public void onWindowSystemUiVisibilityChanged(int visible) { super.onWindowSystemUiVisibilityChanged(visible); @@ -83,11 +104,13 @@ public class ActionBarOverlayLayout extends FrameLayout { final int diff = mLastSystemUiVisibility ^ visible; mLastSystemUiVisibility = visible; final boolean barVisible = (visible&SYSTEM_UI_FLAG_FULLSCREEN) == 0; - final boolean wasVisible = mActionBar != null ? mActionBar.isShowing() : true; - if (barVisible != wasVisible || (diff&SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0) { + final boolean wasVisible = mActionBar != null ? mActionBar.isSystemShowing() : true; + if (mActionBar != null) { + if (barVisible) mActionBar.showForSystem(); + else mActionBar.hideForSystem(); + } + if ((diff&SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0) { if (mActionBar != null) { - if (barVisible) mActionBar.show(true, true); - else mActionBar.hide(true); requestFitSystemWindows(); } } |