Use custom ViewPagerTabs
Use the custom ViewPagerTabs from contacts common.
In portrait, the tabs are below the toolbar. In landscape
the tabs are inside the toolbar.
Bug: 16158921
Bug: 15616182
Change-Id: I6c2067fdc10fa15ebd6e0fa93aa1c4f8e7cd45a7
diff --git a/res/layout/people_activity.xml b/res/layout/people_activity.xml
index 6b65945..2624818 100644
--- a/res/layout/people_activity.xml
+++ b/res/layout/people_activity.xml
@@ -19,6 +19,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
+ <include
+ layout="@layout/people_activity_toolbar"
+ android:id="@+id/toolbar_parent" />
+
<!--
ViewPager for swiping between tabs. We put StrequentContactListFragment,
DefaultContactBrowseListFragment and GroupBrowseListFragment at runtime.
@@ -30,6 +34,7 @@
android:id="@+id/tab_pager"
android:layout_height="match_parent"
android:layout_width="match_parent"
+ android:layout_below="@id/toolbar_parent"
/>
<FrameLayout
diff --git a/res/layout/people_activity_tabs_lands.xml b/res/layout/people_activity_tabs_lands.xml
new file mode 100644
index 0000000..525ac3c
--- /dev/null
+++ b/res/layout/people_activity_tabs_lands.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<com.android.contacts.common.list.ViewPagerTabs
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/lists_pager_header"
+ android:layout_width="@dimen/people_activity_landscape_tabs_width"
+ android:layout_height="match_parent"
+ android:textAllCaps="true"
+ android:orientation="horizontal"
+ android:layout_gravity="top"
+ android:layout_weight="0"
+ android:textSize="@dimen/people_activity_landscape_tabs_text_size"
+ style="@style/ContactsActionBarTabTextStyle" />
diff --git a/res/layout/people_activity_toolbar.xml b/res/layout/people_activity_toolbar.xml
new file mode 100644
index 0000000..fe5be04
--- /dev/null
+++ b/res/layout/people_activity_toolbar.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<!-- Need to set a non null background on Toolbar in order for MenuItem ripples to be drawn on
+ this view, instead of another. This will *not* cause an additional draw since the
+ background is transparent.-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/toolbar_parent"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:background="#00000000"
+ android:elevation="@dimen/tab_elevation"
+ android:layout_height="wrap_content" >
+
+ <Toolbar
+ android:layout_width="match_parent"
+ android:layout_height="?android:attr/actionBarSize"
+ android:background="@color/actionbar_background_color"
+ android:id="@+id/toolbar"
+ style="@style/ContactsToolbarStyle" />
+
+ <com.android.contacts.common.list.ViewPagerTabs
+ android:id="@+id/lists_pager_header"
+ android:layout_width="match_parent"
+ android:layout_height="?android:attr/actionBarSize"
+ android:textAllCaps="true"
+ android:orientation="horizontal"
+ android:layout_gravity="top"
+ android:layout_weight="0"
+ android:layout_below="@id/toolbar"
+ style="@style/ContactsActionBarTabTextStyle" />
+
+</LinearLayout>
\ No newline at end of file