Fix Dial intent interactions

Correctly apply actionbar height by retrieving it from
attribute in DialtactsActivity, instead of getActionBar.getHeight(),
which returns 0 if the actionbar hasn't been previously shown

Bug: 14111329

Change-Id: Ic940e3489317706b24b63afbf45fd37925f11c4b
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 54041b0..9890b4a 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -29,6 +29,7 @@
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
+import android.content.res.TypedArray;
 import android.graphics.Outline;
 import android.net.Uri;
 import android.os.Bundle;
@@ -159,6 +160,7 @@
 
     private View mFragmentsFrame;
 
+    private int mActionBarHeight;
     private boolean mInDialpadSearch;
     private boolean mInRegularSearch;
     private boolean mClearSearchOnPause;
@@ -306,6 +308,11 @@
         getActionBar().setDisplayShowHomeEnabled(false);
         getActionBar().setDisplayShowTitleEnabled(false);
 
+        final TypedArray styledAttributes = getTheme().obtainStyledAttributes(
+                new int[] { android.R.attr.actionBarSize });
+        mActionBarHeight = (int) styledAttributes.getDimension(0, 0);
+        styledAttributes.recycle();
+
         // Add the favorites fragment, and the dialpad fragment, but only if savedInstanceState
         // is null. Otherwise the fragment manager takes care of recreating these fragments.
         if (savedInstanceState == null) {
@@ -597,11 +604,11 @@
             fragment = mRegularSearchFragment;
         }
         if (fragment != null && fragment.isVisible()) {
-            fragment.getListView().animate().translationY(-getActionBar().getHeight())
+            fragment.getListView().animate().translationY(-mActionBarHeight)
                     .setInterpolator(hideActionBarInterpolator).setDuration(ANIMATION_DURATION);
         }
 
-        if (mListsFragment != null && mListsFragment.isVisible()) {
+        if (mListsFragment != null && mListsFragment.isResumed() && mListsFragment.isVisible()) {
             // If the favorites fragment is showing, fade to blank.
             mFragmentsFrame.animate().alpha(0.0f);
         }
@@ -967,4 +974,8 @@
     public void onHomeInActionBarSelected() {
         mPhoneNumberPickerActionListener.onHomeInActionBarSelected();
     }
+
+    public int getActionBarHeight() {
+        return mActionBarHeight;
+    }
 }