Skip to content

Commit 3a3a6cf

Browse files
author
Dianne Hackborn
committed
Add new feature to let apps layout over status bar / system bar.
The main change is a few new flags you can supply to View.setSystemUiVisibility(). One is a new visibility mode, SYSTEM_UI_FLAG_FULLSCREEN, which is basically the same as the global FLAG_FULLSCREEN option for windows, but driven as part of the system UI state. There are also three new flags for telling the framework that you would like to have your application's UI ignore screen decorations -- SYSTEM_UI_FLAG_LAYOUT_NO_NAVIGATION for going behind the navigation bar and SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN for ignoring full screen decorations (that is the status bar). In combination with this you can use SYSTEM_UI_FLAG_LAYOUT_STABLE to have the framework report consistent insets to your application. When using NO_NAVIGATION, when the user taps the screen we now also automatically clear ONLY_CONTENT, so that we atomically show both UI elements. This should make it easy for apps like video players that want to move between fully full-screen and regular modes. The ActionBar has also been extended when in overlay mode so that it will adjust the system window insets to also account for its space, and allow it to be hidden using the new SYSTEM_UI_FLAG_FULLSCREEN. Change-Id: Ic8db1adec49a0f420bfe40c1d92eb21307856d0b
1 parent 5eeee5e commit 3a3a6cf

File tree

23 files changed

+907
-265
lines changed

23 files changed

+907
-265
lines changed

api/current.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23240,6 +23240,7 @@ package android.view {
2324023240
method public boolean dispatchUnhandledMove(android.view.View, int);
2324123241
method protected void dispatchVisibilityChanged(android.view.View, int);
2324223242
method public void dispatchWindowFocusChanged(boolean);
23243+
method public void dispatchWindowSystemUiVisiblityChanged(int);
2324323244
method public void dispatchWindowVisibilityChanged(int);
2324423245
method public void draw(android.graphics.Canvas);
2324523246
method protected void drawableStateChanged();
@@ -23353,6 +23354,7 @@ package android.view {
2335323354
method public int getVisibility();
2335423355
method public final int getWidth();
2335523356
method protected int getWindowAttachCount();
23357+
method public int getWindowSystemUiVisibility();
2335623358
method public android.os.IBinder getWindowToken();
2335723359
method public int getWindowVisibility();
2335823360
method public void getWindowVisibleDisplayFrame(android.graphics.Rect);
@@ -23456,6 +23458,7 @@ package android.view {
2345623458
method public boolean onTrackballEvent(android.view.MotionEvent);
2345723459
method protected void onVisibilityChanged(android.view.View, int);
2345823460
method public void onWindowFocusChanged(boolean);
23461+
method public void onWindowSystemUiVisibilityChanged(int);
2345923462
method protected void onWindowVisibilityChanged(int);
2346023463
method protected boolean overScrollBy(int, int, int, int, int, int, int, int, boolean);
2346123464
method public boolean performClick();
@@ -23473,6 +23476,7 @@ package android.view {
2347323476
method public boolean removeCallbacks(java.lang.Runnable);
2347423477
method public void removeOnAttachStateChangeListener(android.view.View.OnAttachStateChangeListener);
2347523478
method public void removeOnLayoutChangeListener(android.view.View.OnLayoutChangeListener);
23479+
method public void requestFitSystemWindows();
2347623480
method public final boolean requestFocus();
2347723481
method public final boolean requestFocus(int);
2347823482
method public boolean requestFocus(int, android.graphics.Rect);
@@ -23671,9 +23675,14 @@ package android.view {
2367123675
field public static final int SOUND_EFFECTS_ENABLED = 134217728; // 0x8000000
2367223676
field public static final deprecated int STATUS_BAR_HIDDEN = 1; // 0x1
2367323677
field public static final deprecated int STATUS_BAR_VISIBLE = 0; // 0x0
23678+
field public static final int SYSTEM_UI_FLAG_FULLSCREEN = 4; // 0x4
2367423679
field public static final int SYSTEM_UI_FLAG_HIDE_NAVIGATION = 2; // 0x2
23680+
field public static final int SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN = 1024; // 0x400
23681+
field public static final int SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION = 512; // 0x200
23682+
field public static final int SYSTEM_UI_FLAG_LAYOUT_STABLE = 256; // 0x100
2367523683
field public static final int SYSTEM_UI_FLAG_LOW_PROFILE = 1; // 0x1
2367623684
field public static final int SYSTEM_UI_FLAG_VISIBLE = 0; // 0x0
23685+
field public static final int SYSTEM_UI_LAYOUT_FLAGS = 1536; // 0x600
2367723686
field public static final int TEXT_DIRECTION_ANY_RTL = 2; // 0x2
2367823687
field protected static int TEXT_DIRECTION_DEFAULT;
2367923688
field public static final int TEXT_DIRECTION_FIRST_STRONG = 1; // 0x1
@@ -24037,6 +24046,7 @@ package android.view {
2403724046
method public abstract void requestChildFocus(android.view.View, android.view.View);
2403824047
method public abstract boolean requestChildRectangleOnScreen(android.view.View, android.graphics.Rect, boolean);
2403924048
method public abstract void requestDisallowInterceptTouchEvent(boolean);
24049+
method public abstract void requestFitSystemWindows();
2404024050
method public abstract void requestLayout();
2404124051
method public abstract boolean requestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
2404224052
method public abstract void requestTransparentRegion(android.view.View);

core/java/android/app/ActionBar.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,10 @@ public void setSplitBackgroundDrawable(Drawable d) { }
611611
* If the window hosting the ActionBar does not have the feature
612612
* {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application
613613
* content to fit the new space available.
614+
*
615+
* <p>If you are hiding the ActionBar through
616+
* {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN},
617+
* you should not call this function directly.
614618
*/
615619
public abstract void show();
616620

@@ -619,6 +623,12 @@ public void setSplitBackgroundDrawable(Drawable d) { }
619623
* If the window hosting the ActionBar does not have the feature
620624
* {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application
621625
* content to fit the new space available.
626+
*
627+
* <p>Instead of calling this function directly, you can also cause an
628+
* ActionBar using the overlay feature to hide through
629+
* {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}.
630+
* Hiding the ActionBar through this system UI flag allows you to more
631+
* seamlessly hide it in conjunction with other screen decorations.
622632
*/
623633
public abstract void hide();
624634

0 commit comments

Comments
 (0)