New system UI API demos.

- Content browser that hides nav bar.
- Translucent bars.
- All the new flags on the direct system UI tweaker example.

Change-Id: I16fc8da252174db1ed45b0f60c37d6cbb8d7f13c
diff --git a/samples/ApiDemos/AndroidManifest.xml b/samples/ApiDemos/AndroidManifest.xml
index 898de27..3d1d2c1 100644
--- a/samples/ApiDemos/AndroidManifest.xml
+++ b/samples/ApiDemos/AndroidManifest.xml
@@ -2401,6 +2401,17 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".view.ContentBrowserNavActivity"
+                android:label="Views/System UI Visibility/Content Browser Nav Bar"
+                android:theme="@android:style/Theme.Holo.Light.DarkActionBar"
+                android:uiOptions="splitActionBarWhenNarrow"
+                android:enabled="@bool/atLeastKitKat">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
         <activity android:name=".view.VideoPlayerActivity"
                 android:label="Views/System UI Visibility/Video Player"
                 android:theme="@android:style/Theme.Holo"
@@ -2412,6 +2423,16 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".view.TranslucentBarsActivity"
+                android:label="Views/System UI Visibility/Translucent Bars"
+                android:theme="@android:style/Theme.Holo.NoActionBar.TranslucentDecor"
+                android:enabled="@bool/atLeastKitKat">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
         <activity android:name=".view.Switches" android:label="Views/Switches">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
diff --git a/samples/ApiDemos/res/layout/content_browser_nav.xml b/samples/ApiDemos/res/layout/content_browser_nav.xml
new file mode 100644
index 0000000..e006620
--- /dev/null
+++ b/samples/ApiDemos/res/layout/content_browser_nav.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent" android:layout_height="match_parent"
+    >
+    <view class="com.example.android.apis.view.ContentBrowserNavActivity$Content"
+        android:id="@+id/content"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        />
+    <FrameLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:fitsSystemWindows="true"
+        android:animateLayoutChanges="true"
+        >
+        <TextView
+            android:id="@+id/title"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_gravity="top|center_horizontal"
+            android:textColor="#ff000000"
+            android:background="#c0ffffff"
+            android:textAppearance="?android:attr/textAppearanceLarge"
+            android:gravity="center"
+            android:padding="16dp"
+            android:text="A title goes here"
+            />
+        <SeekBar
+            android:id="@+id/seekbar"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_gravity="bottom|center_horizontal"
+            android:layout_marginBottom="16dp"
+            />
+    </FrameLayout>
+</FrameLayout>
diff --git a/samples/ApiDemos/res/layout/system_ui_modes.xml b/samples/ApiDemos/res/layout/system_ui_modes.xml
index aaf6c1a..a4e63e3 100644
--- a/samples/ApiDemos/res/layout/system_ui_modes.xml
+++ b/samples/ApiDemos/res/layout/system_ui_modes.xml
@@ -28,126 +28,159 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:fitsSystemWindows="true">
-        <GridLayout android:layout_width="match_parent"
+        <ScrollView
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginLeft="25dp"
             android:layout_marginRight="25dp"
             android:layout_marginBottom="25dp"
             android:layout_gravity="bottom|center"
-            android:background="#60000000"
-            android:padding="8dp"
-            android:columnCount="2">
+            android:background="#60000000">
+            <GridLayout android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:padding="8dp"
+                android:columnCount="@integer/system_ui_modes_cols">
 
-            <TextView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="#FFFFFFFF"
-                android:textSize="16dp"
-                android:textStyle="bold"
-                android:gravity="left"
-                android:text="Mode:"
-                />
-            <CheckBox
-                android:id="@+id/modeFullscreen"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="#FFFFFFFF"
-                android:text="FULLSCRN"
-                />
-            <CheckBox
-                android:id="@+id/modeLowProfile"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="#FFFFFFFF"
-                android:text="LOW_PROFILE"
-                />
-            <CheckBox
-                android:id="@+id/modeHideNavigation"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="#FFFFFFFF"
-                android:text="HIDE_NAV"
-                />
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="#FFFFFFFF"
+                    android:textSize="16dp"
+                    android:textStyle="bold"
+                    android:gravity="left"
+                    android:text="Mode:"
+                    />
+                <CheckBox
+                    android:id="@+id/modeFullscreen"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="#FFFFFFFF"
+                    android:text="FULLSCRN"
+                    />
+                <CheckBox
+                    android:id="@+id/modeLowProfile"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="#FFFFFFFF"
+                    android:text="LOW_PROFILE"
+                    />
+                <CheckBox
+                    android:id="@+id/modeHideNavigation"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="#FFFFFFFF"
+                    android:text="HIDE_NAV"
+                    />
+                <CheckBox
+                    android:id="@+id/modeImmersive"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="#FFFFFFFF"
+                    android:text="IMMERSIVE"
+                    />
+                <CheckBox
+                    android:id="@+id/modeImmersiveSticky"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="#FFFFFFFF"
+                    android:text="IMM_STICKY"
+                    />
 
-            <TextView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="#FFFFFFFF"
-                android:textSize="16dp"
-                android:textStyle="bold"
-                android:gravity="left"
-                android:text="Layout:"
-                />
-            <CheckBox
-                android:id="@+id/layoutFullscreen"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="#FFFFFFFF"
-                android:text="FULLSCRN"
-                />
-            <CheckBox
-                android:id="@+id/layoutStable"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="#FFFFFFFF"
-                android:text="STABLE"
-                />
-            <CheckBox
-                android:id="@+id/layoutHideNavigation"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="#FFFFFFFF"
-                android:text="HIDE_NAV"
-                />
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="#FFFFFFFF"
+                    android:textSize="16dp"
+                    android:textStyle="bold"
+                    android:gravity="left"
+                    android:text="Layout:"
+                    />
+                <CheckBox
+                    android:id="@+id/layoutFullscreen"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="#FFFFFFFF"
+                    android:text="FULLSCRN"
+                    />
+                <CheckBox
+                    android:id="@+id/layoutStable"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="#FFFFFFFF"
+                    android:text="STABLE"
+                    />
+                <CheckBox
+                    android:id="@+id/layoutHideNavigation"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="#FFFFFFFF"
+                    android:text="HIDE_NAV"
+                    />
 
-            <TextView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_columnSpan="2"
-                android:textColor="#FFFFFFFF"
-                android:textSize="16dp"
-                android:textStyle="bold"
-                android:gravity="left"
-                android:text="Window:"
-                />
-            <CheckBox
-                android:id="@+id/windowHideActionBar"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="#FFFFFFFF"
-                android:text="No ActionBar"
-                />
-            <CheckBox
-                android:id="@+id/windowFullscreen"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="#FFFFFFFF"
-                android:text="FULLSCRN"
-                />
-            <CheckBox
-                android:id="@+id/windowActionMode"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="#FFFFFFFF"
-                android:text="Action Mode"
-                />
-            <CheckBox
-                android:id="@+id/windowOverscan"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="#FFFFFFFF"
-                android:text="OVERSCAN"
-                />
-            <TextView
-                android:id="@+id/metricsText"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_columnSpan="2"
-                android:textColor="#FFFFFFFF"
-                android:textSize="11dp"
-                android:textStyle="bold"
-                android:gravity="center"
-                />
-        </GridLayout>
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_columnSpan="@integer/system_ui_modes_cols"
+                    android:textColor="#FFFFFFFF"
+                    android:textSize="16dp"
+                    android:textStyle="bold"
+                    android:gravity="left"
+                    android:text="Window:"
+                    />
+                <CheckBox
+                    android:id="@+id/windowHideActionBar"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="#FFFFFFFF"
+                    android:text="No ActionBar"
+                    />
+                <CheckBox
+                    android:id="@+id/windowFullscreen"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="#FFFFFFFF"
+                    android:text="FULLSCRN"
+                    />
+                <CheckBox
+                    android:id="@+id/windowActionMode"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="#FFFFFFFF"
+                    android:text="Action Mode"
+                    />
+                <CheckBox
+                    android:id="@+id/windowOverscan"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="#FFFFFFFF"
+                    android:text="OVERSCAN"
+                    />
+                <CheckBox
+                    android:id="@+id/windowTranslucentStatus"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="#FFFFFFFF"
+                    android:text="TRANS_STATUS"
+                    />
+                <CheckBox
+                    android:id="@+id/windowTranslucentNav"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="#FFFFFFFF"
+                    android:text="TRANS_NAV"
+                    />
+
+                <TextView
+                    android:id="@+id/metricsText"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_columnSpan="@integer/system_ui_modes_cols"
+                    android:textColor="#FFFFFFFF"
+                    android:textSize="11dp"
+                    android:textStyle="bold"
+                    android:gravity="center"
+                    />
+            </GridLayout>
+        </ScrollView>
     </FrameLayout>
 </FrameLayout>
diff --git a/samples/ApiDemos/res/layout/translucent_bars.xml b/samples/ApiDemos/res/layout/translucent_bars.xml
new file mode 100644
index 0000000..c7cbe40
--- /dev/null
+++ b/samples/ApiDemos/res/layout/translucent_bars.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/content"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+    <TextView android:id="@+id/text"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:fitsSystemWindows="true"
+            android:textSize="16dp"
+            android:text="@string/alert_dialog_two_buttons2ultra_msg" />
+</ScrollView>
diff --git a/samples/ApiDemos/res/values-land/integers.xml b/samples/ApiDemos/res/values-land/integers.xml
new file mode 100644
index 0000000..d7e7c37
--- /dev/null
+++ b/samples/ApiDemos/res/values-land/integers.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources>
+  <!-- For the System UI Modes API demo, this is the number of columns to use
+       for the mode options.  Changes between portrait and landscape. -->
+  <integer name="system_ui_modes_cols">3</integer>
+</resources>
diff --git a/samples/ApiDemos/res/values-v19/bools.xml b/samples/ApiDemos/res/values-v19/bools.xml
new file mode 100644
index 0000000..136d8fe
--- /dev/null
+++ b/samples/ApiDemos/res/values-v19/bools.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources>
+    <!-- This resource is true if running under at least KitKat
+         API level.  The default value is false; an alternative value
+         for KitKat is true. -->
+    <bool name="atLeastKitKat">true</bool>
+</resources>
diff --git a/samples/ApiDemos/res/values/bools.xml b/samples/ApiDemos/res/values/bools.xml
index 366d733..fa3f25f 100644
--- a/samples/ApiDemos/res/values/bools.xml
+++ b/samples/ApiDemos/res/values/bools.xml
@@ -44,4 +44,9 @@
          for JellyBean MR 2 is true. -->
     <bool name="atLeastJellyBeanMR2">false</bool>
 
+    <!-- This resource is true if running under at least KitKat
+         API level.  The default value is false; an alternative value
+         for KitKat is true. -->
+    <bool name="atLeastKitKat">false</bool>
+
 </resources>
diff --git a/samples/ApiDemos/res/values/integers.xml b/samples/ApiDemos/res/values/integers.xml
new file mode 100644
index 0000000..70a6c69
--- /dev/null
+++ b/samples/ApiDemos/res/values/integers.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources>
+  <!-- For the System UI Modes API demo, this is the number of columns to use
+       for the mode options.  Changes between portrait and landscape. -->
+  <integer name="system_ui_modes_cols">2</integer>
+</resources>
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/ContentBrowserNavActivity.java b/samples/ApiDemos/src/com/example/android/apis/view/ContentBrowserNavActivity.java
new file mode 100644
index 0000000..2c5f7bf
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/view/ContentBrowserNavActivity.java
@@ -0,0 +1,266 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.apis.view;
+
+import android.app.ActionBar;
+import android.app.ActionBar.Tab;
+import android.app.Activity;
+import android.app.FragmentTransaction;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Handler;
+import android.util.AttributeSet;
+import android.util.TypedValue;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.widget.Button;
+import android.widget.ScrollView;
+import android.widget.SearchView;
+import android.widget.SeekBar;
+import android.widget.ShareActionProvider;
+import android.widget.TextView;
+import android.widget.Toast;
+import android.widget.SearchView.OnQueryTextListener;
+
+import com.example.android.apis.R;
+
+/**
+ * This activity demonstrates how to use system UI flags to implement
+ * a content browser style of UI (such as a book reader) that hides the
+ * nav bar as well as the status bar.
+ */
+public class ContentBrowserNavActivity extends Activity
+        implements OnQueryTextListener, ActionBar.TabListener {
+
+    /**
+     * Implementation of a view for displaying immersive content, using system UI
+     * flags to transition in and out of modes where the user is focused on that
+     * content.
+     */
+//BEGIN_INCLUDE(content)
+    public static class Content extends ScrollView
+            implements View.OnSystemUiVisibilityChangeListener, View.OnClickListener {
+        TextView mText;
+        TextView mTitleView;
+        SeekBar mSeekView;
+        boolean mNavVisible;
+        int mBaseSystemUiVisibility = SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+                | SYSTEM_UI_FLAG_LAYOUT_STABLE | SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
+        int mLastSystemUiVis;
+
+        Runnable mNavHider = new Runnable() {
+            @Override public void run() {
+                setNavVisibility(false);
+            }
+        };
+
+        public Content(Context context, AttributeSet attrs) {
+            super(context, attrs);
+    
+            mText = new TextView(context);
+            mText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
+            mText.setText(context.getString(R.string.alert_dialog_two_buttons2ultra_msg));
+            mText.setClickable(false);
+            mText.setOnClickListener(this);
+            mText.setTextIsSelectable(true);
+            addView(mText, new ViewGroup.LayoutParams(
+                    ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
+
+            setOnSystemUiVisibilityChangeListener(this);
+        }
+
+        public void init(TextView title, SeekBar seek) {
+            // This called by the containing activity to supply the surrounding
+            // state of the content browser that it will interact with.
+            mTitleView = title;
+            mSeekView = seek;
+            setNavVisibility(true);
+        }
+
+        @Override public void onSystemUiVisibilityChange(int visibility) {
+            // Detect when we go out of low-profile mode, to also go out
+            // of full screen.  We only do this when the low profile mode
+            // is changing from its last state, and turning off.
+            int diff = mLastSystemUiVis ^ visibility;
+            mLastSystemUiVis = visibility;
+            if ((diff&SYSTEM_UI_FLAG_LOW_PROFILE) != 0
+                    && (visibility&SYSTEM_UI_FLAG_LOW_PROFILE) == 0) {
+                setNavVisibility(true);
+            }
+        }
+
+        @Override protected void onWindowVisibilityChanged(int visibility) {
+            super.onWindowVisibilityChanged(visibility);
+
+            // When we become visible, we show our navigation elements briefly
+            // before hiding them.
+            setNavVisibility(true);
+            getHandler().postDelayed(mNavHider, 2000);
+        }
+
+        @Override protected void onScrollChanged(int l, int t, int oldl, int oldt) {
+            super.onScrollChanged(l, t, oldl, oldt);
+
+            // When the user scrolls, we hide navigation elements.
+            setNavVisibility(false);
+        }
+
+        @Override public void onClick(View v) {
+            // When the user clicks, we toggle the visibility of navigation elements.
+            int curVis = getSystemUiVisibility();
+            setNavVisibility((curVis&SYSTEM_UI_FLAG_LOW_PROFILE) != 0);
+        }
+
+        void setBaseSystemUiVisibility(int visibility) {
+            mBaseSystemUiVisibility = visibility;
+        }
+
+        void setNavVisibility(boolean visible) {
+            int newVis = mBaseSystemUiVisibility;
+            if (!visible) {
+                newVis |= SYSTEM_UI_FLAG_LOW_PROFILE | SYSTEM_UI_FLAG_FULLSCREEN
+                        | SYSTEM_UI_FLAG_HIDE_NAVIGATION | SYSTEM_UI_FLAG_IMMERSIVE;
+            }
+            final boolean changed = newVis == getSystemUiVisibility();
+
+            // Unschedule any pending event to hide navigation if we are
+            // changing the visibility, or making the UI visible.
+            if (changed || visible) {
+                Handler h = getHandler();
+                if (h != null) {
+                    h.removeCallbacks(mNavHider);
+                }
+            }
+
+            // Set the new desired visibility.
+            setSystemUiVisibility(newVis);
+            mTitleView.setVisibility(visible ? VISIBLE : INVISIBLE);
+            mSeekView.setVisibility(visible ? VISIBLE : INVISIBLE);
+        }
+    }
+//END_INCLUDE(content)
+
+    Content mContent;
+
+    public ContentBrowserNavActivity() {
+    }
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
+
+        setContentView(R.layout.content_browser_nav);
+        mContent = (Content)findViewById(R.id.content);
+        mContent.init((TextView)findViewById(R.id.title),
+                (SeekBar)findViewById(R.id.seekbar));
+
+        ActionBar bar = getActionBar();
+        bar.addTab(bar.newTab().setText("Tab 1").setTabListener(this));
+        bar.addTab(bar.newTab().setText("Tab 2").setTabListener(this));
+        bar.addTab(bar.newTab().setText("Tab 3").setTabListener(this));
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        MenuInflater inflater = getMenuInflater();
+        inflater.inflate(R.menu.content_actions, menu);
+        SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
+        searchView.setOnQueryTextListener(this);
+
+        // Set file with share history to the provider and set the share intent.
+        MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar);
+        ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider();
+        actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
+        // Note that you can set/change the intent any time,
+        // say when the user has selected an image.
+        Intent shareIntent = new Intent(Intent.ACTION_SEND);
+        shareIntent.setType("image/*");
+        Uri uri = Uri.fromFile(getFileStreamPath("shared.png"));
+        shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
+        actionProvider.setShareIntent(shareIntent);
+        return true;
+    }
+
+    @Override
+    public void onAttachedToWindow() {
+        super.onAttachedToWindow();
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+    }
+
+    /**
+     * This method is declared in the menu.
+     */
+    public void onSort(MenuItem item) {
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case R.id.show_tabs:
+                getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
+                item.setChecked(true);
+                return true;
+            case R.id.hide_tabs:
+                getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
+                item.setChecked(true);
+                return true;
+            case R.id.stable_layout:
+                item.setChecked(!item.isChecked());
+                mContent.setBaseSystemUiVisibility(item.isChecked()
+                        ? View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+                                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+                        : View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
+                return true;
+        }
+        return false;
+    }
+
+    @Override
+    public boolean onQueryTextChange(String newText) {
+        return true;
+    }
+
+    @Override
+    public boolean onQueryTextSubmit(String query) {
+        Toast.makeText(this, "Searching for: " + query + "...", Toast.LENGTH_SHORT).show();
+        return true;
+    }
+
+    @Override
+    public void onTabSelected(Tab tab, FragmentTransaction ft) {
+    }
+
+    @Override
+    public void onTabUnselected(Tab tab, FragmentTransaction ft) {
+    }
+
+    @Override
+    public void onTabReselected(Tab tab, FragmentTransaction ft) {
+    }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/SystemUIModes.java b/samples/ApiDemos/src/com/example/android/apis/view/SystemUIModes.java
index 730534a..8197e05 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/SystemUIModes.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/SystemUIModes.java
@@ -136,6 +136,30 @@
         win.setAttributes(winParams);
     }
 
+    private void setTranslucentStatus(boolean on) {
+        Window win = getWindow();
+        WindowManager.LayoutParams winParams = win.getAttributes();
+        final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
+        if (on) {
+            winParams.flags |=  bits;
+        } else {
+            winParams.flags &= ~bits;
+        }
+        win.setAttributes(winParams);
+    }
+
+    private void setTranslucentNavigation(boolean on) {
+        Window win = getWindow();
+        WindowManager.LayoutParams winParams = win.getAttributes();
+        final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
+        if (on) {
+            winParams.flags |=  bits;
+        } else {
+            winParams.flags &= ~bits;
+        }
+        win.setAttributes(winParams);
+    }
+
     private String getDisplaySize() {
         DisplayMetrics dm = getResources().getDisplayMetrics();
         return String.format("DisplayMetrics = (%d x %d)", dm.widthPixels, dm.heightPixels);
@@ -151,9 +175,10 @@
 
     static int TOAST_LENGTH = 500;
     IV mImage;
-    CheckBox[] mCheckControls = new CheckBox[6];
+    CheckBox[] mCheckControls = new CheckBox[8];
     int[] mCheckFlags = new int[] { View.SYSTEM_UI_FLAG_LOW_PROFILE,
             View.SYSTEM_UI_FLAG_FULLSCREEN, View.SYSTEM_UI_FLAG_HIDE_NAVIGATION,
+            View.SYSTEM_UI_FLAG_IMMERSIVE, View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY,
             View.SYSTEM_UI_FLAG_LAYOUT_STABLE, View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN,
             View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
     };
@@ -179,9 +204,11 @@
         mCheckControls[0] = (CheckBox) findViewById(R.id.modeLowProfile);
         mCheckControls[1] = (CheckBox) findViewById(R.id.modeFullscreen);
         mCheckControls[2] = (CheckBox) findViewById(R.id.modeHideNavigation);
-        mCheckControls[3] = (CheckBox) findViewById(R.id.layoutStable);
-        mCheckControls[4] = (CheckBox) findViewById(R.id.layoutFullscreen);
-        mCheckControls[5] = (CheckBox) findViewById(R.id.layoutHideNavigation);
+        mCheckControls[3] = (CheckBox) findViewById(R.id.modeImmersive);
+        mCheckControls[4] = (CheckBox) findViewById(R.id.modeImmersiveSticky);
+        mCheckControls[5] = (CheckBox) findViewById(R.id.layoutStable);
+        mCheckControls[6] = (CheckBox) findViewById(R.id.layoutFullscreen);
+        mCheckControls[7] = (CheckBox) findViewById(R.id.layoutHideNavigation);
         for (int i=0; i<mCheckControls.length; i++) {
             mCheckControls[i].setOnCheckedChangeListener(checkChangeListener);
         }
@@ -201,6 +228,22 @@
                     }
                 }
         );
+        ((CheckBox) findViewById(R.id.windowTranslucentStatus)).setOnCheckedChangeListener(
+                new CompoundButton.OnCheckedChangeListener() {
+                    @Override
+                    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                        setTranslucentStatus(isChecked);
+                    }
+                }
+        );
+        ((CheckBox) findViewById(R.id.windowTranslucentNav)).setOnCheckedChangeListener(
+                new CompoundButton.OnCheckedChangeListener() {
+                    @Override
+                    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                        setTranslucentNavigation(isChecked);
+                    }
+                }
+        );
         ((CheckBox) findViewById(R.id.windowHideActionBar)).setOnCheckedChangeListener(
                 new CompoundButton.OnCheckedChangeListener() {
                     @Override
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/TranslucentBarsActivity.java b/samples/ApiDemos/src/com/example/android/apis/view/TranslucentBarsActivity.java
new file mode 100644
index 0000000..98c11d1
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/view/TranslucentBarsActivity.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.apis.view;
+
+import android.app.Activity;
+import android.os.Bundle;
+import com.example.android.apis.R;
+
+/**
+ * This activity demonstrates a simple implementation of displaying
+ * content with translucent system UI bars.
+ */
+public class TranslucentBarsActivity extends Activity {
+    public TranslucentBarsActivity() {
+    }
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.translucent_bars);
+    }
+}