Refactor UI to use tabs

Bug:27533454
Change-Id: I830f53099dbae49fbf283e235d12db357ce2a912
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 7c8bc12..c8f53b5 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
+<!-- Copyright (C) 2016 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.
diff --git a/res/drawable/ic_account_circle.xml b/res/drawable/ic_account_circle.xml
index db591b8..894c6b3 100644
--- a/res/drawable/ic_account_circle.xml
+++ b/res/drawable/ic_account_circle.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
+<!-- Copyright (C) 2016 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.
diff --git a/res/drawable/ic_address_black_24dp.xml b/res/drawable/ic_address_black_24dp.xml
index baa1cbf..7656406 100644
--- a/res/drawable/ic_address_black_24dp.xml
+++ b/res/drawable/ic_address_black_24dp.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
+<!-- Copyright (C) 2016 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.
diff --git a/res/drawable/ic_allergies_black_24dp.xml b/res/drawable/ic_allergies_black_24dp.xml
index 5b5a19d..cc04e1f 100644
--- a/res/drawable/ic_allergies_black_24dp.xml
+++ b/res/drawable/ic_allergies_black_24dp.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
+<!-- Copyright (C) 2016 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.
diff --git a/res/drawable/ic_bloodtype_black_24dp.xml b/res/drawable/ic_bloodtype_black_24dp.xml
index e7866f9..5db6aa9 100644
--- a/res/drawable/ic_bloodtype_black_24dp.xml
+++ b/res/drawable/ic_bloodtype_black_24dp.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
+<!-- Copyright (C) 2016 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.
diff --git a/res/drawable/ic_cake_black_24dp.xml b/res/drawable/ic_cake_black_24dp.xml
index c0c1d43..79e7748 100644
--- a/res/drawable/ic_cake_black_24dp.xml
+++ b/res/drawable/ic_cake_black_24dp.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
+<!-- Copyright (C) 2016 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.
diff --git a/res/drawable/ic_heart_black_24dp.xml b/res/drawable/ic_heart_black_24dp.xml
index 4c219e1..98e549a 100644
--- a/res/drawable/ic_heart_black_24dp.xml
+++ b/res/drawable/ic_heart_black_24dp.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
+<!-- Copyright (C) 2016 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.
diff --git a/res/drawable/ic_medication_24dp.xml b/res/drawable/ic_medication_24dp.xml
index 30e0cbe..3f9ba4c 100644
--- a/res/drawable/ic_medication_24dp.xml
+++ b/res/drawable/ic_medication_24dp.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
+<!-- Copyright (C) 2016 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.
diff --git a/res/drawable/ic_notes_black_24dp.xml b/res/drawable/ic_notes_black_24dp.xml
index b74b5d2..0df7276 100644
--- a/res/drawable/ic_notes_black_24dp.xml
+++ b/res/drawable/ic_notes_black_24dp.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
+<!-- Copyright (C) 2016 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.
diff --git a/res/drawable/ic_person_black_24dp.xml b/res/drawable/ic_person_black_24dp.xml
index d2840b5..7b1b995 100644
--- a/res/drawable/ic_person_black_24dp.xml
+++ b/res/drawable/ic_person_black_24dp.xml
@@ -1,3 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
         android:width="24dp"
         android:height="24dp"
diff --git a/res/layout/custom_preference_category_layout.xml b/res/layout/custom_preference_category_layout.xml
new file mode 100644
index 0000000..9a1dcd4
--- /dev/null
+++ b/res/layout/custom_preference_category_layout.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@android:id/title"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:textSize="0pt"/>
+<!-- Use 0pt so that the category title does not show-->
\ No newline at end of file
diff --git a/res/layout/preference_user_delete_widget.xml b/res/layout/preference_user_delete_widget.xml
index 29811b8..52d0387 100644
--- a/res/layout/preference_user_delete_widget.xml
+++ b/res/layout/preference_user_delete_widget.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 The Android Open Source Project
+<!-- Copyright (C) 2016 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.
diff --git a/res/layout/tab_layout.xml b/res/layout/tab_layout.xml
new file mode 100644
index 0000000..73ffa39
--- /dev/null
+++ b/res/layout/tab_layout.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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">
+
+    <android.support.design.widget.TabLayout
+        android:id="@+id/sliding_tabs"
+        style="@style/AppTheme.TabLayout"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="?attr/colorPrimary"
+        android:elevation="@dimen/tab_elevation"
+        app:tabGravity="fill"
+        app:tabMaxWidth="0dp"
+        app:tabMode="fixed" />
+
+    <android.support.v4.view.ViewPager
+        android:id="@+id/view_pager"
+        android:layout_width="match_parent"
+        android:layout_height="fill_parent" />
+
+    <ListView
+        android:id="@android:id/list"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent" />
+</LinearLayout>
\ No newline at end of file
diff --git a/res/menu/menu_edit.xml b/res/menu/menu_edit.xml
index c25f82f..47fd308 100644
--- a/res/menu/menu_edit.xml
+++ b/res/menu/menu_edit.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
+<!-- Copyright (C) 2016 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.
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 31efc5b..756ddf3 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
+<!-- Copyright (C) 2016 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.
@@ -16,6 +16,6 @@
 <resources>
     <color name="emergency_primary_dark">#C62828</color>
     <color name="emergency_primary">#E53935</color>
-    <!--TODO: change this color to yellow #FFFF00 once we introduce tabs and remove categories -->
-    <color name="emergency_accent">#E53935</color>
+    <color name="emergency_accent">#FFFF00</color>
+    <color name="tab_text_color">#FFFFFF</color>
 </resources>
\ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 036c50c..ec09dfd 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -1,5 +1,5 @@
-<resources>
-    <!-- Copyright (C) 2007 The Android Open Source Project
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
@@ -13,8 +13,9 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-    <!-- Default screen margins, per the Android Design guidelines. -->
+<resources>
     <dimen name="activity_horizontal_margin">16dp</dimen>
     <dimen name="activity_vertical_margin">16dp</dimen>
     <dimen name="circle_avatar_size">40dp</dimen>
+    <dimen name="tab_elevation">4dp</dimen>
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index fc5dbad..8647772 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
+<!-- Copyright (C) 2016 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.
@@ -15,8 +15,8 @@
 -->
 <resources>
     <string name="app_label">Emergency Info</string>
-    <string name="personal_information_title">Personal</string>
-    <string name="medical_information_title">Medical</string>
+    <string name="tab_title_info">Info</string>
+    <string name="tab_title_contacts">Contacts</string>
     <string name="name">Name</string>
     <string name="name_hint">For example, John Doe</string>
     <string name="address">Address</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index d5acf2e..2b05e68 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
+<!-- Copyright (C) 2016 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.
@@ -16,6 +16,8 @@
 <resources>
     <!-- Base settings theme. -->
     <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+        <item name="actionBarStyle">@style/AppTheme.ActionBar</item>
+        <item name="android:preferenceCategoryStyle">@style/AppTheme.PreferenceCategoryStyle</item>
     </style>
     <!-- Base emergency theme. -->
     <style name="AppThemeEmergency" parent="AppTheme">
@@ -23,4 +25,22 @@
         <item name="colorPrimary">@color/emergency_primary</item>
         <item name="colorAccent">@color/emergency_accent</item>
     </style>
+
+    <!-- Action Bar and tabs -->
+    <style name="AppTheme.ActionBar" parent="style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
+        <item name="elevation">0dp</item>
+    </style>
+    <style name="AppTheme.TabLayout" parent="Widget.Design.TabLayout">
+        <item name="tabTextAppearance">@style/AppTheme.TabText</item>
+        <item name="tabSelectedTextColor">@color/tab_text_color</item>
+    </style>
+
+    <style name="AppTheme.TabText" parent="TextAppearance.AppCompat.Button">
+        <item name="android:textColor">@color/tab_text_color</item>
+    </style>
+
+    <!-- Preferences -->
+    <style name="AppTheme.PreferenceCategoryStyle" parent="Preference.Category">
+        <item name="android:layout">@layout/custom_preference_category_layout</item>
+    </style>
 </resources>
diff --git a/res/xml/emergency_contacts.xml b/res/xml/emergency_contacts.xml
new file mode 100644
index 0000000..0a1a311
--- /dev/null
+++ b/res/xml/emergency_contacts.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+    <com.android.emergency.EmergencyContactsPreference
+        android:key="emergency_contacts"
+        android:title="@string/emergency_contacts_title" />
+    <Preference
+        android:icon="@drawable/ic_menu_add_dark"
+        android:key="add_contact"
+        android:persistent="false"
+        android:title="@string/add_emergency_contact" />
+</PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/emergency_info.xml b/res/xml/emergency_info.xml
index 61da4a2..e2086eb 100644
--- a/res/xml/emergency_info.xml
+++ b/res/xml/emergency_info.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 The Android Open Source Project
+<!-- Copyright (C) 2016 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.
@@ -17,115 +17,95 @@
 
     <!-- NOTE: EditTextPreference accepts EditText attributes. -->
     <!-- NOTE: EditTextPreference's summary should be set to its value by the activity code. -->
-    <PreferenceCategory
-        android:key="personal_information"
-        android:title="@string/personal_information_title">
-        <com.android.emergency.EmergencyEditTextPreference
-            android:inputType="textCapWords|textPersonName"
-            android:key="name"
-            android:icon="@drawable/ic_account_circle"
-            android:selectAllOnFocus="true"
-            android:singleLine="true"
-            android:summary="@string/default_summary_none"
-            android:title="@string/name"
-            android:hint="@string/name_hint"/>
+    <com.android.emergency.EmergencyEditTextPreference
+        android:hint="@string/name_hint"
+        android:icon="@drawable/ic_account_circle"
+        android:inputType="textCapWords|textPersonName"
+        android:key="name"
+        android:selectAllOnFocus="true"
+        android:singleLine="true"
+        android:summary="@string/default_summary_none"
+        android:title="@string/name" />
 
-        <com.android.emergency.DatePreference
-            android:defaultValue=""
-            android:icon="@drawable/ic_cake_black_24dp"
-            android:key="date_of_birth"
-            android:selectAllOnFocus="true"
-            android:summary="@string/default_summary_none"
-            android:title="@string/date_of_birth" />
+    <com.android.emergency.DatePreference
+        android:defaultValue=""
+        android:icon="@drawable/ic_cake_black_24dp"
+        android:key="date_of_birth"
+        android:selectAllOnFocus="true"
+        android:summary="@string/default_summary_none"
+        android:title="@string/date_of_birth" />
 
-        <com.android.emergency.EmergencyEditTextPreference
-            android:inputType="textCapWords|textPostalAddress|textMultiLine"
-            android:icon="@drawable/ic_address_black_24dp"
-            android:key="address"
-            android:selectAllOnFocus="true"
-            android:singleLine="false"
-            android:summary="@string/default_summary_none"
-            android:title="@string/address"
-            android:hint="@string/address_hint"/>
-    </PreferenceCategory>
+    <com.android.emergency.EmergencyEditTextPreference
+        android:hint="@string/address_hint"
+        android:icon="@drawable/ic_address_black_24dp"
+        android:inputType="textCapWords|textPostalAddress|textMultiLine"
+        android:key="address"
+        android:selectAllOnFocus="true"
+        android:singleLine="false"
+        android:summary="@string/default_summary_none"
+        android:title="@string/address" />
 
-    <!-- NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to
-         dismiss it. -->
-    <PreferenceCategory
-        android:key="medical_information"
-        android:title="@string/medical_information_title">
-        <!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
-        <com.android.emergency.EmergencyListPreference
-            android:defaultValue="@string/default_summary_none"
-            android:entries="@array/blood_type_values"
-            android:entryValues="@array/blood_type_values"
-            android:icon="@drawable/ic_bloodtype_black_24dp"
-            android:key="blood_type"
-            android:negativeButtonText="@null"
-            android:positiveButtonText="@null"
-            android:summary="@string/default_summary_none"
-            android:title="@string/blood_type" />
+    <com.android.emergency.EmergencyListPreference
+        android:defaultValue="@string/default_summary_none"
+        android:entries="@array/blood_type_values"
+        android:entryValues="@array/blood_type_values"
+        android:icon="@drawable/ic_bloodtype_black_24dp"
+        android:key="blood_type"
+        android:negativeButtonText="@null"
+        android:positiveButtonText="@null"
+        android:summary="@string/default_summary_none"
+        android:title="@string/blood_type" />
 
-        <com.android.emergency.EmergencyEditTextPreference
-            android:capitalize="sentences"
-            android:inputType="textMultiLine"
-            android:icon="@drawable/ic_allergies_black_24dp"
-            android:key="allergies"
-            android:selectAllOnFocus="true"
-            android:singleLine="false"
-            android:summary="@string/default_summary_none"
-            android:title="@string/allergies"
-            android:hint="@string/allergies_hint"/>
+    <com.android.emergency.EmergencyEditTextPreference
+        android:capitalize="sentences"
+        android:hint="@string/allergies_hint"
+        android:icon="@drawable/ic_allergies_black_24dp"
+        android:inputType="textMultiLine"
+        android:key="allergies"
+        android:selectAllOnFocus="true"
+        android:singleLine="false"
+        android:summary="@string/default_summary_none"
+        android:title="@string/allergies" />
 
-        <com.android.emergency.EmergencyEditTextPreference
-            android:capitalize="sentences"
-            android:inputType="textMultiLine"
-            android:icon="@drawable/ic_medication_24dp"
-            android:key="medications"
-            android:selectAllOnFocus="true"
-            android:singleLine="false"
-            android:summary="@string/default_summary_none"
-            android:title="@string/medications"
-            android:hint="@string/medications_hint"/>
+    <com.android.emergency.EmergencyEditTextPreference
+        android:capitalize="sentences"
+        android:hint="@string/medications_hint"
+        android:icon="@drawable/ic_medication_24dp"
+        android:inputType="textMultiLine"
+        android:key="medications"
+        android:selectAllOnFocus="true"
+        android:singleLine="false"
+        android:summary="@string/default_summary_none"
+        android:title="@string/medications" />
 
-        <com.android.emergency.EmergencyListPreference
-            android:defaultValue="@string/default_summary_none"
-            android:entries="@array/organ_donor_values"
-            android:entryValues="@array/organ_donor_values"
-            android:icon="@drawable/ic_heart_black_24dp"
-            android:key="organ_donor"
-            android:negativeButtonText="@null"
-            android:positiveButtonText="@null"
-            android:summary="@string/default_summary_none"
-            android:title="@string/organ_donor" />
+    <com.android.emergency.EmergencyListPreference
+        android:defaultValue="@string/default_summary_none"
+        android:entries="@array/organ_donor_values"
+        android:entryValues="@array/organ_donor_values"
+        android:icon="@drawable/ic_heart_black_24dp"
+        android:key="organ_donor"
+        android:negativeButtonText="@null"
+        android:positiveButtonText="@null"
+        android:summary="@string/default_summary_none"
+        android:title="@string/organ_donor" />
 
-        <com.android.emergency.EmergencyEditTextPreference
-            android:capitalize="sentences"
-            android:inputType="textMultiLine"
-            android:key="medical_conditions"
-            android:icon="@drawable/ic_notes_black_24dp"
-            android:selectAllOnFocus="true"
-            android:singleLine="false"
-            android:summary="@string/default_summary_none"
-            android:title="@string/medical_conditions"
-            android:hint="@string/medical_conditions_hint"/>
-    </PreferenceCategory>
-
-    <com.android.emergency.EmergencyContactsPreference
-        android:key="emergency_contacts"
-        android:title="@string/emergency_contacts_title"/>
-    <Preference
-        android:icon="@drawable/ic_menu_add_dark"
-        android:key="add_contact"
-        android:persistent="false"
-        android:title="@string/add_emergency_contact" />
+    <com.android.emergency.EmergencyEditTextPreference
+        android:capitalize="sentences"
+        android:hint="@string/medical_conditions_hint"
+        android:icon="@drawable/ic_notes_black_24dp"
+        android:inputType="textMultiLine"
+        android:key="medical_conditions"
+        android:selectAllOnFocus="true"
+        android:singleLine="false"
+        android:summary="@string/default_summary_none"
+        android:title="@string/medical_conditions" />
 
     <Preference
-        android:selectable="false"
         android:clickable="false"
         android:enabled="false"
-        android:shouldDisableView="false"
         android:key="description"
         android:persistent="false"
+        android:selectable="false"
+        android:shouldDisableView="false"
         android:summary="@string/description" />
 </PreferenceScreen>
diff --git a/src/com/android/emergency/AppCompatPreferenceActivity.java b/src/com/android/emergency/AppCompatPreferenceActivity.java
deleted file mode 100644
index 42128a2..0000000
--- a/src/com/android/emergency/AppCompatPreferenceActivity.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (C) 2016 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.android.emergency;
-
-import android.app.Activity;
-import android.content.res.Configuration;
-import android.os.Bundle;
-import android.preference.PreferenceActivity;
-import android.support.annotation.LayoutRes;
-import android.support.annotation.Nullable;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatDelegate;
-import android.support.v7.widget.Toolbar;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-
-/**
- * A {@link PreferenceActivity} which implements and proxies the necessary calls
- * to be used with AppCompat.
- */
-public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
-
-    private AppCompatDelegate mDelegate;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        getDelegate().installViewFactory();
-        getDelegate().onCreate(savedInstanceState);
-        super.onCreate(savedInstanceState);
-        setupActionBar();
-    }
-
-    @Override
-    protected void onPostCreate(Bundle savedInstanceState) {
-        super.onPostCreate(savedInstanceState);
-        getDelegate().onPostCreate(savedInstanceState);
-    }
-
-    public ActionBar getSupportActionBar() {
-        return getDelegate().getSupportActionBar();
-    }
-
-    public void setSupportActionBar(@Nullable Toolbar toolbar) {
-        getDelegate().setSupportActionBar(toolbar);
-    }
-
-    @Override
-    public MenuInflater getMenuInflater() {
-        return getDelegate().getMenuInflater();
-    }
-
-    @Override
-    public void setContentView(@LayoutRes int layoutResID) {
-        getDelegate().setContentView(layoutResID);
-    }
-
-    @Override
-    public void setContentView(View view) {
-        getDelegate().setContentView(view);
-    }
-
-    @Override
-    public void setContentView(View view, ViewGroup.LayoutParams params) {
-        getDelegate().setContentView(view, params);
-    }
-
-    @Override
-    public void addContentView(View view, ViewGroup.LayoutParams params) {
-        getDelegate().addContentView(view, params);
-    }
-
-    @Override
-    protected void onPostResume() {
-        super.onPostResume();
-        getDelegate().onPostResume();
-    }
-
-    @Override
-    protected void onTitleChanged(CharSequence title, int color) {
-        super.onTitleChanged(title, color);
-        getDelegate().setTitle(title);
-    }
-
-    @Override
-    public void onConfigurationChanged(Configuration newConfig) {
-        super.onConfigurationChanged(newConfig);
-        getDelegate().onConfigurationChanged(newConfig);
-    }
-
-    @Override
-    protected void onStop() {
-        super.onStop();
-        getDelegate().onStop();
-    }
-
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-        getDelegate().onDestroy();
-    }
-
-    /**
-     * Sets up the {@link ActionBar}, if the API is available.
-     */
-    protected void setupActionBar() {
-        ActionBar actionBar = getSupportActionBar();
-        if (actionBar != null) {
-            // Show the Up button in the action bar.
-            actionBar.setDisplayHomeAsUpEnabled(true);
-        }
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            // Respond to the action bar's Up/Home button.
-            case android.R.id.home:
-                onBackPressed();
-                return true;
-        }
-        return super.onOptionsItemSelected(item);
-    }
-
-    @Override
-    public void invalidateOptionsMenu() {
-        getDelegate().invalidateOptionsMenu();
-    }
-
-    private AppCompatDelegate getDelegate() {
-        if (mDelegate == null) {
-            mDelegate = AppCompatDelegate.create(this, null);
-        }
-        return mDelegate;
-    }
-}
diff --git a/src/com/android/emergency/EditInfoActivity.java b/src/com/android/emergency/EditInfoActivity.java
index de97367..989576e 100644
--- a/src/com/android/emergency/EditInfoActivity.java
+++ b/src/com/android/emergency/EditInfoActivity.java
@@ -17,6 +17,8 @@
 
 import static android.view.WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD;
 
+import android.app.Activity;
+import android.content.Intent;
 import android.os.Bundle;
 
 import com.android.internal.logging.MetricsLogger;
@@ -24,24 +26,26 @@
 /**
  * Activity for editing emergency information.
  */
-public class EditInfoActivity extends AppCompatPreferenceActivity {
+public class EditInfoActivity extends EmergencyTabPreferenceActivity {
     private static final String FRAGMENT_TAG = "edit_info_fragment";
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         getWindow().addFlags(FLAG_DISMISS_KEYGUARD);
-        EmergencyInfoFragment emergencyInfoFragment =
-                (EmergencyInfoFragment) getFragmentManager().findFragmentByTag(FRAGMENT_TAG);
-        if (emergencyInfoFragment == null) {
-            // Create the fragment with readOnly set to false
-            emergencyInfoFragment = EmergencyInfoFragment
-                    .createEmergencyInfoFragment(false);
-
-            // Display the fragment as the main content.
-            getFragmentManager().beginTransaction().replace(android.R.id.content,
-                    emergencyInfoFragment, FRAGMENT_TAG).commit();
-        }
-
         MetricsLogger.visible(this, MetricsEvent.ACTION_EDIT_EMERGENCY_INFO);
     }
+
+    @Override
+    public boolean isInViewMode() {
+        return false;
+    }
+
+    @Override
+    public void onBackPressed() {
+        // If returning to the ViewInfoActivity, then the currently selected tab will be shown.
+        Intent resultIntent = new Intent();
+        resultIntent.putExtra(EXTRA_SELECTED_TAB, getSelectedTabPosition());
+        setResult(Activity.RESULT_OK, resultIntent);
+        finish();
+    }
 }
diff --git a/src/com/android/emergency/EmergencyContactsFragment.java b/src/com/android/emergency/EmergencyContactsFragment.java
new file mode 100644
index 0000000..20b5198
--- /dev/null
+++ b/src/com/android/emergency/EmergencyContactsFragment.java
@@ -0,0 +1,214 @@
+/*
+ * Copyright (C) 2016 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.android.emergency;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.Fragment;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.preference.Preference;
+import android.preference.PreferenceFragment;
+import android.provider.ContactsContract;
+import android.view.AbsSavedState;
+
+/**
+ * Fragment that displays emergency contacts. These contacts can be added or removed in edit mode.
+ */
+public class EmergencyContactsFragment extends PreferenceFragment {
+
+    /** Result code for contact picker */
+    private static final int CONTACT_PICKER_RESULT = 1001;
+
+    /** Key for emergency contacts preference */
+    private static final String KEY_EMERGENCY_CONTACTS = "emergency_contacts";
+
+    /** Key for the add contact preference */
+    private static final String KEY_ADD_CONTACT = "add_contact";
+
+    /** Key to store the dialog bundle to choose or create a new contact. */
+    private static final String KEY_CHOOSE_OR_CREATE_CONTACT_DIALOG =
+            "choose_or_create_contact_dialog";
+
+    private static final String ARG_VIEW_MODE = "view_mode";
+
+    /** Whether or not this fragment should be in view mode */
+    private boolean mInViewMode;
+
+    /** The category that holds the emergency contacts. */
+    private EmergencyContactsPreference mEmergencyContactsPreferenceCategory;
+
+    /** Choose or create contact dialog, non-null when opened. */
+    private Dialog mChooseOrCreateContactDialog;
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        addPreferencesFromResource(R.xml.emergency_contacts);
+        mInViewMode = getArguments().getBoolean(ARG_VIEW_MODE);
+
+        mEmergencyContactsPreferenceCategory = (EmergencyContactsPreference)
+                findPreference(KEY_EMERGENCY_CONTACTS);
+        mEmergencyContactsPreferenceCategory.setReadOnly(mInViewMode);
+
+        Preference addEmergencyContact = findPreference(KEY_ADD_CONTACT);
+        if (mInViewMode) {
+            getPreferenceScreen().removePreference(addEmergencyContact);
+        } else {
+            addEmergencyContact.setOnPreferenceClickListener(new Preference
+                    .OnPreferenceClickListener() {
+                @Override
+                public boolean onPreferenceClick(Preference preference) {
+                    showChooseOrCreateContactDialog(null);
+                    return true;
+                }
+            });
+        }
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        mEmergencyContactsPreferenceCategory.reloadFromPreference();
+    }
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        if (requestCode == CONTACT_PICKER_RESULT && resultCode == Activity.RESULT_OK) {
+            Uri uri = data.getData();
+            mEmergencyContactsPreferenceCategory.addNewEmergencyContact(uri);
+        }
+    }
+
+    @Override
+    public void onSaveInstanceState(Bundle savedInstanceState) {
+        super.onSaveInstanceState(savedInstanceState);
+        if (mChooseOrCreateContactDialog == null || !mChooseOrCreateContactDialog.isShowing()) {
+            return;
+        }
+
+        final SavedState myState = new SavedState(savedInstanceState);
+        myState.isDialogShowing = true;
+        myState.dialogBundle = mChooseOrCreateContactDialog.onSaveInstanceState();
+        savedInstanceState.putParcelable(KEY_CHOOSE_OR_CREATE_CONTACT_DIALOG, myState);
+    }
+
+    @Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        super.onActivityCreated(savedInstanceState);
+        if (savedInstanceState != null) {
+            SavedState myState =
+                    (SavedState) savedInstanceState.get(KEY_CHOOSE_OR_CREATE_CONTACT_DIALOG);
+            if (myState != null && myState.isDialogShowing) {
+                showChooseOrCreateContactDialog(myState.dialogBundle);
+            }
+        }
+    }
+
+    private void showChooseOrCreateContactDialog(Bundle state) {
+        AlertDialog.Builder chooseOrCreateDialogBuilder =
+                new AlertDialog.Builder(getContext());
+        chooseOrCreateDialogBuilder.setTitle(getContext()
+                .getString(R.string.add_emergency_contact));
+        String[] chooseOrCreate =
+                getContext().getResources()
+                        .getStringArray(R.array.choose_create_contact_values);
+        chooseOrCreateDialogBuilder.setItems(chooseOrCreate,
+                new DialogInterface.OnClickListener() {
+                    @Override
+                    public void onClick(DialogInterface dialogInterface, int i) {
+                        switch (i) {
+                            case 0:
+                                // Choose an existing contact
+                                Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,
+                                        ContactsContract.Contacts.CONTENT_URI);
+                                startActivityForResult(contactPickerIntent,
+                                        CONTACT_PICKER_RESULT);
+                                break;
+                            case 1:
+                                // Create a new contact
+                                Intent createContactIntent = new Intent(Intent.ACTION_INSERT);
+                                createContactIntent
+                                        .setType(ContactsContract.Contacts.CONTENT_TYPE);
+                                // Fix for 4.0.3 +
+                                createContactIntent
+                                        .putExtra("finishActivityOnSaveCompleted", true);
+                                startActivityForResult(createContactIntent,
+                                        CONTACT_PICKER_RESULT);
+                                break;
+                        }
+                    }
+                });
+        Dialog dialog = mChooseOrCreateContactDialog = chooseOrCreateDialogBuilder.create();
+        if (state != null) {
+            dialog.onRestoreInstanceState(state);
+        }
+        dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
+            @Override
+            public void onDismiss(DialogInterface dialogInterface) {
+                mChooseOrCreateContactDialog = null;
+            }
+        });
+        dialog.show();
+    }
+
+    public static Fragment newInstance(boolean inViewMode) {
+        Bundle emergencyInfoArgs = new Bundle();
+        emergencyInfoArgs.putBoolean(ARG_VIEW_MODE, inViewMode);
+        EmergencyContactsFragment emergencyContactsFragment = new EmergencyContactsFragment();
+        emergencyContactsFragment.setArguments(emergencyInfoArgs);
+        return emergencyContactsFragment;
+    }
+
+    private static class SavedState extends AbsSavedState {
+        boolean isDialogShowing;
+        Bundle dialogBundle;
+
+        public SavedState(Parcel source) {
+            super(source);
+            isDialogShowing = source.readInt() == 1;
+            dialogBundle = source.readBundle();
+        }
+
+        @Override
+        public void writeToParcel(Parcel dest, int flags) {
+            super.writeToParcel(dest, flags);
+            dest.writeInt(isDialogShowing ? 1 : 0);
+            dest.writeBundle(dialogBundle);
+        }
+
+        public SavedState(Parcelable superState) {
+            super(superState);
+        }
+
+        public static final Parcelable.Creator<SavedState> CREATOR =
+                new Parcelable.Creator<SavedState>() {
+                    public SavedState createFromParcel(Parcel in) {
+                        return new SavedState(in);
+                    }
+
+                    public SavedState[] newArray(int size) {
+                        return new SavedState[size];
+                    }
+                };
+    }
+}
diff --git a/src/com/android/emergency/EmergencyInfoFragment.java b/src/com/android/emergency/EmergencyInfoFragment.java
index 848f637..d117080 100644
--- a/src/com/android/emergency/EmergencyInfoFragment.java
+++ b/src/com/android/emergency/EmergencyInfoFragment.java
@@ -15,19 +15,10 @@
  */
 package com.android.emergency;
 
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.net.Uri;
+import android.app.Fragment;
 import android.os.Bundle;
-import android.os.Parcel;
-import android.os.Parcelable;
 import android.preference.Preference;
 import android.preference.PreferenceFragment;
-import android.provider.ContactsContract;
-import android.view.AbsSavedState;
 
 import com.android.internal.logging.MetricsLogger;
 import com.android.internal.logging.MetricsProto.MetricsEvent;
@@ -36,72 +27,37 @@
 import java.util.List;
 
 /**
- * Fragment that displays health information and emergency contacts.
- * Takes in boolean readOnly to determine whether or not to allow information to be edited.
+ * Fragment that displays personal and medical information.
  */
 public class EmergencyInfoFragment extends PreferenceFragment {
 
-    /** Result code for contact picker */
-    private static final int CONTACT_PICKER_RESULT = 1001;
-
     /** Key for description preference */
     private static final String KEY_DESCRIPTION = "description";
 
-    /** Key for emergency contacts preference */
-    private static final String KEY_EMERGENCY_CONTACTS = "emergency_contacts";
-
-    /** Key for the add contact preference */
-    private static final String KEY_ADD_CONTACT = "add_contact";
-
-    /** Key to look up whether or not the fragment should be read only from the bundle */
-    private static final String KEY_READ_ONLY = "read_only";
-
     /** Keys for all editable preferences- used to set up bindings */
     private static final String[] PREFERENCE_KEYS = {"name", "address", "date_of_birth",
             "blood_type", "allergies", "medications", "medical_conditions", "organ_donor"};
 
-    /** Key to store the dialog bundle to choose or create a new contact. */
-    private static final String KEY_CHOOSE_OR_CREATE_CONTACT_DIALOG =
-            "choose_or_create_contact_dialog";
+    private static final String ARG_VIEW_MODE = "view_mode";
 
-    /** Whether or not this fragment should be read only */
-    private boolean mReadOnly;
+    /** Whether or not this fragment should be in view mode */
+    private boolean mInViewMode;
 
     /** A list with all the preferences that are always present (in view and edit mode). */
     private final List<Preference> mPreferences = new ArrayList<Preference>();
 
-    /** The category that holds the emergency contacts. */
-    private EmergencyContactsPreference mEmergencyContactsPreferenceCategory;
-
-    /** Choose or create contact dialog, non-null when opened. */
-    private Dialog mChooseOrCreateContactDialog;
-    /**
-     * Creates a new EmergencyInfoFragment that can be used to edit user info if {@code readOnly}
-     * is false. Otherwise, it provides a non-editable view of the emergency info.
-     */
-    public static EmergencyInfoFragment createEmergencyInfoFragment(boolean readOnly) {
-        Bundle emergencyInfoArgs = new Bundle();
-        emergencyInfoArgs.putBoolean(KEY_READ_ONLY, readOnly);
-        EmergencyInfoFragment emergencyInfoFragment = new EmergencyInfoFragment();
-        emergencyInfoFragment.setArguments(emergencyInfoArgs);
-        return emergencyInfoFragment;
-    }
-
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
         addPreferencesFromResource(R.xml.emergency_info);
-        mReadOnly = getArguments().getBoolean(KEY_READ_ONLY);
-        if (mReadOnly) {
+        mInViewMode = getArguments().getBoolean(ARG_VIEW_MODE);
+
+        if (mInViewMode) {
             Preference description = findPreference(KEY_DESCRIPTION);
             getPreferenceScreen().removePreference(description);
         }
 
-        mEmergencyContactsPreferenceCategory = (EmergencyContactsPreference)
-                findPreference(KEY_EMERGENCY_CONTACTS);
-        mEmergencyContactsPreferenceCategory.setReadOnly(mReadOnly);
-
         for (String preferenceKey : PREFERENCE_KEYS) {
             Preference preference = findPreference(preferenceKey);
             mPreferences.add(preference);
@@ -114,26 +70,12 @@
                 }
             });
 
-            if (mReadOnly) {
+            if (mInViewMode) {
                 preference.setEnabled(false);
                 preference.setShouldDisableView(false);
                 preference.setSelectable(false);
             }
         }
-
-        Preference addEmergencyContact = findPreference(KEY_ADD_CONTACT);
-        if (mReadOnly) {
-            getPreferenceScreen().removePreference(addEmergencyContact);
-        } else {
-            addEmergencyContact.setOnPreferenceClickListener(new Preference
-                    .OnPreferenceClickListener() {
-                @Override
-                public boolean onPreferenceClick(Preference preference) {
-                    showChooseOrCreateContactDialog(null);
-                    return true;
-                }
-            });
-        }
     }
 
     @Override
@@ -144,119 +86,13 @@
                 ((ReloadablePreferenceInterface) preference).reloadFromPreference();
             }
         }
-        mEmergencyContactsPreferenceCategory.reloadFromPreference();
     }
 
-    @Override
-    public void onActivityResult(int requestCode, int resultCode, Intent data) {
-        if (requestCode == CONTACT_PICKER_RESULT && resultCode == Activity.RESULT_OK) {
-            Uri uri = data.getData();
-            mEmergencyContactsPreferenceCategory.addNewEmergencyContact(uri);
-        }
-    }
-
-    @Override
-    public void onSaveInstanceState(Bundle savedInstanceState) {
-        super.onSaveInstanceState(savedInstanceState);
-        if (mChooseOrCreateContactDialog == null || !mChooseOrCreateContactDialog.isShowing()) {
-            return;
-        }
-
-        final SavedState myState = new SavedState(savedInstanceState);
-        myState.isDialogShowing = true;
-        myState.dialogBundle = mChooseOrCreateContactDialog.onSaveInstanceState();
-        savedInstanceState.putParcelable(KEY_CHOOSE_OR_CREATE_CONTACT_DIALOG, myState);
-    }
-
-    @Override
-    public void onActivityCreated(Bundle savedInstanceState) {
-        super.onActivityCreated(savedInstanceState);
-        if (savedInstanceState != null) {
-            SavedState myState =
-                    (SavedState) savedInstanceState.get(KEY_CHOOSE_OR_CREATE_CONTACT_DIALOG);
-            if (myState != null && myState.isDialogShowing) {
-                showChooseOrCreateContactDialog(myState.dialogBundle);
-            }
-        }
-    }
-
-    private void showChooseOrCreateContactDialog(Bundle state) {
-        AlertDialog.Builder chooseOrCreateDialogBuilder =
-                new AlertDialog.Builder(getContext());
-        chooseOrCreateDialogBuilder.setTitle(getContext()
-                .getString(R.string.add_emergency_contact));
-        String[] chooseOrCreate =
-                getContext().getResources()
-                        .getStringArray(R.array.choose_create_contact_values);
-        chooseOrCreateDialogBuilder.setItems(chooseOrCreate,
-                new DialogInterface.OnClickListener() {
-                    @Override
-                    public void onClick(DialogInterface dialogInterface, int i) {
-                        switch (i) {
-                            case 0:
-                                // Choose an existing contact
-                                Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,
-                                        ContactsContract.Contacts.CONTENT_URI);
-                                startActivityForResult(contactPickerIntent,
-                                        CONTACT_PICKER_RESULT);
-                                break;
-                            case 1:
-                                // Create a new contact
-                                Intent createContactIntent = new Intent(Intent.ACTION_INSERT);
-                                createContactIntent
-                                        .setType(ContactsContract.Contacts.CONTENT_TYPE);
-                                // Fix for 4.0.3 +
-                                createContactIntent
-                                        .putExtra("finishActivityOnSaveCompleted", true);
-                                startActivityForResult(createContactIntent,
-                                        CONTACT_PICKER_RESULT);
-                                break;
-                        }
-                    }
-                });
-        Dialog dialog = mChooseOrCreateContactDialog = chooseOrCreateDialogBuilder.create();
-        if (state != null) {
-            dialog.onRestoreInstanceState(state);
-        }
-        dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
-            @Override
-            public void onDismiss(DialogInterface dialogInterface) {
-                mChooseOrCreateContactDialog = null;
-            }
-        });
-        dialog.show();
-    }
-
-    private static class SavedState extends AbsSavedState {
-        boolean isDialogShowing;
-        Bundle dialogBundle;
-
-        public SavedState(Parcel source) {
-            super(source);
-            isDialogShowing = source.readInt() == 1;
-            dialogBundle = source.readBundle();
-        }
-
-        @Override
-        public void writeToParcel(Parcel dest, int flags) {
-            super.writeToParcel(dest, flags);
-            dest.writeInt(isDialogShowing ? 1 : 0);
-            dest.writeBundle(dialogBundle);
-        }
-
-        public SavedState(Parcelable superState) {
-            super(superState);
-        }
-
-        public static final Parcelable.Creator<SavedState> CREATOR =
-                new Parcelable.Creator<SavedState>() {
-                    public SavedState createFromParcel(Parcel in) {
-                        return new SavedState(in);
-                    }
-
-                    public SavedState[] newArray(int size) {
-                        return new SavedState[size];
-                    }
-                };
+    public static Fragment newInstance(boolean inViewMode) {
+        Bundle emergencyInfoArgs = new Bundle();
+        emergencyInfoArgs.putBoolean(ARG_VIEW_MODE, inViewMode);
+        EmergencyInfoFragment emergencyInfoFragment = new EmergencyInfoFragment();
+        emergencyInfoFragment.setArguments(emergencyInfoArgs);
+        return emergencyInfoFragment;
     }
 }
diff --git a/src/com/android/emergency/EmergencyTabPreferenceActivity.java b/src/com/android/emergency/EmergencyTabPreferenceActivity.java
new file mode 100644
index 0000000..2f86d76
--- /dev/null
+++ b/src/com/android/emergency/EmergencyTabPreferenceActivity.java
@@ -0,0 +1,260 @@
+/*
+ * Copyright (C) 2016 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.android.emergency;
+
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.preference.PreferenceActivity;
+import android.support.annotation.LayoutRes;
+import android.support.annotation.Nullable;
+import android.support.design.widget.TabLayout;
+import android.support.design.widget.TabLayout.TabLayoutOnPageChangeListener;
+import android.support.design.widget.TabLayout.ViewPagerOnTabSelectedListener;
+import android.support.v13.app.FragmentStatePagerAdapter;
+import android.support.v4.view.ViewPager;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.AppCompatDelegate;
+import android.support.v7.widget.Toolbar;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TableLayout;
+
+/**
+ * A {@link PreferenceActivity} which implements and proxies the necessary calls
+ * to be used with AppCompat. It uses a tab layout to separate personal and medical information
+ * from emergency contacts.
+ */
+public abstract class EmergencyTabPreferenceActivity extends PreferenceActivity {
+
+    private AppCompatDelegate mDelegate;
+
+    protected static final String EXTRA_SELECTED_TAB = "selected_tab";
+
+    public static final int INDEX_INFO_TAB = 0;
+    public static final int INDEX_CONTACTS_TAB = 1;
+    private static final int NUMBER_TABS = 2;
+
+    private ViewPagerAdapter mTabsAdapter;
+    private TabLayout mTabLayout;
+
+    private Fragment[] mFragments = new Fragment[NUMBER_TABS];
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        getDelegate().installViewFactory();
+        getDelegate().onCreate(savedInstanceState);
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.tab_layout);
+        mTabLayout = (TabLayout) findViewById(R.id.sliding_tabs);
+
+        if (mTabsAdapter == null) {
+            // The viewpager that will host the section contents.
+            ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);
+            mTabsAdapter = new ViewPagerAdapter(getFragmentManager());
+            viewPager.setAdapter(mTabsAdapter);
+            mTabLayout.setTabsFromPagerAdapter(mTabsAdapter);
+
+            // Set a listener via setOnTabSelectedListener(OnTabSelectedListener) to be notified
+            // when any tab's selection state has been changed.
+            mTabLayout.setOnTabSelectedListener(
+                    new TabLayout.ViewPagerOnTabSelectedListener(viewPager));
+
+            // Use a TabLayout.TabLayoutOnPageChangeListener to forward the scroll and selection
+            // changes to this layout
+            viewPager.addOnPageChangeListener(new TabLayoutOnPageChangeListener(mTabLayout));
+        }
+
+        // Select the same tab that was selected in the Edit/View activity.
+        final int selectedTabIndex = getIntent().getIntExtra(EXTRA_SELECTED_TAB, INDEX_INFO_TAB);
+        selectTab(selectedTabIndex);
+
+        setupActionBar();
+    }
+
+    /** Selects the tab at index {@code selectedTabIndex}. */
+    public void selectTab(int selectedTabIndex) {
+        TabLayout.Tab tab = mTabLayout.getTabAt(selectedTabIndex);
+        tab.select();
+    }
+
+    /** Returns the index of the currently selected tab. */
+    public int getSelectedTabPosition() {
+        return mTabLayout.getSelectedTabPosition();
+    }
+
+    @Override
+    protected void onSaveInstanceState(Bundle outState) {
+        super.onSaveInstanceState(outState);
+    }
+
+    @Override
+    protected void onPostCreate(Bundle savedInstanceState) {
+        super.onPostCreate(savedInstanceState);
+        getDelegate().onPostCreate(savedInstanceState);
+    }
+
+    public ActionBar getSupportActionBar() {
+        return getDelegate().getSupportActionBar();
+    }
+
+    public void setSupportActionBar(@Nullable Toolbar toolbar) {
+        getDelegate().setSupportActionBar(toolbar);
+    }
+
+    @Override
+    public MenuInflater getMenuInflater() {
+        return getDelegate().getMenuInflater();
+    }
+
+    @Override
+    public void setContentView(@LayoutRes int layoutResID) {
+        getDelegate().setContentView(layoutResID);
+    }
+
+    @Override
+    public void setContentView(View view) {
+        getDelegate().setContentView(view);
+    }
+
+    @Override
+    public void setContentView(View view, ViewGroup.LayoutParams params) {
+        getDelegate().setContentView(view, params);
+    }
+
+    @Override
+    public void addContentView(View view, ViewGroup.LayoutParams params) {
+        getDelegate().addContentView(view, params);
+    }
+
+    @Override
+    protected void onPostResume() {
+        super.onPostResume();
+        getDelegate().onPostResume();
+    }
+
+    @Override
+    protected void onTitleChanged(CharSequence title, int color) {
+        super.onTitleChanged(title, color);
+        getDelegate().setTitle(title);
+    }
+
+    @Override
+    public void onConfigurationChanged(Configuration newConfig) {
+        super.onConfigurationChanged(newConfig);
+        getDelegate().onConfigurationChanged(newConfig);
+    }
+
+    @Override
+    protected void onStop() {
+        super.onStop();
+        getDelegate().onStop();
+    }
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+        getDelegate().onDestroy();
+    }
+
+    private void setupActionBar() {
+        ActionBar actionBar = getSupportActionBar();
+        if (actionBar != null) {
+            // Show the Up button in the action bar.
+            actionBar.setDisplayHomeAsUpEnabled(true);
+        }
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            // Respond to the action bar's Up/Home button.
+            case android.R.id.home:
+                onBackPressed();
+                return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    @Override
+    public void invalidateOptionsMenu() {
+        getDelegate().invalidateOptionsMenu();
+    }
+
+    /** Returns whether the activity is in view mode (true) or in edit mode (false). */
+    public abstract boolean isInViewMode();
+
+    private AppCompatDelegate getDelegate() {
+        if (mDelegate == null) {
+            mDelegate = AppCompatDelegate.create(this, null);
+        }
+        return mDelegate;
+    }
+
+    /** The adapter used to handle the two fragments. */
+    private class ViewPagerAdapter extends FragmentStatePagerAdapter {
+        public ViewPagerAdapter(FragmentManager fm) {
+            super(fm);
+        }
+
+        @Override
+        public Object instantiateItem(ViewGroup container, int position) {
+            Fragment fragment = (Fragment) super.instantiateItem(container, position);
+            mFragments[position] = fragment;
+            return fragment;
+        }
+
+        @Override
+        public void destroyItem(ViewGroup container, int position, Object object) {
+            mFragments[position] = null;
+        }
+
+        @Override
+        public Fragment getItem(int position) {
+            Fragment fragment = mFragments[position];
+            if (fragment != null) {
+                return fragment;
+            }
+            switch (position) {
+                case INDEX_INFO_TAB:
+                    return EmergencyInfoFragment.newInstance(isInViewMode());
+                case INDEX_CONTACTS_TAB:
+                    return EmergencyContactsFragment.newInstance(isInViewMode());
+            }
+            return null;
+        }
+
+        @Override
+        public int getCount() {
+            return NUMBER_TABS;
+        }
+
+        @Override
+        public CharSequence getPageTitle(int position) {
+            switch (position) {
+                case INDEX_INFO_TAB:
+                    return getResources().getString(R.string.tab_title_info);
+                case INDEX_CONTACTS_TAB:
+                    return getResources().getString(R.string.tab_title_contacts);
+            }
+            return null;
+        }
+    }
+}
diff --git a/src/com/android/emergency/ViewInfoActivity.java b/src/com/android/emergency/ViewInfoActivity.java
index 1102ab0..604bac0 100644
--- a/src/com/android/emergency/ViewInfoActivity.java
+++ b/src/com/android/emergency/ViewInfoActivity.java
@@ -18,12 +18,9 @@
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
-import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
 import android.view.WindowManager;
 
 import com.android.internal.logging.MetricsLogger;
@@ -32,26 +29,14 @@
 /**
  * Activity for viewing emergency information.
  */
-public class ViewInfoActivity extends AppCompatPreferenceActivity {
+public class ViewInfoActivity extends EmergencyTabPreferenceActivity {
 
-    private static final String FRAGMENT_TAG = "view_info_fragment";
+    private static final int EDIT_ACTIVITY_RESULT = 1001;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
         super.onCreate(savedInstanceState);
-        EmergencyInfoFragment emergencyInfoFragment =
-                (EmergencyInfoFragment) getFragmentManager().findFragmentByTag(FRAGMENT_TAG);
-        if (emergencyInfoFragment == null) {
-            // Create the fragment with readOnly set to true
-            emergencyInfoFragment = EmergencyInfoFragment
-                    .createEmergencyInfoFragment(true);
-
-            // Display the fragment as the main content.
-            getFragmentManager().beginTransaction().replace(android.R.id.content,
-                    emergencyInfoFragment, FRAGMENT_TAG).commit();
-        }
-
         MetricsLogger.visible(this, MetricsEvent.ACTION_VIEW_EMERGENCY_INFO);
     }
 
@@ -67,9 +52,24 @@
         switch (item.getItemId()) {
             case R.id.action_edit:
                 Intent intent = new Intent(this, EditInfoActivity.class);
-                startActivity(intent);
+                intent.putExtra(EXTRA_SELECTED_TAB, getSelectedTabPosition());
+                startActivityForResult(intent, EDIT_ACTIVITY_RESULT);
                 return true;
         }
         return super.onOptionsItemSelected(item);
     }
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        if (requestCode == EDIT_ACTIVITY_RESULT && resultCode == Activity.RESULT_OK) {
+            // Select the same tab that was last selected in the EditInfoActivity
+            selectTab(data.getIntExtra(EXTRA_SELECTED_TAB, getSelectedTabPosition()));
+        }
+    }
+
+    @Override
+    public boolean isInViewMode() {
+        return true;
+    }
 }
\ No newline at end of file