Fix fragment position in dialpad fade-out.

Before, there's a noticeable gap in the bottom where the search
fragment is not fading in; it's fully transparent because the
position of the fragment was formerly updated too late. This
change updates the position earlier and tweaks the logic slightly.

Change-Id: I748c5cd9e9161007eccedb8f86d30011f2a30150
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index d888de6..ef1db39 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -587,6 +587,7 @@
         mIsDialpadShown = false;
         mDialpadFragment.setAnimate(animate);
 
+        updateSearchFragmentPosition();
         updateFloatingActionButton();
         if (animate) {
             Animation slideOut = AnimationUtils.loadAnimation(this, R.anim.slide_out);
@@ -601,7 +602,6 @@
             commitDialpadFragmentHide();
         }
 
-        updateSearchFragmentPosition();
         mListsFragment.maybeShowActionBar();
     }
 
@@ -617,9 +617,9 @@
     private void updateSearchFragmentPosition() {
         int translationValue = mIsDialpadShown ?  -mActionBarHeight : 0;
         SearchFragment fragment = null;
-        if (mInDialpadSearch) {
+        if (mSmartDialSearchFragment != null && mSmartDialSearchFragment.isVisible()) {
             fragment = mSmartDialSearchFragment;
-        } else if (mInRegularSearch) {
+        } else if (mRegularSearchFragment != null && mRegularSearchFragment.isVisible()) {
             fragment = mRegularSearchFragment;
         }
         if (fragment != null && fragment.isVisible()) {