Replace TitleBar sub views with a ViewStub.
Optimise startup performance by using a ViewStub for TitleBar views
that aren't needed until later.
Bug: 5179151
Change-Id: I87cf23cbd1e3b818a566c95dc6bb9cc1ff366587
diff --git a/res/layout/title_bar.xml b/res/layout/title_bar.xml
index cf500c8..acc49e6 100644
--- a/res/layout/title_bar.xml
+++ b/res/layout/title_bar.xml
@@ -24,14 +24,14 @@
android:id="@+id/taburlbar"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height" />
- <include
- layout="@layout/title_bar_snapshot"
- android:id="@+id/snapshotbar"
+ <ViewStub
+ android:id="@+id/snapshotbar_stub"
+ android:layout="@layout/title_bar_snapshot"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height" />
- <include
- layout="@layout/title_bar_autologin"
- android:id="@+id/autologin"
+ <ViewStub
+ android:id="@+id/autologin_stub"
+ android:layout="@layout/title_bar_autologin"
android:paddingTop="3dip"
android:layout_below="@id/taburlbar"
android:layout_width="match_parent"
diff --git a/res/layout/title_bar_autologin.xml b/res/layout/title_bar_autologin.xml
index 839f875..22da630 100644
--- a/res/layout/title_bar_autologin.xml
+++ b/res/layout/title_bar_autologin.xml
@@ -16,6 +16,8 @@
-->
<com.android.browser.AutologinBar
xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
android:background="#FBF0A0"
android:gravity="center_vertical"
android:visibility="gone"
diff --git a/res/layout/title_bar_snapshot.xml b/res/layout/title_bar_snapshot.xml
index 9d9d7c9..4d6128c 100644
--- a/res/layout/title_bar_snapshot.xml
+++ b/res/layout/title_bar_snapshot.xml
@@ -16,6 +16,8 @@
-->
<com.android.browser.SnapshotBar
xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/bg_urlbar">
<ImageView