Merge "Hide dial button in-call so that in-call chooser dialog shows up" into klp-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 91e228e..d268345 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -60,7 +60,7 @@
              dialpad screen. -->
         <activity android:name=".DialtactsActivity"
             android:label="@string/launcherDialer"
-            android:theme="@style/NewDialtactsTheme"
+            android:theme="@style/DialtactsTheme"
             android:uiOptions="splitActionBarWhenNarrow"
             android:launchMode="singleTask"
             android:clearTaskOnLaunch="true"
@@ -119,7 +119,7 @@
 
         <activity android:name="com.android.dialer.calllog.CallLogActivity"
             android:label="@string/call_log_activity_title"
-            android:theme="@style/NewDialtactsTheme"
+            android:theme="@style/DialtactsTheme"
             android:screenOrientation="portrait"
             android:icon="@mipmap/ic_launcher_phone">
             <intent-filter>
@@ -130,6 +130,12 @@
             </intent-filter>
         </activity>
 
+        <activity android:name="com.android.dialer.list.AllContactsActivity"
+            android:label="@string/show_all_contacts_title"
+            android:theme="@style/DialtactsTheme"
+            android:screenOrientation="portrait">
+        </activity>
+
         <activity android:name="com.android.dialer.CallDetailActivity"
                   android:label="@string/callDetailTitle"
                   android:theme="@style/CallDetailActivityTheme"
diff --git a/res/layout/all_contacts_activity.xml b/res/layout/all_contacts_activity.xml
new file mode 100644
index 0000000..a913027
--- /dev/null
+++ b/res/layout/all_contacts_activity.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:layout_marginTop="?android:attr/actionBarSize"
+    android:id="@+id/all_contacts_frame">
+    <fragment android:name="com.android.dialer.list.AllContactsFragment"
+              android:id="@+id/all_contacts_fragment"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent" />
+</FrameLayout>
diff --git a/res/layout/dialpad_fragment.xml b/res/layout/dialpad_fragment.xml
index 178e33b..b79214a 100644
--- a/res/layout/dialpad_fragment.xml
+++ b/res/layout/dialpad_fragment.xml
@@ -82,7 +82,7 @@
             android:background="@color/dialpad_primary_text_color">
             <ImageButton
                 android:id="@+id/call_history_on_dialpad_button"
-                android:layout_height="@dimen/fake_action_bar_height"
+                android:layout_height="match_parent"
                 android:layout_width="@dimen/fake_menu_button_min_width"
                 android:layout_gravity="bottom|start"
                 android:background="@drawable/btn_call"
@@ -100,7 +100,7 @@
                 android:src="@drawable/ic_dial_action_call" />
             <ImageButton
                 android:id="@+id/overflow_menu_on_dialpad"
-                android:layout_height="@dimen/fake_action_bar_height"
+                android:layout_height="match_parent"
                 android:layout_width="@dimen/fake_menu_button_min_width"
                 android:layout_gravity="bottom|end"
                 android:background="@drawable/btn_call"
diff --git a/res/layout/show_all_contacts_fragment.xml b/res/layout/show_all_contacts_fragment.xml
index 0a95f27..14fe340 100644
--- a/res/layout/show_all_contacts_fragment.xml
+++ b/res/layout/show_all_contacts_fragment.xml
@@ -19,8 +19,7 @@
     android:id="@+id/pinned_header_list_layout"
     android:orientation="vertical"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:layout_marginTop="?android:attr/actionBarSize">
+    android:layout_height="match_parent">
 
     <!-- Shown only when an Account filter is set.
          - paddingTop should be here to show "shade" effect correctly. -->
@@ -35,7 +34,7 @@
         android:layout_weight="1" >
         <view
             class="com.android.contacts.common.list.PinnedHeaderListView"
-            style="@style/NewDialtactsTheme"
+            style="@style/DialtactsTheme"
             android:id="@android:id/list"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f35df9d..6ea6db6 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -547,52 +547,53 @@
     <!--  Title of activity that displays a list of all calls -->
     <string name="call_log_activity_title">History</string>
 
-    <!--  Do not translate. -->
+    <!-- The digit to be displayed on the 0 key of the dialpad [CHAR LIMIT=1]-->
     <string name="dialpad_0_number">0</string>
-    <!--  Do not translate. -->
-    <string name="dialpad_0_letters">+</string>
-    <!--  Do not translate. -->
+    <!-- The digit to be displayed on the 1 key of the dialpad [CHAR LIMIT=1]-->
     <string name="dialpad_1_number">1</string>
-    <!--  Do not translate. -->
-    <string name="dialpad_1_letters"></string>
-    <!--  Do not translate. -->
+    <!-- The digit to be displayed on the 2 key of the dialpad [CHAR LIMIT=1]-->
     <string name="dialpad_2_number">2</string>
-    <!--  Do not translate. -->
-    <string name="dialpad_2_letters">ABC</string>
-    <!--  Do not translate. -->
+    <!-- The digit to be displayed on the 3 key of the dialpad [CHAR LIMIT=1]-->
     <string name="dialpad_3_number">3</string>
-    <!--  Do not translate. -->
-    <string name="dialpad_3_letters">DEF</string>
-    <!--  Do not translate. -->
+    <!-- The digit to be displayed on the 4 key of the dialpad [CHAR LIMIT=1]-->
     <string name="dialpad_4_number">4</string>
-    <!--  Do not translate. -->
-    <string name="dialpad_4_letters">GHI</string>
-    <!--  Do not translate. -->
+    <!-- The digit to be displayed on the 5 key of the dialpad [CHAR LIMIT=1]-->
     <string name="dialpad_5_number">5</string>
-    <!--  Do not translate. -->
-    <string name="dialpad_5_letters">JKL</string>
-    <!--  Do not translate. -->
+    <!-- The digit to be displayed on the 6 key of the dialpad [CHAR LIMIT=1]-->
     <string name="dialpad_6_number">6</string>
-    <!--  Do not translate. -->
-    <string name="dialpad_6_letters">MNO</string>
-    <!--  Do not translate. -->
+    <!-- The digit to be displayed on the 7 key of the dialpad [CHAR LIMIT=1]-->
     <string name="dialpad_7_number">7</string>
-    <!--  Do not translate. -->
-    <string name="dialpad_7_letters">PQRS</string>
-    <!--  Do not translate. -->
+    <!-- The digit to be displayed on the 8 key of the dialpad [CHAR LIMIT=1]-->
     <string name="dialpad_8_number">8</string>
-    <!--  Do not translate. -->
-    <string name="dialpad_8_letters">TUV</string>
-    <!--  Do not translate. -->
+    <!-- The digit to be displayed on the 9 key of the dialpad [CHAR LIMIT=1]-->
     <string name="dialpad_9_number">9</string>
     <!--  Do not translate. -->
-    <string name="dialpad_9_letters">WXYZ</string>
-    <!--  Do not translate. -->
     <string name="dialpad_star_number">*</string>
     <!--  Do not translate. -->
-    <string name="dialpad_star_letters"></string>
-    <!--  Do not translate. -->
     <string name="dialpad_pound_number">#</string>
+
+    <!--  Do not translate. -->
+    <string name="dialpad_0_letters">+</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_1_letters"></string>
+    <!--  Do not translate. -->
+    <string name="dialpad_2_letters">ABC</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_3_letters">DEF</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_4_letters">GHI</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_5_letters">JKL</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_6_letters">MNO</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_7_letters">PQRS</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_8_letters">TUV</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_9_letters">WXYZ</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_star_letters"></string>
     <!--  Do not translate. -->
     <string name="dialpad_pound_letters"></string>
 
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 0805dd8..aab1c53 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -16,56 +16,6 @@
   -->
 <resources>
     <style name="DialtactsTheme"
-           parent="android:Theme.Holo">
-        <item name="android:textColorSecondary">@color/dialtacts_secondary_text_color</item>
-        <item name="android:windowActionBarOverlay">true</item>
-        <item name="android:actionBarStyle">@style/DialtactsActionBarStyle</item>
-        <item name="android:windowContentOverlay">@null</item>
-        <item name="android:windowBackground">@drawable/background_dial_holo_dark</item>
-        <item name="android:listViewStyle">@style/ListViewStyle</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">32dip</item>
-        <item name="list_item_divider">?android:attr/listDivider</item>
-        <item name="list_item_padding_top">0dip</item>
-        <item name="list_item_padding_right">0dip</item>
-        <item name="list_item_padding_bottom">0dip</item>
-        <item name="list_item_padding_left">0dip</item>
-        <item name="list_item_gap_between_image_and_text">8dip</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_header_text_indent">8dip</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">24dip</item>
-        <item name="list_item_header_underline_height">1dip</item>
-        <item name="list_item_header_underline_color">@color/people_app_theme_color</item>
-        <item name="list_item_data_width_weight">5</item>
-        <item name="list_item_label_width_weight">3</item>
-        <item name="contact_browser_list_padding_left">16dip</item>
-        <item name="contact_browser_list_padding_right">0dip</item>
-        <item name="contact_browser_background">@android:color/transparent</item>
-        <item name="list_item_text_indent">@dimen/contact_browser_list_item_text_indent</item>
-        <!-- CallLog -->
-        <item name="call_log_primary_text_color">#FFFFFF</item>
-        <item name="call_log_primary_background_color">#000000</item>
-        <item name="call_log_secondary_text_color">#888888</item>
-        <item name="call_log_secondary_background_color">#333333</item>
-        <item name="call_log_header_color">#33b5e5</item>
-        <!-- VoicemailStatus -->
-        <item name="call_log_voicemail_status_height">48dip</item>
-        <item name="call_log_voicemail_status_background_color">#262626</item>
-        <item name="call_log_voicemail_status_text_color">#888888</item>
-        <item name="call_log_voicemail_status_action_text_color">#33b5e5</item>
-            <!-- Favorites -->
-        <item name="favorites_padding_bottom">?android:attr/actionBarSize</item>
-    </style>
-
-    <style name="NewDialtactsTheme"
            parent="android:Theme.Holo.Light">
         <item name="android:textColorPrimary">@color/dialtacts_primary_text_color</item>
         <item name="android:textColorSecondary">@color/dialtacts_secondary_text_color</item>
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 726c176..8381c8d 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -71,9 +71,9 @@
 import com.android.dialer.dialpad.DialpadFragment;
 import com.android.dialer.dialpad.SmartDialNameMatcher;
 import com.android.dialer.interactions.PhoneNumberInteraction;
+import com.android.dialer.list.AllContactsActivity;
 import com.android.dialer.list.PhoneFavoriteFragment;
 import com.android.dialer.list.OnListFragmentScrolledListener;
-import com.android.dialer.list.ShowAllContactsFragment;
 import com.android.dialer.list.SmartDialSearchFragment;
 import com.android.internal.telephony.ITelephony;
 
@@ -81,15 +81,13 @@
 
 /**
  * The dialer tab's title is 'phone', a more common name (see strings.xml).
- *
- * TODO krelease: All classes currently prefixed with New will replace the original classes or
- * be renamed more appropriately before shipping.
  */
 public class DialtactsActivity extends TransactionSafeActivity implements View.OnClickListener,
         DialpadFragment.OnDialpadQueryChangedListener, PopupMenu.OnMenuItemClickListener,
         OnListFragmentScrolledListener,
         PhoneFavoriteFragment.OnPhoneFavoriteFragmentStartedListener,
-        DialpadFragment.OnDialpadFragmentStartedListener {
+        DialpadFragment.OnDialpadFragmentStartedListener,
+        PhoneFavoriteFragment.OnShowAllContactsListener {
     private static final String TAG = "DialtactsActivity";
 
     public static final boolean DEBUG = false;
@@ -141,8 +139,6 @@
      */
     private SmartDialSearchFragment mSmartDialSearchFragment;
 
-    private ShowAllContactsFragment mShowAllContactsFragment;
-
     private View mMenuButton;
     private View mCallHistoryButton;
     private View mDialpadButton;
@@ -257,16 +253,12 @@
             mRegularSearchFragment = new SearchFragment();
             mSmartDialSearchFragment = new SmartDialSearchFragment();
             mDialpadFragment = new DialpadFragment();
-            mShowAllContactsFragment = new ShowAllContactsFragment();
-            mShowAllContactsFragment.setOnPhoneNumberPickerActionListener(
-                    mPhoneNumberPickerActionListener);
 
             // TODO krelease: load fragments on demand instead of creating all of them at run time
             final FragmentTransaction ft = getFragmentManager().beginTransaction();
             ft.add(R.id.dialtacts_frame, mPhoneFavoriteFragment, TAG_FAVORITES_FRAGMENT);
             ft.add(R.id.dialtacts_frame, mRegularSearchFragment, TAG_REGULAR_SEARCH_FRAGMENT);
             ft.add(R.id.dialtacts_frame, mSmartDialSearchFragment, TAG_SMARTDIAL_SEARCH_FRAGMENT);
-            ft.add(R.id.dialtacts_frame, mShowAllContactsFragment, TAG_SHOW_ALL_CONTACTS_FRAGMENT);
             ft.add(R.id.dialtacts_container, mDialpadFragment, TAG_DIALPAD_FRAGMENT);
             ft.commit();
         }
@@ -298,11 +290,6 @@
         mSmartDialSearchFragment.setOnPhoneNumberPickerActionListener(
                 mPhoneNumberPickerActionListener);
 
-        mShowAllContactsFragment = (ShowAllContactsFragment) fm.findFragmentByTag(
-                TAG_SHOW_ALL_CONTACTS_FRAGMENT);
-        mShowAllContactsFragment.setOnPhoneNumberPickerActionListener(
-                mPhoneNumberPickerActionListener);
-
         if (mFirstLaunch) {
             displayFragment(getIntent());
         }
@@ -312,8 +299,7 @@
     @Override
     public void onAttachFragment(Fragment fragment) {
         if (fragment instanceof DialpadFragment || fragment instanceof SearchFragment
-                || fragment instanceof SmartDialSearchFragment
-                || fragment instanceof ShowAllContactsFragment) {
+                || fragment instanceof SmartDialSearchFragment) {
             final FragmentTransaction transaction = getFragmentManager().beginTransaction();
             transaction.hide(fragment);
             transaction.commit();
@@ -323,16 +309,6 @@
     }
 
     @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            // Respond to the action bar's Up/Home button
-            case android.R.id.home:
-                hideAllContactsFragment();
-        }
-        return super.onOptionsItemSelected(item);
-    }
-
-    @Override
     public boolean onMenuItemClick(MenuItem item) {
         switch (item.getItemId()) {
             case R.id.menu_import_export:
@@ -370,6 +346,8 @@
                 final PopupMenu popupMenu = new PopupMenu(DialtactsActivity.this, view);
                 final Menu menu = popupMenu.getMenu();
                 popupMenu.inflate(R.menu.dialtacts_options);
+                final MenuItem clearFrequents = menu.findItem(R.id.menu_clear_frequents);
+                clearFrequents.setVisible(mPhoneFavoriteFragment.hasFrequents());
                 popupMenu.setOnMenuItemClickListener(this);
                 popupMenu.show();
                 break;
@@ -379,9 +357,8 @@
                 break;
             case R.id.call_history_on_dialpad_button:
             case R.id.call_history_button:
-                // TODO krelease: This should start an intent with content type
-                // CallLog.Calls.CONTENT_TYPE, once the intent filters for the call log activity
-                // is enabled
+                // Use explicit CallLogActivity intent instead of ACTION_VIEW +
+                // CONTENT_TYPE, so that we always open our call log from our dialer
                 final Intent intent = new Intent(this, CallLogActivity.class);
                 startActivity(intent);
                 break;
@@ -422,15 +399,19 @@
     }
 
     private void showDialpadFragment(boolean animate) {
+        mDialpadFragment.setAdjustTranslationForAnimation(animate);
         final FragmentTransaction ft = getFragmentManager().beginTransaction();
         if (animate) {
             ft.setCustomAnimations(R.anim.slide_in, 0);
+        } else {
+            mDialpadFragment.setYFraction(0);
         }
         ft.show(mDialpadFragment);
         ft.commit();
     }
 
     private void hideDialpadFragment(boolean animate) {
+        mDialpadFragment.setAdjustTranslationForAnimation(animate);
         final FragmentTransaction ft = getFragmentManager().beginTransaction();
         if (animate) {
             ft.setCustomAnimations(0, R.anim.slide_out);
@@ -439,23 +420,6 @@
         ft.commit();
     }
 
-    public void showAllContactsFragment() {
-        final FragmentTransaction ft = getFragmentManager().beginTransaction();
-        ft.hide(mPhoneFavoriteFragment);
-        ft.show(mShowAllContactsFragment);
-        // TODO{klp} Add animation
-        ft.commit();
-        hideSearchBar(false);
-    }
-
-    private void hideAllContactsFragment() {
-        final FragmentTransaction ft = getFragmentManager().beginTransaction();
-        ft.hide(mShowAllContactsFragment);
-        ft.show(mPhoneFavoriteFragment);
-        ft.commit();
-        showSearchBar();
-    }
-
     private void prepareSearchView() {
         mSearchViewContainer = findViewById(R.id.search_view_container);
         mSearchViewCloseButton = findViewById(R.id.search_close_button);
@@ -606,9 +570,6 @@
      * @param intent Intent that contains information about which tab should be selected
      */
     private void displayFragment(Intent intent) {
-        // TODO krelease: Make navigation via intent work by displaying the correct fragment
-        // as appropriate.
-
         // If we got here by hitting send and we're in call forward along to the in-call activity
         boolean recentCallsRequest = Calls.CONTENT_TYPE.equals(intent.resolveType(
             getContentResolver()));
@@ -619,9 +580,7 @@
 
         if (mDialpadFragment != null && (phoneIsInUse() || isDialIntent(intent))) {
             mDialpadFragment.setStartedFromNewIntent(true);
-            // TODO krelease: This should use showDialpadFragment(false) to avoid animating
-            // the dialpad in. Need to fix the onPreDrawListener in NewDialpadFragment first.
-            showDialpadFragment(true);
+            showDialpadFragment(false);
         }
     }
 
@@ -801,8 +760,6 @@
             hideDialpadFragment(true);
         } else if (mInSearchUi) {
             mSearchView.setText(null);
-        } else if (mShowAllContactsFragment.isVisible()) {
-            hideAllContactsFragment();
         } else if (isTaskRoot()) {
             // Instead of stopping, simply push this to the back of the stack.
             // This is only done when running at the top of the stack;
@@ -846,4 +803,10 @@
                 Context.TELEPHONY_SERVICE);
         return tm.getCallState() != TelephonyManager.CALL_STATE_IDLE;
     }
+
+    @Override
+    public void onShowAllContacts() {
+        final Intent intent = new Intent(this, AllContactsActivity.class);
+        startActivity(intent);
+    }
 }
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index 5d75004..a76d0c1 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -90,7 +90,6 @@
     private final Handler mHandler = new Handler();
 
     private TelephonyManager mTelephonyManager;
-    private PhoneStateListener mPhoneStateListener;
 
     private class CustomContentObserver extends ContentObserver {
         public CustomContentObserver() {
@@ -322,7 +321,6 @@
         mAdapter.changeCursor(null);
         getActivity().getContentResolver().unregisterContentObserver(mCallLogObserver);
         getActivity().getContentResolver().unregisterContentObserver(mContactsObserver);
-        unregisterPhoneCallReceiver();
     }
 
     @Override
@@ -340,12 +338,6 @@
     }
 
     private void updateCallList(int filterType) {
-        if (filterType == CallLogQueryHandler.CALL_TYPE_ALL) {
-            unregisterPhoneCallReceiver();
-        } else {
-            // TODO krelease: Make this work
-            //registerPhoneCallReceiver();
-        }
         mCallLogQueryHandler.fetchCalls(filterType);
     }
 
@@ -487,48 +479,4 @@
         serviceIntent.setAction(CallLogNotificationsService.ACTION_UPDATE_NOTIFICATIONS);
         getActivity().startService(serviceIntent);
     }
-
-    // TODO krelease: Make the ViewPager switch to the correct tab (All) when a phone call is
-    // placed.
-    // This should probably be moved to the call log activity.
-    /**
-     * Register a phone call filter to reset the call type when a phone call is place.
-     */
-    /*
-    private void registerPhoneCallReceiver() {
-        if (mPhoneStateListener != null) {
-            return; // Already registered.
-        }
-        mTelephonyManager = (TelephonyManager) getActivity().getSystemService(
-                Context.TELEPHONY_SERVICE);
-        mPhoneStateListener = new PhoneStateListener() {
-            @Override
-            public void onCallStateChanged(int state, String incomingNumber) {
-                if (state != TelephonyManager.CALL_STATE_OFFHOOK &&
-                        state != TelephonyManager.CALL_STATE_RINGING) {
-                    return;
-                }
-                mHandler.post(new Runnable() {
-                    @Override
-                    public void run() {
-                        if (getActivity() == null || getActivity().isFinishing()) {
-                            return;
-                        }
-                    }
-                 });
-            }
-        };
-        mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
-    }
-    */
-
-    /**
-     * Un-registers the phone call receiver.
-     */
-    private void unregisterPhoneCallReceiver() {
-        if (mPhoneStateListener != null) {
-            mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
-            mPhoneStateListener = null;
-        }
-    }
 }
diff --git a/src/com/android/dialer/calllog/CallLogListItemHelper.java b/src/com/android/dialer/calllog/CallLogListItemHelper.java
index fdebeb1..23366e4 100644
--- a/src/com/android/dialer/calllog/CallLogListItemHelper.java
+++ b/src/com/android/dialer/calllog/CallLogListItemHelper.java
@@ -27,10 +27,6 @@
 
 /**
  * Helper class to fill in the views of a call log entry.
- * TODO krelease: The only difference between this and the original is that we don't touch
- * divider views, which are not present in the new dialer. Once the new dialer replaces
- * the old one, we can replace it entirely. Otherwise we would have redundant divider=null
- * checks all over the place.
  */
 /* package */class CallLogListItemHelper {
     /** Helper for populating the details of a phone call. */
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index 12b6183..fefbcc4 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -262,6 +262,7 @@
 
     private boolean mStartedFromNewIntent = false;
     private boolean mFirstLaunch = false;
+    private boolean mAdjustTranslationForAnimation = false;
 
     private static final String PREF_DIGITS_FILLED_BY_INTENT = "pref_digits_filled_by_intent";
 
@@ -350,15 +351,17 @@
                 false);
         fragmentView.buildLayer();
 
-        // TODO krelease: Get rid of this ugly hack which is to prevent the first frame of the
-        // animation from drawing the fragment at translationY = 0
         final ViewTreeObserver vto = fragmentView.getViewTreeObserver();
+        // Adjust the translation of the DialpadFragment in a preDrawListener instead of in
+        // DialtactsActivity, because at the point in time when the DialpadFragment is added,
+        // its views have not been laid out yet.
         final OnPreDrawListener preDrawListener = new OnPreDrawListener() {
 
             @Override
             public boolean onPreDraw() {
+
                 if (isHidden()) return true;
-                if (fragmentView.getTranslationY() == 0) {
+                if (mAdjustTranslationForAnimation && fragmentView.getTranslationY() == 0) {
                     ((DialpadSlidingLinearLayout) fragmentView).setYFraction(
                             DIALPAD_SLIDE_FRACTION);
                 }
@@ -1661,6 +1664,10 @@
                             // TODO: Filter out emergency numbers if
                             // the carrier does not want redial for
                             // these.
+                            // If the fragment has already been detached since the last time
+                            // we called queryLastOutgoingCall in onResume there is no point
+                            // doing anything here.
+                            if (getActivity() == null) return;
                             mLastNumberDialed = number;
                             updateDialAndDeleteButtonEnabledState();
                         }
@@ -1692,4 +1699,12 @@
             activity.hideSearchBar();
         }
     }
+
+    public void setAdjustTranslationForAnimation(boolean value) {
+        mAdjustTranslationForAnimation = value;
+    }
+
+    public void setYFraction(float yFraction) {
+        ((DialpadSlidingLinearLayout) getView()).setYFraction(yFraction);
+    }
 }
diff --git a/src/com/android/dialer/list/AllContactsActivity.java b/src/com/android/dialer/list/AllContactsActivity.java
new file mode 100644
index 0000000..c46702f
--- /dev/null
+++ b/src/com/android/dialer/list/AllContactsActivity.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2013 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.dialer.list;
+
+import android.app.ActionBar;
+import android.app.Fragment;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.style.TypefaceSpan;
+import android.util.Log;
+
+import com.android.contacts.common.CallUtil;
+import com.android.contacts.common.activity.TransactionSafeActivity;
+import com.android.contacts.common.list.OnPhoneNumberPickerActionListener;
+import com.android.dialer.DialtactsActivity;
+import com.android.dialer.R;
+import com.android.dialer.interactions.PhoneNumberInteraction;
+
+public class AllContactsActivity extends TransactionSafeActivity {
+    private static final String TAG = AllContactsActivity.class.getSimpleName();
+
+    private AllContactsFragment mAllContactsFragment;
+
+    // Same behavior as {@link DialtactsActivity}
+    private final OnPhoneNumberPickerActionListener mPhoneNumberPickerActionListener =
+            new OnPhoneNumberPickerActionListener() {
+                @Override
+                public void onPickPhoneNumberAction(Uri dataUri) {
+                    // Specify call-origin so that users will see the previous tab instead of
+                    // CallLog screen (search UI will be automatically exited).
+                    PhoneNumberInteraction.startInteractionForPhoneCall(
+                        AllContactsActivity.this, dataUri, null);
+                }
+
+                @Override
+                public void onCallNumberDirectly(String phoneNumber) {
+                final Intent intent = CallUtil.getCallIntent(phoneNumber, null);
+                    startActivity(intent);
+                }
+
+                @Override
+                public void onShortcutIntentCreated(Intent intent) {
+                    Log.w(TAG, "Unsupported intent has come (" + intent + "). Ignoring.");
+                }
+
+                @Override
+                public void onHomeInActionBarSelected() {
+                    // {@link PhoneNumberPickerFragment handles onClick on the home button
+                    // and performs the callback here. This means we don't have to handle it
+                    // ourself in the activity.
+                    final Intent intent = new Intent(AllContactsActivity.this,
+                            DialtactsActivity.class);
+                    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+                    startActivity(intent);
+                }
+    };
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        final ActionBar actionBar = getActionBar();
+        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
+        actionBar.setDisplayShowHomeEnabled(true);
+        actionBar.setDisplayHomeAsUpEnabled(true);
+        actionBar.setDisplayShowTitleEnabled(true);
+
+        final SpannableString s = new SpannableString(getString(R.string.show_all_contacts_title));
+        s.setSpan(new TypefaceSpan(getString(R.string.show_all_contacts_title_font_family)), 0,
+                s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+        actionBar.setTitle(s);
+
+        setContentView(R.layout.all_contacts_activity);
+    }
+
+    @Override
+    public void onAttachFragment(Fragment fragment) {
+        if (fragment instanceof AllContactsFragment) {
+            mAllContactsFragment = (AllContactsFragment) fragment;
+            mAllContactsFragment.setOnPhoneNumberPickerActionListener(
+                    mPhoneNumberPickerActionListener);
+        }
+    }
+}
diff --git a/src/com/android/dialer/list/AllContactsFragment.java b/src/com/android/dialer/list/AllContactsFragment.java
new file mode 100644
index 0000000..40d5c14
--- /dev/null
+++ b/src/com/android/dialer/list/AllContactsFragment.java
@@ -0,0 +1,55 @@
+/*
+
+ * Copyright (C) 2013 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.dialer.list;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.android.contacts.common.list.ContactListItemView;
+import com.android.contacts.common.list.PhoneNumberPickerFragment;
+import com.android.dialer.R;
+
+/**
+ * Fragments to show all contacts with phone numbers.
+ */
+public class AllContactsFragment extends PhoneNumberPickerFragment{
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+    }
+
+    @Override
+    public void onAttach(Activity activity) {
+        super.onAttach(activity);
+
+        // Customizes the listview according to the dialer specifics.
+        setQuickContactEnabled(true);
+        setDarkTheme(false);
+        setPhotoPosition(ContactListItemView.getDefaultPhotoPosition(true /* opposite */));
+        setUseCallableUri(true);
+    }
+
+    @Override
+    protected View inflateView(LayoutInflater inflater, ViewGroup container) {
+        return inflater.inflate(R.layout.show_all_contacts_fragment, null);
+    }
+}
diff --git a/src/com/android/dialer/list/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java
index 64a9b84..b6a5fb4 100644
--- a/src/com/android/dialer/list/PhoneFavoriteFragment.java
+++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java
@@ -19,6 +19,7 @@
 import android.app.Fragment;
 import android.app.LoaderManager;
 import android.content.CursorLoader;
+import android.content.Intent;
 import android.content.Loader;
 import android.database.Cursor;
 import android.graphics.Rect;
@@ -70,6 +71,10 @@
         public void onPhoneFavoriteFragmentStarted();
     }
 
+    public interface OnShowAllContactsListener {
+        public void onShowAllContacts();
+    }
+
     public interface Listener {
         public void onContactSelected(Uri contactUri);
         public void onCallNumberDirectly(String phoneNumber);
@@ -133,9 +138,9 @@
     private Listener mListener;
 
     private OnListFragmentScrolledListener mActivityScrollListener;
+    private OnShowAllContactsListener mShowAllContactsListener;
     private PhoneFavoriteMergedAdapter mAdapter;
     private PhoneFavoritesTileAdapter mContactTileAdapter;
-    private PhoneNumberListAdapter mAllContactsAdapter;
 
     private CallLogAdapter mCallLogAdapter;
     private CallLogQueryHandler mCallLogQueryHandler;
@@ -161,8 +166,6 @@
             new ContactTileLoaderListener();
     private final ScrollListener mScrollListener = new ScrollListener();
 
-    private boolean mOptionsMenuHasFrequents;
-
     @Override
     public void onAttach(Activity activity) {
         if (DEBUG) Log.d(TAG, "onAttach()");
@@ -245,24 +248,8 @@
         return listLayout;
     }
 
-
-    // TODO krelease: update the options menu when displaying the popup menu instead. We could
-    // possibly get rid of this method entirely.
-    private boolean isOptionsMenuChanged() {
-        return mOptionsMenuHasFrequents != hasFrequents();
-    }
-
-    // TODO krelease: Configure the menu items properly. Since the menu items show up as a PopupMenu
-    // rather than a normal actionbar menu, the initialization should be done there.
-    /*
-    @Override
-    public void onPrepareOptionsMenu(Menu menu) {
-        final MenuItem clearFrequents = menu.findItem(R.id.menu_clear_frequents);
-        mOptionsMenuHasFrequents = hasFrequents();
-        clearFrequents.setVisible(mOptionsMenuHasFrequents);
-    }*/
-
-    private boolean hasFrequents() {
+    public boolean hasFrequents() {
+        if (mContactTileAdapter == null) return false;
         return mContactTileAdapter.getNumFrequents() > 0;
     }
 
@@ -286,6 +273,13 @@
                     + " must implement OnListFragmentScrolledListener");
         }
 
+        try {
+            mShowAllContactsListener = (OnShowAllContactsListener) activity;
+        } catch (ClassCastException e) {
+            throw new ClassCastException(activity.toString()
+                    + " must implement OnShowAllContactsListener");
+        }
+
         // Use initLoader() instead of restartLoader() to refraining unnecessary reload.
         // This method call implicitly assures ContactTileLoaderListener's onLoadFinished() will
         // be called, on which we'll check if "all" contacts should be reloaded again or not.
@@ -311,10 +305,7 @@
      * Gets called when user click on the show all contacts button.
      */
     private void showAllContacts() {
-        // TODO {klp} Use interface for the fragment to communicate with the activity
-        if (getActivity() instanceof  DialtactsActivity) {
-            ((DialtactsActivity) getActivity()).showAllContactsFragment();
-        }
+        mShowAllContactsListener.onShowAllContacts();
     }
 
     public void setListener(Listener listener) {
diff --git a/src/com/android/dialer/list/ShowAllContactsFragment.java b/src/com/android/dialer/list/ShowAllContactsFragment.java
deleted file mode 100644
index 85806b6..0000000
--- a/src/com/android/dialer/list/ShowAllContactsFragment.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-
- * Copyright (C) 2013 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.dialer.list;
-
-import android.app.ActionBar;
-import android.app.Activity;
-import android.os.Bundle;
-import android.text.Spannable;
-import android.text.SpannableString;
-import android.text.style.TypefaceSpan;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import com.android.contacts.common.list.ContactListItemView;
-import com.android.contacts.common.list.PhoneNumberPickerFragment;
-import com.android.dialer.R;
-
-// TODO{klp}: Wrap this fragment with an activity.
-/**
- * Fragments to show all contacts with phone numbers.
- */
-public class ShowAllContactsFragment extends PhoneNumberPickerFragment{
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-    }
-
-    @Override
-    public void onAttach(Activity activity) {
-        super.onAttach(activity);
-
-        // Customizes the listview according to the dialer specifics.
-        setQuickContactEnabled(true);
-        setDarkTheme(false);
-        setPhotoPosition(ContactListItemView.getDefaultPhotoPosition(true /* opposite */));
-        setUseCallableUri(true);
-    }
-
-    @Override
-    public void onStart() {
-        // Displays action bar for quick navigation.
-        final ActionBar actionBar = getActivity().getActionBar();
-        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
-        actionBar.setDisplayShowHomeEnabled(true);
-        actionBar.setDisplayHomeAsUpEnabled(true);
-        actionBar.setDisplayShowTitleEnabled(true);
-
-        final SpannableString s = new SpannableString(getString(R.string.show_all_contacts_title));
-        s.setSpan(new TypefaceSpan(getString(R.string.show_all_contacts_title)), 0,
-                s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
-        actionBar.setTitle(s);
-
-        super.onStart();
-    }
-
-    @Override
-    public void onHiddenChanged(boolean hidden) {
-        // Hides the action bar as it is hidden in the main activity
-        if (getActivity() != null) {
-            if (hidden) {
-                getActivity().getActionBar().hide();
-            } else {
-                getActivity().getActionBar().show();
-            }
-        }
-    }
-
-    @Override
-    protected View inflateView(LayoutInflater inflater, ViewGroup container) {
-        return inflater.inflate(R.layout.show_all_contacts_fragment, null);
-    }
-}