Make PeopleActivity extends AppCompatActivity (1/3)

This CL includes a subset of reversion of ag/871001.

This topic of CLs will lead to the following changes in APK sizes:

- GoogleContacts: 8.0MB --> 8.7MB
- GoogleContacts-N: 7.6MB --> 8.2MB

Bug 27687799

Change-Id: Id94598e42a5016badeafee3f4f0dc2a515fc68eb
diff --git a/Android.mk b/Android.mk
index 566e27e..ad13292 100644
--- a/Android.mk
+++ b/Android.mk
@@ -20,6 +20,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, $(src_dirs))
 LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs)) \
+    $(support_library_root_dir)/v7/appcompat/res \
     $(support_library_root_dir)/v7/cardview/res
 LOCAL_ASSET_DIR := $(addprefix $(LOCAL_PATH)/, $(asset_dirs))
 
@@ -27,6 +28,7 @@
     --auto-add-overlay \
     --extra-packages com.android.contacts.common \
     --extra-packages com.android.phone.common \
+    --extra-packages android.support.v7.appcompat \
     --extra-packages android.support.v7.cardview
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
@@ -34,6 +36,7 @@
     android-common \
     guava \
     android-support-v13 \
+    android-support-v7-appcompat \
     android-support-v7-cardview \
     android-support-v7-palette \
     android-support-v4 \
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 9d1c4a1..ed4189e 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -64,7 +64,7 @@
         <!-- The main Contacts activity with the contact list, favorites, and groups. -->
         <activity android:name=".activities.PeopleActivity"
             android:label="@string/launcherActivityLabel"
-            android:theme="@style/PeopleTheme"
+            android:theme="@style/PeopleActivityTheme"
             android:clearTaskOnLaunch="true"
             android:launchMode="singleTop"
             android:resizeableActivity="true"
diff --git a/res/layout-land/contacts_unavailable_fragment_content.xml b/res/layout-land/contacts_unavailable_fragment_content.xml
index 4f26db6..3d5a0b0 100644
--- a/res/layout-land/contacts_unavailable_fragment_content.xml
+++ b/res/layout-land/contacts_unavailable_fragment_content.xml
@@ -69,6 +69,7 @@
             android:layout_gravity="center_horizontal">
 
             <Button
+                style="@style/ContactsUnavailableButtonStyle"
                 android:id="@+id/add_account_button"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
@@ -78,6 +79,7 @@
                 android:text="@string/contacts_unavailable_add_account" />
 
             <Button
+                style="@style/ContactsUnavailableButtonStyle"
                 android:id="@+id/import_contacts_button"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
diff --git a/res/layout-land/people_activity_toolbar.xml b/res/layout-land/people_activity_toolbar.xml
index d33a96c..c110133 100644
--- a/res/layout-land/people_activity_toolbar.xml
+++ b/res/layout-land/people_activity_toolbar.xml
@@ -28,13 +28,15 @@
     <FrameLayout
         android:id="@+id/toolbar_frame"
         android:layout_width="match_parent"
-        android:layout_height="?android:attr/actionBarSize"
+        android:layout_height="?attr/actionBarSize"
         android:background="@color/actionbar_background_color">
 
-        <Toolbar
+        <!-- the attribute padding removes the gap between this Toolbar and its parent FrameLayout on tablet -->
+        <android.support.v7.widget.Toolbar
             android:layout_width="match_parent"
-            android:layout_height="?android:attr/actionBarSize"
+            android:layout_height="?attr/actionBarSize"
             android:id="@+id/toolbar"
+            android:padding="0dp"
             style="@style/ContactsToolbarStyle" />
 
     </FrameLayout>
diff --git a/res/layout/contacts_unavailable_fragment_content.xml b/res/layout/contacts_unavailable_fragment_content.xml
index 9482273..765e453 100644
--- a/res/layout/contacts_unavailable_fragment_content.xml
+++ b/res/layout/contacts_unavailable_fragment_content.xml
@@ -58,6 +58,7 @@
         android:layout_height="wrap_content">
 
         <Button
+            style="@style/ContactsUnavailableButtonStyle"
             android:id="@+id/add_account_button"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
@@ -67,6 +68,7 @@
             android:text="@string/contacts_unavailable_add_account" />
 
         <Button
+            style="@style/ContactsUnavailableButtonStyle"
             android:id="@+id/import_contacts_button"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
diff --git a/res/layout/custom_action_bar.xml b/res/layout/custom_action_bar.xml
index 5b930ea..9604849 100644
--- a/res/layout/custom_action_bar.xml
+++ b/res/layout/custom_action_bar.xml
@@ -28,7 +28,7 @@
         android:layout_height="1px" >
         <requestFocus />
     </View>
-    <SearchView
+    <android.support.v7.widget.SearchView
         android:id="@+id/search_view"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
diff --git a/res/layout/people_activity_toolbar.xml b/res/layout/people_activity_toolbar.xml
index cbb4d91..da1dae4 100644
--- a/res/layout/people_activity_toolbar.xml
+++ b/res/layout/people_activity_toolbar.xml
@@ -24,13 +24,15 @@
     <FrameLayout
         android:id="@+id/toolbar_frame"
         android:layout_width="match_parent"
-        android:layout_height="?android:attr/actionBarSize"
+        android:layout_height="?attr/actionBarSize"
         android:background="@color/actionbar_background_color">
 
-        <Toolbar
+        <!-- the attribute padding removes the gap between this Toolbar and its parent FrameLayout on tablet -->
+        <android.support.v7.widget.Toolbar
             android:layout_width="match_parent"
-            android:layout_height="?android:attr/actionBarSize"
+            android:layout_height="?attr/actionBarSize"
             android:id="@+id/toolbar"
+            android:padding="0dp"
             style="@style/ContactsToolbarStyle" />
 
     </FrameLayout>
@@ -38,7 +40,7 @@
     <com.android.contacts.common.list.ViewPagerTabs
         android:id="@+id/lists_pager_header"
         android:layout_width="match_parent"
-        android:layout_height="?android:attr/actionBarSize"
+        android:layout_height="?attr/actionBarSize"
         android:textAllCaps="true"
         android:orientation="horizontal"
         android:layout_gravity="top"
diff --git a/res/layout/selection_bar.xml b/res/layout/selection_bar.xml
index 34cdd60..f91c2b8 100644
--- a/res/layout/selection_bar.xml
+++ b/res/layout/selection_bar.xml
@@ -25,7 +25,7 @@
         android:layout_width="48dp"
         android:layout_height="48dp"
         android:src="@drawable/ic_back_arrow"
-        android:background="?android:attr/selectableItemBackgroundBorderless"
+        android:background="?attr/selectableItemBackgroundBorderless"
         android:contentDescription="@string/action_menu_back_from_search"
         android:layout_gravity="center_vertical|start"
         android:tint="@android:color/white" />
@@ -37,6 +37,6 @@
         android:layout_height="wrap_content"
         android:visibility="gone"
         android:layout_gravity="center_vertical|start"
-        style="@style/ContactsActionBarTitleText" />
+        style="@style/ContactsActionBarTitleTextAppCompat" />
 
 </FrameLayout>
diff --git a/res/menu/people_options.xml b/res/menu/people_options.xml
index fe6cbd3..032bea6 100644
--- a/res/menu/people_options.xml
+++ b/res/menu/people_options.xml
@@ -13,12 +13,13 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+      xmlns:contacts="http://schemas.android.com/apk/res-auto">
     <item
         android:id="@+id/menu_search"
         android:icon="@drawable/ic_ab_search"
         android:title="@string/menu_search"
-        android:showAsAction="ifRoom" />
+        contacts:showAsAction="ifRoom" />
 
     <item
         android:id="@+id/menu_contacts_filter"
diff --git a/res/menu/search_menu.xml b/res/menu/search_menu.xml
index 355442e..c890f20 100644
--- a/res/menu/search_menu.xml
+++ b/res/menu/search_menu.xml
@@ -13,10 +13,11 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+      xmlns:contacts="http://schemas.android.com/apk/res-auto">
     <item
         android:id="@+id/menu_search"
         android:icon="@drawable/ic_ab_search"
         android:title="@string/menu_search"
-        android:showAsAction="always" />
+        contacts:showAsAction="always" />
 </menu>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 6da3b94..86c46fc 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -20,8 +20,6 @@
         <attr name="mimeType" format="string"/>
         <!-- RemoteViews XML that should be used to format this data -->
         <attr name="remoteViews" format="reference"/>
-        <!-- Icon that should be used to represent this data -->
-        <attr name="icon" format="reference"/>
         <!-- Column in data table to summarize this data -->
         <attr name="summaryColumn" format="string"/>
         <!-- Column in data table to show details of this data -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 7402235..5309a55 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -108,6 +108,84 @@
         <item name="favorites_padding_bottom">0dip</item>
     </style>
 
+    <style name="PeopleActivityTheme" parent="@style/PeopleThemeAppCompat">
+        <item name="windowActionBar">false</item>
+        <item name="windowNoTitle">true</item>
+        <item name="android:listSelector">?android:attr/listChoiceBackgroundIndicator</item>
+    </style>
+
+    <style name="PeopleThemeAppCompat" parent="Theme.AppCompat.Light">
+        <!-- Styles that require AppCompat compatibility, remember to update both sets -->
+        <item name="android:actionBarStyle">@style/ContactsActionBarStyleAppCompat</item>
+        <item name="actionBarStyle">@style/ContactsActionBarStyleAppCompat</item>
+        <!-- Style for the tab bar (for the divider between tabs) -->
+        <item name="android:actionBarTabBarStyle">@style/ContactsActionBarTabBarStyle</item>
+        <item name="actionBarTabBarStyle">@style/ContactsActionBarTabBarStyle</item>
+        <!-- Style for the tab bar text (for text on tabs) -->
+        <item name="android:actionBarTabTextStyle">@style/ContactsActionBarTabTextStyle</item>
+        <item name="actionBarTabTextStyle">@style/ContactsActionBarTabTextStyle</item>
+        <!--  Drawable for the back button -->
+        <item name="android:homeAsUpIndicator">@drawable/ic_back_arrow</item>
+        <item name="homeAsUpIndicator">@drawable/ic_back_arrow</item>
+        <!-- Style for the overflow button in the actionbar. -->
+        <item name="android:actionOverflowButtonStyle">@style/ContactsActionBarOverflowQP</item>
+        <item name="actionOverflowButtonStyle">@style/ContactsActionBarOverflowQP</item>
+        <item name="android:actionModeCloseDrawable">@drawable/ic_close_lt</item>
+        <item name="android:fastScrollThumbDrawable">@drawable/fastscroll_thumb</item>
+        <item name="android:fastScrollTrackDrawable">@null</item>
+        <item name="android:textColorPrimary">@color/primary_text_color</item>
+        <item name="android:textColorSecondary">@color/secondary_text_color</item>
+        <item name="android:icon">@android:color/transparent</item>
+        <item name="android:listViewStyle">@style/ListViewStyle</item>
+        <item name="android:windowBackground">@color/background_primary</item>
+        <item name="android:colorPrimaryDark">@color/primary_color_dark</item>
+        <item name="colorPrimaryDark">@color/primary_color_dark</item>
+        <item name="android:colorPrimary">@color/primary_color</item>
+        <item name="colorPrimary">@color/primary_color</item>
+        <item name="android:colorAccent">@color/primary_color</item>
+        <item name="colorAccent">@color/primary_color</item>
+        <item name="android:alertDialogTheme">@style/ContactsAlertDialogTheme</item>
+        <item name="alertDialogTheme">@style/ContactsAlertDialogTheme</item>
+        <item name="list_item_height">?android:attr/listPreferredItemHeight</item>
+        <item name="activated_background">@drawable/list_item_activated_background</item>
+        <item name="section_header_background">@drawable/list_title_holo</item>
+        <item name="list_section_header_height">24dip</item>
+        <item name="list_item_padding_top">
+            @dimen/contact_browser_list_item_padding_top_or_bottom
+        </item>
+        <item name="list_item_padding_right">32dp</item>
+        <item name="list_item_padding_bottom">
+            @dimen/contact_browser_list_item_padding_top_or_bottom
+        </item>
+        <item name="list_item_padding_left">16dip</item>
+        <item name="list_item_gap_between_image_and_text">
+            @dimen/contact_browser_list_item_gap_between_image_and_text
+        </item>
+        <item name="list_item_gap_between_label_and_data">5dip</item>
+        <item name="list_item_presence_icon_margin">4dip</item>
+        <item name="list_item_presence_icon_size">16dip</item>
+        <item name="list_item_photo_size">@dimen/contact_browser_list_item_photo_size</item>
+        <item name="list_item_profile_photo_size">70dip</item>
+        <item name="list_item_prefix_highlight_color">@color/people_app_theme_color</item>
+        <item name="list_item_background_color">@color/list_item_pinned_header_color</item>
+        <item name="list_item_header_text_color">@color/people_app_theme_color</item>
+        <item name="list_item_header_text_size">14sp</item>
+        <item name="list_item_header_height">30dip</item>
+        <item name="list_item_data_width_weight">5</item>
+        <item name="list_item_label_width_weight">3</item>
+        <item name="list_item_header_text_indent">8dip</item>
+        <item name="contact_browser_list_padding_left">0dip</item>
+        <item name="contact_browser_list_padding_right">0dip</item>
+        <item name="contact_browser_background">@color/background_primary</item>
+        <item name="list_item_text_indent">@dimen/contact_browser_list_item_text_indent</item>
+        <!-- Favorites -->
+        <item name="favorites_padding_bottom">0dip</item>
+    </style>
+
+    <style name="ContactsUnavailableButtonStyle" parent="@style/Widget.AppCompat.Button.Colored">
+    </style>
+
+
     <style name="ContactsActionBarOverflow" parent="@android:style/Widget.Holo.ActionButton.Overflow">
         <item name="android:src">@drawable/ic_overflow_menu</item>
     </style>
@@ -122,14 +200,30 @@
         <item name="android:icon">@android:color/transparent</item>
     </style>
 
+    <style name="ContactsActionBarStyleAppCompat"
+           parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
+        <!-- Styles that require AppCompat compatibility, remember to update both sets -->
+        <item name="android:background">@color/actionbar_background_color</item>
+        <item name="background">@color/actionbar_background_color</item>
+        <item name="android:titleTextStyle">@style/ContactsActionBarTitleTextAppCompat</item>
+        <item name="titleTextStyle">@style/ContactsActionBarTitleTextAppCompat</item>
+        <item name="android:backgroundStacked">@color/actionbar_background_color</item>
+        <item name="backgroundStacked">@color/actionbar_background_color</item>
+        <!-- Empty icon -->
+        <item name="android:icon">@android:color/transparent</item>
+        <item name="icon">@android:color/transparent</item>
+    </style>
+
     <style name="EditorActionBarStyle" parent="@style/ContactsActionBarStyle">
         <item name="android:contentInsetStart">72dp</item>
     </style>
 
     <!-- When this style was added, android:toolbarStyle was private. Therefore, this style
          must be directly applied to every toolbar -->
-    <style name="ContactsToolbarStyle" parent="@android:style/Widget.Toolbar">
-        <item name="android:titleTextAppearance">@style/ContactsActionBarTitleText</item>
+    <style name="ContactsToolbarStyle" parent="@style/Widget.AppCompat.Toolbar">
+        <!-- Styles that require AppCompat compatibility, remember to update both sets -->
+        <item name="android:titleTextAppearance">@style/ContactsActionBarTitleTextAppCompat</item>
+        <item name="titleTextAppearance">@style/ContactsActionBarTitleTextAppCompat</item>
     </style>
 
     <style name="ContactsPickerActionBarStyle" parent="@style/ContactsActionBarStyle">
@@ -150,6 +244,10 @@
         <item name="android:textColor">@color/actionbar_text_color</item>
     </style>
 
+    <style name="ContactsActionBarTitleTextAppCompat" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
+        <item name="android:textColor">@color/actionbar_text_color</item>
+    </style>
+
     <!-- Styling for the tab bar; handles styling of the divider line. -->
     <style name="ContactsActionBarTabBarStyle"
            parent="@android:style/Widget.Material.ActionBar.TabBar">
@@ -168,7 +266,7 @@
 
     <!-- Action bar overflow menu icon. -->
     <style name="ContactsActionBarOverflowQP"
-           parent="@android:style/Widget.Material.Light.ActionButton.Overflow">
+           parent="Widget.AppCompat.Light.ActionButton.Overflow">
         <item name="android:src">@drawable/ic_more_vert</item>
         <item name="android:tint">@color/action_bar_button_text_color</item>
     </style>
diff --git a/src/com/android/contacts/AppCompatContactsActivity.java b/src/com/android/contacts/AppCompatContactsActivity.java
new file mode 100644
index 0000000..7654b27
--- /dev/null
+++ b/src/com/android/contacts/AppCompatContactsActivity.java
@@ -0,0 +1,130 @@
+/*
+ * 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.contacts;
+
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.app.FragmentTransaction;
+import android.content.ContentResolver;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.view.View;
+
+import com.android.contacts.common.activity.AppCompatTransactionSafeActivity;
+import com.android.contacts.common.testing.InjectedServices;
+
+/**
+ * A common superclass for Contacts activities that handles application-wide services, copied from
+ * {@link com.android.contacts.ContactsActivity}, which will be deprecated after Kitkat backporting
+ * is done.
+ */
+public abstract class AppCompatContactsActivity extends AppCompatTransactionSafeActivity
+        implements ContactSaveService.Listener {
+
+    private ContentResolver mContentResolver;
+
+    @Override
+    public ContentResolver getContentResolver() {
+        if (mContentResolver == null) {
+            InjectedServices services = ContactsApplication.getInjectedServices();
+            if (services != null) {
+                mContentResolver = services.getContentResolver();
+            }
+            if (mContentResolver == null) {
+                mContentResolver = super.getContentResolver();
+            }
+        }
+        return mContentResolver;
+    }
+
+    @Override
+    public SharedPreferences getSharedPreferences(String name, int mode) {
+        InjectedServices services = ContactsApplication.getInjectedServices();
+        if (services != null) {
+            SharedPreferences prefs = services.getSharedPreferences();
+            if (prefs != null) {
+                return prefs;
+            }
+        }
+
+        return super.getSharedPreferences(name, mode);
+    }
+
+    @Override
+    public Object getSystemService(String name) {
+        Object service = super.getSystemService(name);
+        if (service != null) {
+            return service;
+        }
+
+        return getApplicationContext().getSystemService(name);
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        ContactSaveService.registerListener(this);
+        super.onCreate(savedInstanceState);
+    }
+
+    @Override
+    protected void onDestroy() {
+        ContactSaveService.unregisterListener(this);
+        super.onDestroy();
+    }
+
+    @Override
+    public void onServiceCompleted(Intent callbackIntent) {
+        onNewIntent(callbackIntent);
+    }
+
+    /**
+     * Convenient version of {@link FragmentManager#findFragmentById(int)}, which throws
+     * an exception if the fragment doesn't exist.
+     */
+    @SuppressWarnings("unchecked")
+    public <T extends Fragment> T getFragment(int id) {
+        T result = (T)getFragmentManager().findFragmentById(id);
+        if (result == null) {
+            throw new IllegalArgumentException("fragment 0x" + Integer.toHexString(id)
+                    + " doesn't exist");
+        }
+        return result;
+    }
+
+    /**
+     * Convenient version of {@link #findViewById(int)}, which throws
+     * an exception if the view doesn't exist.
+     */
+    @SuppressWarnings("unchecked")
+    public <T extends View> T getView(int id) {
+        T result = (T)findViewById(id);
+        if (result == null) {
+            throw new IllegalArgumentException("view 0x" + Integer.toHexString(id)
+                    + " doesn't exist");
+        }
+        return result;
+    }
+
+    protected static void showFragment(FragmentTransaction ft, Fragment f) {
+        if ((f != null) && f.isHidden()) ft.show(f);
+    }
+
+    protected static void hideFragment(FragmentTransaction ft, Fragment f) {
+        if ((f != null) && !f.isHidden()) ft.hide(f);
+    }
+}
diff --git a/src/com/android/contacts/activities/ActionBarAdapter.java b/src/com/android/contacts/activities/ActionBarAdapter.java
index 9862b6f..ad70d92 100644
--- a/src/com/android/contacts/activities/ActionBarAdapter.java
+++ b/src/com/android/contacts/activities/ActionBarAdapter.java
@@ -17,7 +17,6 @@
 package com.android.contacts.activities;
 
 import android.animation.ValueAnimator;
-import android.app.ActionBar;
 import android.app.Activity;
 import android.content.Context;
 import android.content.SharedPreferences;
@@ -25,6 +24,8 @@
 import android.os.Bundle;
 import android.preference.PreferenceManager;
 import android.support.v4.content.ContextCompat;
+import android.support.v7.app.ActionBar;
+import android.support.v7.widget.Toolbar;
 import android.text.Editable;
 import android.text.TextUtils;
 import android.text.TextWatcher;
@@ -39,7 +40,6 @@
 import android.view.View.OnClickListener;
 import android.widget.EditText;
 import android.widget.TextView;
-import android.widget.Toolbar;
 
 import com.android.contacts.R;
 import com.android.contacts.activities.ActionBarAdapter.Listener.Action;
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index d349462..a26148a 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -37,6 +37,7 @@
 import android.support.v13.app.FragmentPagerAdapter;
 import android.support.v4.view.PagerAdapter;
 import android.support.v4.view.ViewPager;
+import android.support.v7.widget.Toolbar;
 import android.telecom.TelecomManager;
 import android.text.TextUtils;
 import android.util.Log;
@@ -47,12 +48,11 @@
 import android.view.MenuItem;
 import android.view.View;
 import android.view.ViewGroup;
-import android.view.Window;
 import android.widget.ImageButton;
 import android.widget.Toast;
-import android.widget.Toolbar;
 
-import com.android.contacts.ContactsActivity;
+
+import com.android.contacts.AppCompatContactsActivity;
 import com.android.contacts.R;
 import com.android.contacts.activities.ActionBarAdapter.TabState;
 import com.android.contacts.common.ContactsUtils;
@@ -104,7 +104,7 @@
 /**
  * Displays a list to browse contacts.
  */
-public class PeopleActivity extends ContactsActivity implements
+public class PeopleActivity extends AppCompatContactsActivity implements
         View.OnCreateContextMenuListener,
         View.OnClickListener,
         ActionBarAdapter.Listener,
@@ -299,10 +299,6 @@
     }
 
     private void createViewsAndFragments(Bundle savedState) {
-        // Disable the ActionBar so that we can use a Toolbar. This needs to be called before
-        // setContentView().
-        getWindow().requestFeature(Window.FEATURE_NO_TITLE);
-
         setContentView(R.layout.people_activity);
 
         final FragmentManager fragmentManager = getFragmentManager();
@@ -318,9 +314,9 @@
         mTabPager.setAdapter(mTabPagerAdapter);
         mTabPager.setOnPageChangeListener(mTabPagerListener);
 
-        // Configure toolbar and toolbar tabs. If in landscape mode, we  configure tabs differntly.
+        // Configure toolbar and toolbar tabs. If in landscape mode, we configure tabs differently.
         final Toolbar toolbar = getView(R.id.toolbar);
-        setActionBar(toolbar);
+        setSupportActionBar(toolbar);
         final ViewPagerTabs portraitViewPagerTabs
                 = (ViewPagerTabs) findViewById(R.id.lists_pager_header);
         ViewPagerTabs landscapeViewPagerTabs = null;
@@ -371,7 +367,7 @@
         // Setting Properties after fragment is created
         mFavoritesFragment.setDisplayType(DisplayType.STREQUENT);
 
-        mActionBarAdapter = new ActionBarAdapter(this, this, getActionBar(),
+        mActionBarAdapter = new ActionBarAdapter(this, this, getSupportActionBar(),
                 portraitViewPagerTabs, landscapeViewPagerTabs, toolbar);
         mActionBarAdapter.initialize(savedState, mRequest);