Merge "Fix some action bar logic" into lmp-dev
diff --git a/res/layout/call_detail.xml b/res/layout/call_detail.xml
index 2e38e2d..35c41c0 100644
--- a/res/layout/call_detail.xml
+++ b/res/layout/call_detail.xml
@@ -87,35 +87,6 @@
             </LinearLayout>
         </LinearLayout>
 
-        <FrameLayout
-            android:id="@+id/voicemail_status"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_alignParentStart="true"
-            android:layout_alignParentTop="true"
-            android:visibility="gone"
-            >
-            <include layout="@layout/call_log_voicemail_status"/>
-        </FrameLayout>
-        <TextView
-            android:id="@+id/voicemail_transcription"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:paddingStart="@dimen/call_detail_horizontal_margin"
-            android:paddingEnd="@dimen/call_detail_horizontal_margin"
-            android:paddingTop="@dimen/transcription_top_margin"
-            android:paddingBottom="@dimen/transcription_bottom_margin" />
-        <LinearLayout
-            android:id="@+id/voicemail_container"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="vertical"
-            android:paddingBottom="@dimen/call_detail_button_spacing"
-            android:visibility="gone"
-            >
-            <!-- The voicemail fragment will be put here. -->
-        </LinearLayout>
-
         <!--
           The list view is under everything.
           It contains a first header element which is hidden under the controls UI.
diff --git a/res/layout/call_details_voicemail_header.xml b/res/layout/call_details_voicemail_header.xml
new file mode 100644
index 0000000..f2a016b
--- /dev/null
+++ b/res/layout/call_details_voicemail_header.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical" >
+
+        <FrameLayout
+            android:id="@+id/voicemail_status"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:visibility="gone"
+            >
+            <include layout="@layout/call_log_voicemail_status"/>
+        </FrameLayout>
+        <TextView
+            android:id="@+id/voicemail_transcription"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:paddingStart="@dimen/call_detail_horizontal_margin"
+            android:paddingEnd="@dimen/call_detail_horizontal_margin"
+            android:paddingTop="@dimen/transcription_top_margin"
+            android:paddingBottom="@dimen/transcription_bottom_margin" />
+        <LinearLayout
+            android:id="@+id/voicemail_container"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical"
+            android:paddingBottom="@dimen/call_detail_button_spacing"
+            android:visibility="gone"
+            >
+            <!-- The voicemail fragment will be put here. -->
+        </LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/res/values-kn-rIN/strings.xml b/res/values-kn-rIN/strings.xml
index 1612325..5c6b314 100644
--- a/res/values-kn-rIN/strings.xml
+++ b/res/values-kn-rIN/strings.xml
@@ -130,7 +130,9 @@
     <string name="dialerKeyboardHintText" msgid="5401660096579787344">"ಡಯಲ್‌ ಮಾಡಲು ಕೀಬೋರ್ಡ್‌ ಬಳಸಿ"</string>
     <string name="dialerDialpadHintText" msgid="5824490365898349041">"ಕರೆಯನ್ನು ಸೇರಿಸಲು ಡಯಲ್‌ ಮಾಡಿ"</string>
     <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> ನಿಮಿಷಗಳು <xliff:g id="SECONDS">%s</xliff:g> ಸೆಕೆಂಡುಗಳು"</string>
-    <string name="dialog_phone_call_prohibited_message" msgid="6554711866586660441">"ಕರೆ ಮಾಡಲಾಗಲಿಲ್ಲ."</string>
+    <!-- no translation found for dialog_phone_call_prohibited_message (6554711866586660441) -->
+    <!-- no translation found for dialog_phone_call_prohibited_message (4313552620858880999) -->
+    <skip />
     <string name="dialog_voicemail_not_ready_message" msgid="4384716252789515378">"ಧ್ವನಿಮೇಲ್‌ ಹೊಂದಿಸಲು, ಮೆನು &gt; ಸೆಟ್ಟಿಂಗ್‌ಗಳುಗೆ ಹೋಗಿ."</string>
     <!-- no translation found for dialog_voicemail_airplane_mode_message (530922773669546093) -->
     <skip />
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 4884bd2..cba04bd 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -65,7 +65,7 @@
     <dimen name="favorites_row_undo_text_side_padding">32dp</dimen>
 
     <!-- Dimensions for most recent call shortcut cards -->
-    <dimen name="recent_call_log_item_translation_z">1dp</dimen>
+    <dimen name="recent_call_log_item_translation_z">3dp</dimen>
     <dimen name="recent_call_log_item_margin_horizontal">8dp</dimen>
     <dimen name="recent_call_log_item_margin_top">4dp</dimen>
     <dimen name="recent_call_log_item_margin_bottom">6dp</dimen>
@@ -87,6 +87,7 @@
     room to the search box-->
     <dimen name="action_bar_height">56dp</dimen>
     <dimen name="action_bar_height_large">64dp</dimen>
+    <dimen name="action_bar_elevation">2dp</dimen>
     <dimen name="tab_height">43dp</dimen>
     <!-- actionbar height + tab height -->
     <dimen name="actionbar_and_tab_height">107dp</dimen>
@@ -111,7 +112,7 @@
     <!-- Size of the icon (voice search, close search) in the search box. -->
     <dimen name="search_box_icon_size">28dp</dimen>
     <dimen name="search_list_padding_top">16dp</dimen>
-    <dimen name="search_box_elevation">2dp</dimen>
+    <dimen name="search_box_elevation">3dp</dimen>
 
     <!-- Padding to the left and right of call log action buttons. -->
     <dimen name="call_log_action_horizontal_padding">8dp</dimen>
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java
index e716719..5ef75db 100644
--- a/src/com/android/dialer/CallDetailActivity.java
+++ b/src/com/android/dialer/CallDetailActivity.java
@@ -43,6 +43,7 @@
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
+import android.widget.LinearLayout;
 import android.widget.ListView;
 import android.widget.QuickContactBadge;
 import android.widget.TextView;
@@ -135,6 +136,9 @@
     private TextView mStatusMessageText;
     private TextView mStatusMessageAction;
     private TextView mVoicemailTranscription;
+    private LinearLayout mVoicemailHeader;
+
+    private Uri mVoicemailUri;
 
     /** Whether we should show "edit number before call" in the options menu. */
     private boolean mHasEditNumberBeforeCallOption;
@@ -239,10 +243,9 @@
         mPhoneNumberHelper = new PhoneNumberDisplayHelper(mResources);
         mVoicemailStatusHelper = new VoicemailStatusHelperImpl();
         mAsyncQueryHandler = new CallDetailActivityQueryHandler(this);
-        mStatusMessageView = findViewById(R.id.voicemail_status);
-        mStatusMessageText = (TextView) findViewById(R.id.voicemail_status_message);
-        mStatusMessageAction = (TextView) findViewById(R.id.voicemail_status_action);
-        mVoicemailTranscription = (TextView) findViewById(R.id.voicemail_transcription);
+
+        mVoicemailUri = getIntent().getParcelableExtra(EXTRA_VOICEMAIL_URI);
+
         mQuickContactBadge = (QuickContactBadge) findViewById(R.id.quick_contact_photo);
         mQuickContactBadge.setOverlay(null);
         mCallerName = (TextView) findViewById(R.id.caller_name);
@@ -253,6 +256,7 @@
         mProximitySensorManager = new ProximitySensorManager(this, mProximitySensorListener);
         mContactInfoHelper = new ContactInfoHelper(this, GeoUtil.getCurrentCountryIso(this));
         getActionBar().setDisplayHomeAsUpEnabled(true);
+
         optionallyHandleVoicemail();
         if (getIntent().getBooleanExtra(EXTRA_FROM_NOTIFICATION, false)) {
             closeSystemDialogs();
@@ -269,11 +273,25 @@
      * Handle voicemail playback or hide voicemail ui.
      * <p>
      * If the Intent used to start this Activity contains the suitable extras, then start voicemail
-     * playback.  If it doesn't, then hide the voicemail ui.
+     * playback.  If it doesn't, then don't inflate the voicemail ui.
      */
     private void optionallyHandleVoicemail() {
-        View voicemailContainer = findViewById(R.id.voicemail_container);
+
         if (hasVoicemail()) {
+            LayoutInflater inflater =
+                    (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+            mVoicemailHeader =
+                    (LinearLayout) inflater.inflate(R.layout.call_details_voicemail_header, null);
+            View voicemailContainer = mVoicemailHeader.findViewById(R.id.voicemail_container);
+            mStatusMessageView = mVoicemailHeader.findViewById(R.id.voicemail_status);
+            mStatusMessageText =
+                    (TextView) mVoicemailHeader.findViewById(R.id.voicemail_status_message);
+            mStatusMessageAction =
+                    (TextView) mVoicemailHeader.findViewById(R.id.voicemail_status_action);
+            mVoicemailTranscription = (
+                    TextView) mVoicemailHeader.findViewById(R.id.voicemail_transcription);
+            ListView historyList = (ListView) findViewById(R.id.history);
+            historyList.addHeaderView(mVoicemailHeader);
             // Has voicemail: add the voicemail fragment.  Add suitable arguments to set the uri
             // to play and optionally start the playback.
             // Do a query to fetch the voicemail status messages.
@@ -285,7 +303,7 @@
             if (playbackFragment == null) {
                 playbackFragment = new VoicemailPlaybackFragment();
                 Bundle fragmentArguments = new Bundle();
-                fragmentArguments.putParcelable(EXTRA_VOICEMAIL_URI, getVoicemailUri());
+                fragmentArguments.putParcelable(EXTRA_VOICEMAIL_URI, mVoicemailUri);
                 if (getIntent().getBooleanExtra(EXTRA_VOICEMAIL_START_PLAYBACK, false)) {
                     fragmentArguments.putBoolean(EXTRA_VOICEMAIL_START_PLAYBACK, true);
                 }
@@ -296,21 +314,13 @@
             }
 
             voicemailContainer.setVisibility(View.VISIBLE);
-            mAsyncQueryHandler.startVoicemailStatusQuery(getVoicemailUri());
-            markVoicemailAsRead(getVoicemailUri());
-        } else {
-            // No voicemail uri: hide the status view.
-            mStatusMessageView.setVisibility(View.GONE);
-            voicemailContainer.setVisibility(View.GONE);
+            mAsyncQueryHandler.startVoicemailStatusQuery(mVoicemailUri);
+            markVoicemailAsRead(mVoicemailUri);
         }
     }
 
     private boolean hasVoicemail() {
-        return getVoicemailUri() != null;
-    }
-
-    private Uri getVoicemailUri() {
-        return getIntent().getParcelableExtra(EXTRA_VOICEMAIL_URI);
+        return mVoicemailUri != null;
     }
 
     private void markVoicemailAsRead(final Uri voicemailUri) {
@@ -480,9 +490,6 @@
                 if (hasVoicemail() && !TextUtils.isEmpty(firstDetails.transcription)) {
                     mVoicemailTranscription.setText(firstDetails.transcription);
                     mVoicemailTranscription.setVisibility(View.VISIBLE);
-                } else {
-                    mVoicemailTranscription.setText(null);
-                    mVoicemailTranscription.setVisibility(View.GONE);
                 }
 
                 loadContactPhotos(
@@ -720,12 +727,11 @@
     }
 
     public void onMenuTrashVoicemail(MenuItem menuItem) {
-        final Uri voicemailUri = getVoicemailUri();
         mAsyncTaskExecutor.submit(Tasks.DELETE_VOICEMAIL_AND_FINISH,
                 new AsyncTask<Void, Void, Void>() {
                     @Override
                     public Void doInBackground(Void... params) {
-                        getContentResolver().delete(voicemailUri, null, null);
+                        getContentResolver().delete(mVoicemailUri, null, null);
                         return null;
                     }
 
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 8033909..cb01e8e 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -89,6 +89,7 @@
 import com.android.dialer.widget.SearchEditTextLayout;
 import com.android.dialer.widget.SearchEditTextLayout.OnBackButtonClickedListener;
 import com.android.dialerbind.DatabaseHelperManager;
+import com.android.phone.common.animation.AnimUtils;
 import com.android.phone.common.animation.AnimationListenerAdapter;
 
 import java.util.ArrayList;
@@ -354,6 +355,7 @@
         actionBar.setCustomView(R.layout.search_edittext);
         actionBar.setDisplayShowCustomEnabled(true);
         actionBar.setBackgroundDrawable(null);
+        actionBar.setElevation(resources.getDimensionPixelSize(R.dimen.action_bar_elevation));
 
         mActionBarController = new ActionBarController(this,
                 (SearchEditTextLayout) actionBar.getCustomView());
@@ -417,6 +419,9 @@
         mSlideOut = AnimationUtils.loadAnimation(this,
                 mIsLandscape ? R.anim.dialpad_slide_out_right : R.anim.dialpad_slide_out_bottom);
 
+        mSlideIn.setInterpolator(AnimUtils.EASE_IN);
+        mSlideOut.setInterpolator(AnimUtils.EASE_OUT);
+
         mSlideOut.setAnimationListener(mSlideOutListener);
 
         parentLayout = (FrameLayout) findViewById(R.id.dialtacts_mainlayout);
@@ -616,6 +621,7 @@
         }
         mIsDialpadShown = true;
         mDialpadFragment.setAnimate(animate);
+        mDialpadFragment.sendScreenView();
 
         final FragmentTransaction ft = getFragmentManager().beginTransaction();
         ft.show(mDialpadFragment);
@@ -879,7 +885,6 @@
         } else {
             transaction.show(fragment);
         }
-
         // DialtactsActivity will provide the options menu
         fragment.setHasOptionsMenu(false);
         fragment.setShowEmptyListForNullQuery(true);
diff --git a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
index fedd012..477aa86 100644
--- a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
+++ b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
@@ -181,6 +181,7 @@
         } else {
             // Open the call log.
             contentIntent = new Intent(Intent.ACTION_VIEW, Calls.CONTENT_URI);
+            contentIntent.putExtra(Calls.EXTRA_CALL_TYPE_FILTER, Calls.VOICEMAIL_TYPE);
         }
         notificationBuilder.setContentIntent(
                 PendingIntent.getActivity(mContext, 0, contentIntent, 0));
diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java
index b214836..966d265 100644
--- a/src/com/android/dialer/list/ListsFragment.java
+++ b/src/com/android/dialer/list/ListsFragment.java
@@ -331,6 +331,13 @@
 
     @Override
     public void onPageSelected(int position) {
+        if (position == TAB_INDEX_SPEED_DIAL) {
+            mSpeedDialFragment.sendScreenView();
+        } else if (position == TAB_INDEX_RECENTS) {
+            mRecentsFragment.sendScreenView();
+        } else if (position == TAB_INDEX_ALL_CONTACTS) {
+            mAllContactsFragment.sendScreenView();
+        }
         final int count = mOnPageChangeListeners.size();
         for (int i = 0; i < count; i++) {
             mOnPageChangeListeners.get(i).onPageSelected(position);
diff --git a/src/com/android/dialer/list/SearchFragment.java b/src/com/android/dialer/list/SearchFragment.java
index 027db88..d993b23 100644
--- a/src/com/android/dialer/list/SearchFragment.java
+++ b/src/com/android/dialer/list/SearchFragment.java
@@ -69,6 +69,7 @@
         setDarkTheme(false);
         setPhotoPosition(ContactListItemView.getDefaultPhotoPosition(false /* opposite */));
         setUseCallableUri(true);
+        sendScreenView();
 
         try {
             mActivityScrollListener = (OnListFragmentScrolledListener) activity;