Add transparent status bar demo
BUG: 20652400
Change-Id: Iac7b06c18f0f370a8afdc4f91131ee9c59dc1c02
(cherry picked from commit c7495a949c3e846d2c4ae61918b3409f7be00fe4)
diff --git a/samples/SupportDesignDemos/AndroidManifest.xml b/samples/SupportDesignDemos/AndroidManifest.xml
index a349235..0835d23 100644
--- a/samples/SupportDesignDemos/AndroidManifest.xml
+++ b/samples/SupportDesignDemos/AndroidManifest.xml
@@ -153,6 +153,15 @@
</intent-filter>
</activity>
+ <activity android:name=".widget.AppBarLayoutToolbarCollapseWithImageWithInsets"
+ android:label="@string/design_appbar_collapsing_toolbar_with_image_insets"
+ android:theme="@style/Theme.Design.TransparentStatus">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.support.design.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
<activity android:name=".widget.AppBarLayoutToolbarParallaxOverlapContent"
android:label="@string/design_appbar_parallax_overlap"
android:theme="@style/Theme.Design">
diff --git a/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_pin.xml b/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_pin.xml
index d41c20b..2809b04 100644
--- a/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_pin.xml
+++ b/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_pin.xml
@@ -22,14 +22,14 @@
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
- android:layout_height="wrap_content"
+ android:layout_height="192dp"
android:layout_width="match_parent"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_app_bar"
android:layout_width="match_parent"
- android:layout_height="192dp"
+ android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.v7.widget.Toolbar
diff --git a/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_pin_with_fab.xml b/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_pin_with_fab.xml
index ac03794..cff9d92 100644
--- a/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_pin_with_fab.xml
+++ b/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_pin_with_fab.xml
@@ -23,14 +23,14 @@
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
- android:layout_height="wrap_content"
+ android:layout_height="192dp"
android:layout_width="match_parent"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_app_bar"
android:layout_width="match_parent"
- android:layout_height="192dp"
+ android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.v7.widget.Toolbar
diff --git a/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_scroll.xml b/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_scroll.xml
index 560dee0..a865ca3 100644
--- a/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_scroll.xml
+++ b/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_scroll.xml
@@ -21,14 +21,14 @@
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
- android:layout_height="wrap_content"
+ android:layout_height="192dp"
android:layout_width="match_parent"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_app_bar"
android:layout_width="match_parent"
- android:layout_height="192dp"
+ android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed">
<android.support.v7.widget.Toolbar
diff --git a/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_with_image.xml b/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_with_image.xml
index 66cad42..ebdbf10 100644
--- a/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_with_image.xml
+++ b/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_with_image.xml
@@ -22,16 +22,16 @@
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
- android:layout_height="wrap_content"
+ android:layout_height="192dp"
android:layout_width="match_parent"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_app_bar"
android:layout_width="match_parent"
- android:layout_height="192dp"
+ android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
- app:foregroundScrimColor="?attr/colorPrimary">
+ app:contentScrim="?attr/colorPrimary">
<ImageView
android:id="@+id/app_bar_image"
diff --git a/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_with_image_insets.xml b/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_with_image_insets.xml
new file mode 100644
index 0000000..95f13c3
--- /dev/null
+++ b/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_with_image_insets.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 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.
+ -->
+
+<android.support.design.widget.CoordinatorLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fitsSystemWindows="true">
+
+ <android.support.design.widget.AppBarLayout
+ android:layout_height="256dp"
+ android:layout_width="match_parent"
+ android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
+ android:fitsSystemWindows="true">
+
+ <android.support.design.widget.CollapsingToolbarLayout
+ android:id="@+id/collapsing_app_bar"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ app:layout_scrollFlags="scroll|exitUntilCollapsed"
+ app:contentScrim="?attr/colorPrimary">
+
+ <ImageView
+ android:id="@+id/app_bar_image"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ app:layout_collapseMode="parallax"
+ android:src="@drawable/photo"
+ android:scaleType="centerCrop"/>
+
+ <android.support.v7.widget.Toolbar
+ android:id="@+id/toolbar"
+ android:layout_height="?attr/actionBarSize"
+ android:layout_width="match_parent"
+ app:layout_collapseMode="pin"/>
+
+ </android.support.design.widget.CollapsingToolbarLayout>
+
+ </android.support.design.widget.AppBarLayout>
+
+ <include layout="@layout/include_appbar_scrollview"/>
+
+</android.support.design.widget.CoordinatorLayout>
diff --git a/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_parallax_overlap.xml b/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_parallax_overlap.xml
index ff21686..98158e7 100644
--- a/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_parallax_overlap.xml
+++ b/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_parallax_overlap.xml
@@ -22,17 +22,17 @@
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
- android:layout_height="wrap_content"
+ android:layout_height="192dp"
android:layout_width="match_parent"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_app_bar"
android:layout_width="match_parent"
- android:layout_height="192dp"
+ android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:layout_scrollInterpolator="@android:anim/decelerate_interpolator"
- app:foregroundScrimColor="?attr/colorPrimary">
+ app:contentScrim="?attr/colorPrimary">
<ImageView
android:id="@+id/app_bar_image"
diff --git a/samples/SupportDesignDemos/res/values-v21/styles.xml b/samples/SupportDesignDemos/res/values-v21/styles.xml
index 8faf5e6..298dcf3 100644
--- a/samples/SupportDesignDemos/res/values-v21/styles.xml
+++ b/samples/SupportDesignDemos/res/values-v21/styles.xml
@@ -17,6 +17,11 @@
<resources>
+ <style name="Theme.Design.TransparentStatus">
+ <item name="android:statusBarColor">@android:color/transparent</item>
+ <item name="android:windowDrawsSystemBarBackgrounds">true</item>
+ </style>
+
<style name="Theme.Navigation" parent="Theme.Navigation.Base">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
diff --git a/samples/SupportDesignDemos/res/values/strings.xml b/samples/SupportDesignDemos/res/values/strings.xml
index 52eadf0..c1d0bd6 100644
--- a/samples/SupportDesignDemos/res/values/strings.xml
+++ b/samples/SupportDesignDemos/res/values/strings.xml
@@ -69,6 +69,7 @@
<string name="design_appbar_collapsing_toolbar_pin_fab">AppBar/Collapsing Toolbar (pinned with FAB)</string>
<string name="design_appbar_collapsing_toolbar_scroll">AppBar/Collapsing Toolbar (scroll off)</string>
<string name="design_appbar_collapsing_toolbar_with_image">AppBar/Collapsing Toolbar + Parallax Image</string>
+ <string name="design_appbar_collapsing_toolbar_with_image_insets">AppBar/Collapsing Toolbar + Parallax Image + Insets</string>
<string name="design_appbar_parallax_overlap">AppBar/Parallax Overlapping content</string>
<string name="scroll_top">Top</string>
<string name="scroll_bottom">Bottom</string>
diff --git a/samples/SupportDesignDemos/res/values/styles.xml b/samples/SupportDesignDemos/res/values/styles.xml
index a63f93f..456ae58 100644
--- a/samples/SupportDesignDemos/res/values/styles.xml
+++ b/samples/SupportDesignDemos/res/values/styles.xml
@@ -23,6 +23,8 @@
<item name="colorAccent">#FFAB40</item>
</style>
+ <style name="Theme.Design.TransparentStatus">
+ </style>
<style name="Theme.FAB" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#ff00bcd4</item>
diff --git a/samples/SupportDesignDemos/src/com/example/android/support/design/widget/AppBarLayoutToolbarCollapseWithImageWithInsets.java b/samples/SupportDesignDemos/src/com/example/android/support/design/widget/AppBarLayoutToolbarCollapseWithImageWithInsets.java
new file mode 100644
index 0000000..5a16d60
--- /dev/null
+++ b/samples/SupportDesignDemos/src/com/example/android/support/design/widget/AppBarLayoutToolbarCollapseWithImageWithInsets.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2015 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.support.design.widget;
+
+import com.example.android.support.design.R;
+
+public class AppBarLayoutToolbarCollapseWithImageWithInsets extends AppBarLayoutUsageBase {
+
+ @Override
+ protected int getLayoutId() {
+ return R.layout.design_appbar_toolbar_collapse_with_image_insets;
+ }
+}