[SetupWizardLib] Provide templates in library
Copied the XML layout templates for the different screen sizes to the
library.
Bug: 18685749
Change-Id: I1b72e008fa2847a2a393bc7285f0d18d3e3f93fd
diff --git a/library/res/drawable-v21/suw_layout_background.xml b/library/res/drawable-v21/suw_layout_background.xml
new file mode 100644
index 0000000..d2531b2
--- /dev/null
+++ b/library/res/drawable-v21/suw_layout_background.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+
+<!-- This is a fallback for the background of the Setup Wizard layout. Clients should replace this
+ with a suitable tileable background. -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <solid android:color="?android:attr/colorAccent" />
+
+</shape>
diff --git a/library/res/drawable/suw_card_bg.xml b/library/res/drawable/suw_card_bg.xml
new file mode 100644
index 0000000..13d1d4e
--- /dev/null
+++ b/library/res/drawable/suw_card_bg.xml
@@ -0,0 +1,27 @@
+<?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.
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+
+ <corners
+ android:topLeftRadius="@dimen/suw_card_corner_radius"
+ android:topRightRadius="@dimen/suw_card_corner_radius" />
+
+ <solid android:color="?android:attr/colorBackground" />
+
+</shape>
diff --git a/library/res/layout-v21/suw_template_card.xml b/library/res/layout-v21/suw_template_card.xml
new file mode 100644
index 0000000..0d4101c
--- /dev/null
+++ b/library/res/layout-v21/suw_template_card.xml
@@ -0,0 +1,70 @@
+<?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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <com.android.setupwizardlib.view.Illustration
+ android:id="@+id/suw_layout_decor"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:background="@drawable/suw_layout_background">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginTop="@dimen/suw_tablet_illustration_height"
+ android:orientation="vertical"
+ android:paddingLeft="@dimen/suw_card_port_margin_sides"
+ android:paddingRight="@dimen/suw_card_port_margin_sides">
+
+ <TextView
+ android:id="@+id/suw_layout_title"
+ style="@style/SuwCardTitle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <com.android.setupwizardlib.view.BottomScrollView
+ android:id="@+id/suw_bottom_scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:background="@drawable/suw_card_bg"
+ android:elevation="@dimen/suw_card_elevation"
+ android:fillViewport="true">
+
+ <FrameLayout
+ android:id="@+id/suw_layout_content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipChildren="false" />
+
+ </com.android.setupwizardlib.view.BottomScrollView>
+
+ </LinearLayout>
+
+ </com.android.setupwizardlib.view.Illustration>
+
+ <com.android.setupwizardlib.view.NavigationBar
+ android:id="@+id/suw_layout_navigation_bar"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/suw_navbar_height" />
+
+</LinearLayout>
diff --git a/library/res/layout-v21/suw_template_card_wide.xml b/library/res/layout-v21/suw_template_card_wide.xml
new file mode 100644
index 0000000..30c9950
--- /dev/null
+++ b/library/res/layout-v21/suw_template_card_wide.xml
@@ -0,0 +1,70 @@
+<?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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <com.android.setupwizardlib.view.Illustration
+ android:id="@+id/suw_layout_decor"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:background="@drawable/suw_layout_background">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="start|top"
+ android:weightSum="16">
+
+ <TextView
+ android:id="@+id/suw_layout_title"
+ style="@style/SuwCardTitle"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/suw_tablet_illustration_height"
+ android:layout_weight="6" />
+
+ <com.android.setupwizardlib.view.BottomScrollView
+ android:id="@+id/suw_bottom_scroll_view"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_marginTop="@dimen/suw_card_land_margin_top"
+ android:layout_weight="8"
+ android:background="@drawable/suw_card_bg"
+ android:elevation="@dimen/suw_card_elevation"
+ android:fillViewport="true">
+
+ <FrameLayout android:id="@+id/suw_layout_content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipChildren="false" />
+
+ </com.android.setupwizardlib.view.BottomScrollView>
+
+ </LinearLayout>
+
+ </com.android.setupwizardlib.view.Illustration>
+
+ <com.android.setupwizardlib.view.NavigationBar
+ android:id="@+id/suw_layout_navigation_bar"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/suw_navbar_height" />
+
+</LinearLayout>
diff --git a/library/res/layout-v21/suw_template_header.xml b/library/res/layout-v21/suw_template_header.xml
new file mode 100644
index 0000000..c497051
--- /dev/null
+++ b/library/res/layout-v21/suw_template_header.xml
@@ -0,0 +1,70 @@
+<?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.
+-->
+
+<LinearLayout 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:orientation="vertical">
+
+ <com.android.setupwizardlib.view.StickyHeaderScrollView
+ android:id="@+id/suw_bottom_scroll_view"
+ android:layout_weight="1"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:fillViewport="true">
+
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipChildren="false">
+
+ <com.android.setupwizardlib.view.Illustration
+ android:id="@+id/suw_layout_decor"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/suw_layout_background"
+ android:elevation="@dimen/suw_title_area_elevation"
+ android:tag="stickyContainer"
+ app:suwAspectRatio="2.22">
+
+ <TextView
+ android:id="@+id/suw_layout_title"
+ style="@style/SuwHeaderTitle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:tag="sticky" />
+
+ </com.android.setupwizardlib.view.Illustration>
+
+ <FrameLayout
+ android:id="@+id/suw_layout_content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/suw_layout_decor"
+ android:clipChildren="false" />
+
+ </RelativeLayout>
+
+ </com.android.setupwizardlib.view.StickyHeaderScrollView>
+
+ <com.android.setupwizardlib.view.NavigationBar
+ android:id="@+id/suw_layout_navigation_bar"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/suw_navbar_height" />
+
+</LinearLayout>
diff --git a/library/res/layout-v21/suw_template_header_collapsed.xml b/library/res/layout-v21/suw_template_header_collapsed.xml
new file mode 100644
index 0000000..918ee9b
--- /dev/null
+++ b/library/res/layout-v21/suw_template_header_collapsed.xml
@@ -0,0 +1,57 @@
+<?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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <FrameLayout
+ android:id="@+id/suw_layout_decor"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/suw_layout_background"
+ android:elevation="@dimen/suw_title_area_elevation">
+
+ <TextView
+ android:id="@+id/suw_layout_title"
+ style="@style/SuwHeaderTitle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ </FrameLayout>
+
+ <com.android.setupwizardlib.view.BottomScrollView
+ android:id="@+id/suw_bottom_scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:fillViewport="true">
+
+ <FrameLayout android:id="@+id/suw_layout_content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipChildren="false" />
+
+ </com.android.setupwizardlib.view.BottomScrollView>
+
+ <com.android.setupwizardlib.view.NavigationBar
+ android:id="@+id/suw_layout_navigation_bar"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/suw_navbar_height" />
+
+</LinearLayout>
diff --git a/library/res/values-land-v21/layouts.xml b/library/res/values-land-v21/layouts.xml
new file mode 100644
index 0000000..e587ace
--- /dev/null
+++ b/library/res/values-land-v21/layouts.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+
+<resources>
+
+ <item name="suw_template" type="layout">@layout/suw_template_header_collapsed</item>
+ <item name="suw_template_short" type="layout">@layout/suw_template_header_collapsed</item>
+
+</resources>
+
diff --git a/library/res/values-land/dimens.xml b/library/res/values-land/dimens.xml
new file mode 100644
index 0000000..f48548b
--- /dev/null
+++ b/library/res/values-land/dimens.xml
@@ -0,0 +1,26 @@
+<?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.
+-->
+
+<resources>
+
+ <!-- Card layout (for tablets) -->
+ <dimen name="suw_card_title_padding_end">32dp</dimen>
+ <dimen name="suw_card_title_padding_start">56dp</dimen>
+ <dimen name="suw_card_title_padding_top">24dp</dimen>
+ <dimen name="suw_card_title_padding_bottom">0dp</dimen>
+
+</resources>
diff --git a/library/res/values-sw600dp-land-v21/layouts.xml b/library/res/values-sw600dp-land-v21/layouts.xml
new file mode 100644
index 0000000..7a7a40b
--- /dev/null
+++ b/library/res/values-sw600dp-land-v21/layouts.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+
+<resources>
+
+ <item name="suw_template" type="layout">@layout/suw_template_card_wide</item>
+ <item name="suw_template_short" type="layout">@layout/suw_template_card_wide</item>
+
+</resources>
+
diff --git a/library/res/values-sw600dp-v21/layouts.xml b/library/res/values-sw600dp-v21/layouts.xml
new file mode 100644
index 0000000..8b702d2
--- /dev/null
+++ b/library/res/values-sw600dp-v21/layouts.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+
+<resources>
+
+ <item name="suw_template" type="layout">@layout/suw_template_card</item>
+ <item name="suw_template_short" type="layout">@layout/suw_template_card</item>
+
+</resources>
+
diff --git a/library/res/values-v21/layouts.xml b/library/res/values-v21/layouts.xml
new file mode 100644
index 0000000..1b37348
--- /dev/null
+++ b/library/res/values-v21/layouts.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+
+<resources>
+
+ <item name="suw_template" type="layout">@layout/suw_template_header</item>
+ <item name="suw_template_short" type="layout">@layout/suw_template_header_collapsed</item>
+
+</resources>
+
diff --git a/library/res/values-v21/styles.xml b/library/res/values-v21/styles.xml
index 3f08a44..2977ab7 100644
--- a/library/res/values-v21/styles.xml
+++ b/library/res/values-v21/styles.xml
@@ -46,6 +46,33 @@
<item name="android:activityCloseExitAnimation">@anim/suw_slide_back_out</item>
</style>
+ <!-- Card layout (for tablets) -->
+
+ <style name="SuwCardTitle">
+ <item name="android:paddingBottom">@dimen/suw_card_title_padding_bottom</item>
+ <item name="android:paddingEnd">@dimen/suw_card_title_padding_end</item>
+ <item name="android:paddingStart">@dimen/suw_card_title_padding_start</item>
+ <item name="android:paddingTop">@dimen/suw_card_title_padding_top</item>
+ <item name="android:textAppearance">@style/TextAppearance.SuwCardTitle</item>
+ </style>
+
+ <style name="TextAppearance.SuwCardTitle" parent="@android:style/TextAppearance.Material.Display1">
+ <item name="android:textColor">@android:color/white</item>
+ </style>
+
+ <!-- Header layout (for phones) -->
+
+ <style name="SuwHeaderTitle">
+ <item name="android:layout_marginBottom">@dimen/suw_header_title_margin_bottom</item>
+ <item name="android:layout_marginEnd">@dimen/suw_layout_margin_sides</item>
+ <item name="android:layout_marginStart">@dimen/suw_layout_margin_sides</item>
+ <item name="android:lineSpacingExtra">@dimen/suw_header_title_line_spacing_extra</item>
+ <item name="android:paddingBottom">@dimen/suw_header_title_padding_bottom</item>
+ <item name="android:paddingTop">@dimen/suw_header_title_padding_top</item>
+ <item name="android:textColor">@android:color/white</item>
+ <item name="android:textSize">@dimen/suw_header_title_size</item>
+ </style>
+
<!-- Navigation bar styles -->
<style name="SuwNavBarThemeDark">
diff --git a/library/res/values/dimens.xml b/library/res/values/dimens.xml
index 15479e4..c1348a5 100644
--- a/library/res/values/dimens.xml
+++ b/library/res/values/dimens.xml
@@ -16,10 +16,39 @@
-->
<resources>
+
+ <!-- General -->
+ <dimen name="suw_layout_margin_sides">40dp</dimen>
+
+ <!-- Card layout (for tablets) -->
+ <dimen name="suw_card_corner_radius">2dp</dimen>
+ <dimen name="suw_card_elevation">5dp</dimen>
+ <dimen name="suw_card_land_margin_top">128dp</dimen>
+ <dimen name="suw_card_port_margin_sides">56dp</dimen>
+
+ <dimen name="suw_card_title_padding_end">0dp</dimen>
+ <dimen name="suw_card_title_padding_start">0dp</dimen>
+ <dimen name="suw_card_title_padding_top">16dp</dimen>
+ <dimen name="suw_card_title_padding_bottom">28dp</dimen>
+
+ <dimen name="suw_tablet_illustration_height">256dp</dimen>
+
+ <!-- Header layout (for phones) -->
+ <dimen name="suw_title_area_elevation">3dp</dimen>
+
+ <dimen name="suw_header_title_size">24sp</dimen>
+ <dimen name="suw_header_title_margin_bottom">16dp</dimen>
+ <dimen name="suw_header_title_padding_top">16dp</dimen>
+ <dimen name="suw_header_title_padding_bottom">2dp</dimen>
+ <!-- This is the extra spacing required to make the leading exactly 32sp -->
+ <dimen name="suw_header_title_line_spacing_extra">3.67sp</dimen>
+
+ <!-- Navigation bar -->
<dimen name="suw_navbar_button_drawable_padding">6dp</dimen>
<dimen name="suw_navbar_button_padding_sides">10dp</dimen>
<dimen name="suw_navbar_height">56dp</dimen>
<dimen name="suw_navbar_ic_intrinsic_size">24dp</dimen>
<dimen name="suw_navbar_padding_sides">24dp</dimen>
<dimen name="suw_navbar_text_size">16sp</dimen>
+
</resources>