Merge "Remove duplicate style" into klp-dev
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml
index 6f5ca67..46e503c 100644
--- a/res/layout/call_log_list_item.xml
+++ b/res/layout/call_log_list_item.xml
@@ -17,6 +17,7 @@
 <view
     xmlns:android="http://schemas.android.com/apk/res/android"
     class="com.android.dialer.calllog.CallLogListItemView"
+    android:id="@+id/call_log_list_item"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical"
diff --git a/res/layout/dialtacts_activity.xml b/res/layout/dialtacts_activity.xml
index e4eb2b3..9d63514 100644
--- a/res/layout/dialtacts_activity.xml
+++ b/res/layout/dialtacts_activity.xml
@@ -42,6 +42,7 @@
                 android:layout_width="0dp"
                 android:layout_height="56dp"
                 android:layout_weight="1"
+                android:textSize="@dimen/search_text_size"
                 android:inputType="textFilter"/>
             <ImageView
                 android:id="@+id/search_close_button"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 87b0c1d..d1052d5 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -29,6 +29,9 @@
     <!-- Match call_button_height to Phone's dimens/in_call_end_button_height -->
     <dimen name="call_button_height">74dp</dimen>
 
+    <!--  Search View -->
+    <dimen name="search_text_size">16sp</dimen>
+
     <!-- Call Log -->
     <dimen name="call_log_call_action_size">32dip</dimen>
     <dimen name="call_log_call_action_width">48dip</dimen>
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java
index 1f41ac4..e26d2f0 100644
--- a/src/com/android/dialer/CallDetailActivity.java
+++ b/src/com/android/dialer/CallDetailActivity.java
@@ -55,6 +55,8 @@
 import com.android.contacts.common.CallUtil;
 import com.android.contacts.common.ClipboardUtils;
 import com.android.contacts.common.GeoUtil;
+import com.android.contacts.common.util.Constants;
+import com.android.contacts.common.util.UriUtils;
 import com.android.dialer.BackScrollManager.ScrollableHeader;
 import com.android.dialer.calllog.CallDetailHistoryAdapter;
 import com.android.dialer.calllog.CallTypeHelper;
@@ -450,7 +452,7 @@
                     nameOrNumber = firstDetails.number;
                 }
 
-                if (contactUri != null) {
+                if (contactUri != null && !UriUtils.isEncodedContactUri(contactUri)) {
                     mainActionIntent = new Intent(Intent.ACTION_VIEW, contactUri);
                     // This will launch People's detail contact screen, so we probably want to
                     // treat it as a separate People task.
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index 7168667..b685030 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -26,8 +26,6 @@
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
-import android.os.RemoteException;
-import android.os.ServiceManager;
 import android.provider.CallLog;
 import android.provider.CallLog.Calls;
 import android.provider.ContactsContract;
@@ -429,22 +427,6 @@
         }
     }
 
-    /** Removes the missed call notifications. */
-    private void removeMissedCallNotifications() {
-        try {
-            ITelephony telephony =
-                    ITelephony.Stub.asInterface(ServiceManager.getService("phone"));
-            if (telephony != null) {
-                telephony.cancelMissedCallsNotification();
-            } else {
-                Log.w(TAG, "Telephony service is null, can't call " +
-                        "cancelMissedCallsNotification");
-            }
-        } catch (RemoteException e) {
-            Log.e(TAG, "Failed to clear missed calls notification due to remote exception");
-        }
-    }
-
     /** Updates call data and notification state while leaving the call log tab. */
     private void updateOnExit() {
         updateOnTransition(false);
@@ -469,14 +451,8 @@
             if (!onEntry) {
                 mCallLogQueryHandler.markMissedCallsAsRead();
             }
-            removeMissedCallNotifications();
-            updateVoicemailNotifications();
+            CallLogNotificationsHelper.removeMissedCallNotifications();
+            CallLogNotificationsHelper.updateVoicemailNotifications(getActivity());
         }
     }
-
-    private void updateVoicemailNotifications() {
-        Intent serviceIntent = new Intent(getActivity(), CallLogNotificationsService.class);
-        serviceIntent.setAction(CallLogNotificationsService.ACTION_UPDATE_NOTIFICATIONS);
-        getActivity().startService(serviceIntent);
-    }
 }
diff --git a/src/com/android/dialer/calllog/CallLogNotificationsHelper.java b/src/com/android/dialer/calllog/CallLogNotificationsHelper.java
new file mode 100644
index 0000000..6ce66f0
--- /dev/null
+++ b/src/com/android/dialer/calllog/CallLogNotificationsHelper.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.calllog;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.util.Log;
+
+import com.android.internal.telephony.ITelephony;
+
+/**
+ * Helper class operating on call log notifications.
+ */
+public class CallLogNotificationsHelper {
+    private static final String TAG = "CallLogNotificationsHelper";
+
+    /** Removes the missed call notifications. */
+    public static void removeMissedCallNotifications() {
+        try {
+            ITelephony telephony =
+                    ITelephony.Stub.asInterface(ServiceManager.getService("phone"));
+            if (telephony != null) {
+                telephony.cancelMissedCallsNotification();
+            } else {
+                Log.w(TAG, "Telephony service is null, can't call " +
+                        "cancelMissedCallsNotification");
+            }
+        } catch (RemoteException e) {
+            Log.e(TAG, "Failed to clear missed calls notification due to remote exception");
+        }
+    }
+
+    /** Update the voice mail notifications. */
+    public static void updateVoicemailNotifications(Context context) {
+        Intent serviceIntent = new Intent(context, CallLogNotificationsService.class);
+        serviceIntent.setAction(CallLogNotificationsService.ACTION_UPDATE_NOTIFICATIONS);
+        context.startService(serviceIntent);
+    }
+}
diff --git a/src/com/android/dialer/calllog/CallLogQueryHandler.java b/src/com/android/dialer/calllog/CallLogQueryHandler.java
index 91a2e5d..987dedf 100644
--- a/src/com/android/dialer/calllog/CallLogQueryHandler.java
+++ b/src/com/android/dialer/calllog/CallLogQueryHandler.java
@@ -132,16 +132,28 @@
         mLogLimit = limit;
     }
 
-
     /**
      * Fetches the list of calls from the call log for a given type.
+     * This call ignores the new or old state.
      * <p>
      * It will asynchronously update the content of the list view when the fetch completes.
      */
     public void fetchCalls(int callType) {
         cancelFetch();
         int requestId = newCallsRequest();
-        fetchCalls(QUERY_CALLLOG_TOKEN, requestId, callType);
+        fetchCalls(QUERY_CALLLOG_TOKEN, requestId, callType , false /* newOnly */);
+    }
+
+    /**
+     * Fetches the list of calls from the call log for a given type.
+     * This call fetches only the new (i.e. NEW = 1) ones.
+     * <p>
+     * It will asynchronously update the content of the list view when the fetch completes.
+     */
+    public void fetchNewCalls(int callType) {
+        cancelFetch();
+        int requestId = newCallsRequest();
+        fetchCalls(QUERY_CALLLOG_TOKEN, requestId, callType , true /* newOnly */);
     }
 
     public void fetchVoicemailStatus() {
@@ -149,20 +161,29 @@
                 VoicemailStatusHelperImpl.PROJECTION, null, null, null);
     }
 
-    /** Fetches the list of calls in the call log, either the new one or the old ones. */
-    private void fetchCalls(int token, int requestId, int callType) {
+    /** Fetches the list of calls in the call log. */
+    private void fetchCalls(int token, int requestId, int callType, boolean newOnly) {
         // We need to check for NULL explicitly otherwise entries with where READ is NULL
         // may not match either the query or its negation.
         // We consider the calls that are not yet consumed (i.e. IS_READ = 0) as "new".
-        String selection = null;
+        StringBuilder where = new StringBuilder();
         List<String> selectionArgs = Lists.newArrayList();
 
+        if (newOnly) {
+            where.append(Calls.NEW);
+            where.append(" = 1");
+        }
+
         if (callType > CALL_TYPE_ALL) {
+            if (where.length() > 0) {
+                where.append(" AND ");
+            }
             // Add a clause to fetch only items of type voicemail.
-            selection = String.format("(%s = ?)", Calls.TYPE);
+            where.append(String.format("(%s = ?)", Calls.TYPE));
             selectionArgs.add(Integer.toString(callType));
         }
         final int limit = (mLogLimit == -1) ? NUM_LOGS_TO_DISPLAY : mLogLimit;
+        final String selection = where.length() > 0 ? where.toString() : null;
         Uri uri = Calls.CONTENT_URI_WITH_VOICEMAIL.buildUpon()
                 .appendQueryParameter(Calls.LIMIT_PARAM_KEY, Integer.toString(limit))
                 .build();
diff --git a/src/com/android/dialer/calllog/ContactInfoHelper.java b/src/com/android/dialer/calllog/ContactInfoHelper.java
index 1041281..5d7aa1b 100644
--- a/src/com/android/dialer/calllog/ContactInfoHelper.java
+++ b/src/com/android/dialer/calllog/ContactInfoHelper.java
@@ -19,15 +19,25 @@
 import android.content.Context;
 import android.database.Cursor;
 import android.net.Uri;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
 import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Directory;
+import android.provider.ContactsContract.DisplayNameSources;
 import android.provider.ContactsContract.PhoneLookup;
 import android.telephony.PhoneNumberUtils;
 import android.text.TextUtils;
+import android.util.Log;
 
+import com.android.contacts.common.util.Constants;
 import com.android.contacts.common.util.UriUtils;
 import com.android.dialer.service.CachedNumberLookupService;
+import com.android.dialer.service.CachedNumberLookupService.CachedContactInfo;
 import com.android.dialerbind.ServiceFactory;
 
+import org.json.JSONException;
+import org.json.JSONObject;
+
 /**
  * Utility class to look up the contact information for a given number.
  */
@@ -92,6 +102,7 @@
                 updatedInfo = new ContactInfo();
                 updatedInfo.number = number;
                 updatedInfo.formattedNumber = formatPhoneNumber(number, null, countryIso);
+                updatedInfo.lookupUri = createTemporaryContactUri(number);
             } else {
                 updatedInfo = info;
             }
@@ -100,6 +111,37 @@
     }
 
     /**
+     * Creates a JSON-encoded lookup uri for a unknown number without an associated contact
+     *
+     * @param number - Unknown phone number
+     * @return JSON-encoded URI that can be used to perform a lookup when clicking
+     * on the quick contact card.
+     */
+    private static Uri createTemporaryContactUri(String number) {
+        try {
+            final JSONObject contactRows = new JSONObject()
+                    .put(Phone.CONTENT_ITEM_TYPE, new JSONObject()
+                            .put(Phone.NUMBER, number)
+                                    .put(Phone.TYPE, Phone.TYPE_CUSTOM));
+
+            final String jsonString = new JSONObject()
+                    .put(Contacts.DISPLAY_NAME, number)
+                            .put(Contacts.DISPLAY_NAME_SOURCE, DisplayNameSources.PHONE)
+                            .put(Contacts.CONTENT_ITEM_TYPE, contactRows)
+                            .toString();
+
+            return Contacts.CONTENT_LOOKUP_URI.buildUpon()
+                    .appendPath(Constants.LOOKUP_URI_ENCODED)
+                    .appendQueryParameter(Constants.LOOKUP_URI_JSON, jsonString)
+                    .appendQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY,
+                            String.valueOf(Long.MAX_VALUE))
+                    .build();
+        } catch (JSONException e) {
+            return null;
+        }
+    }
+
+    /**
      * Looks up a contact using the given URI.
      * <p>
      * It returns null if an error occurs, {@link ContactInfo#EMPTY} if no matching contact is
diff --git a/src/com/android/dialer/list/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java
index 11889bf..4ffb030 100644
--- a/src/com/android/dialer/list/PhoneFavoriteFragment.java
+++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java
@@ -199,7 +199,7 @@
     @Override
     public void onResume() {
         super.onResume();
-        mCallLogQueryHandler.fetchCalls(CallLogQueryHandler.CALL_TYPE_ALL);
+        mCallLogQueryHandler.fetchNewCalls(CallLogQueryHandler.CALL_TYPE_ALL);
         mCallLogAdapter.setLoading(true);
         getLoaderManager().getLoader(LOADER_ID_CONTACT_TILE).forceLoad();
     }
diff --git a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
index f8e1e71..fba55a6 100644
--- a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
@@ -18,14 +18,21 @@
 
 import android.content.Context;
 import android.content.res.Resources;
+import android.database.Cursor;
 import android.database.DataSetObserver;
+import android.view.MotionEvent;
 import android.view.View;
+import android.view.ViewConfiguration;
 import android.view.ViewGroup;
 import android.widget.BaseAdapter;
 import android.widget.FrameLayout;
 
 import com.android.dialer.R;
 import com.android.dialer.calllog.CallLogAdapter;
+import com.android.dialer.calllog.CallLogNotificationsHelper;
+import com.android.dialer.calllog.CallLogQueryHandler;
+import com.android.dialer.list.SwipeHelper.OnItemGestureListener;
+import com.android.dialer.list.SwipeHelper.SwipeHelperCallback;
 
 /**
  * An adapter that combines items from {@link com.android.contacts.common.list.ContactTileAdapter}
@@ -54,6 +61,41 @@
 
     private final DataSetObserver mObserver;
 
+    private final CallLogQueryHandler mCallLogQueryHandler;
+
+    private final OnItemGestureListener mCallLogOnItemSwipeListener =
+            new OnItemGestureListener() {
+        @Override
+        public void onSwipe(View view) {
+            mCallLogQueryHandler.markNewCallsAsOld();
+            mCallLogQueryHandler.markNewVoicemailsAsOld();
+            CallLogNotificationsHelper.removeMissedCallNotifications();
+            CallLogNotificationsHelper.updateVoicemailNotifications(mContext);
+            mCallLogQueryHandler.fetchNewCalls(CallLogQueryHandler.CALL_TYPE_ALL);
+        }
+
+        @Override
+        public void onTouch() {}
+
+        @Override
+        public boolean isSwipeEnabled() {
+            return true;
+        }
+    };
+
+    private final CallLogQueryHandler.Listener mCallLogQueryHandlerListener =
+            new CallLogQueryHandler.Listener() {
+        @Override
+        public void onVoicemailStatusFetched(Cursor statusCursor) {}
+
+        @Override
+        public void onCallsFetched(Cursor combinedCursor) {
+            mCallLogAdapter.invalidateCache();
+            mCallLogAdapter.changeCursor(combinedCursor);
+            mCallLogAdapter.notifyDataSetChanged();
+        }
+    };
+
     public PhoneFavoriteMergedAdapter(Context context,
             PhoneFavoritesTileAdapter contactTileAdapter,
             CallLogAdapter callLogAdapter,
@@ -69,6 +111,8 @@
         mContactTileAdapter.registerDataSetObserver(mObserver);
         mLoadingView = loadingView;
         mShowAllContactsButton = showAllContactsButton;
+        mCallLogQueryHandler = new CallLogQueryHandler(mContext.getContentResolver(),
+                mCallLogQueryHandlerListener);
     }
 
     @Override
@@ -160,11 +204,12 @@
 
         if (callLogAdapterCount > 0) {
             if (position == 0) {
-                final FrameLayout wrapper;
+                final SwipeableCallLogRow wrapper;
                 if (convertView == null) {
-                    wrapper = new FrameLayout(mContext);
+                    wrapper = new SwipeableCallLogRow(mContext);
+                    wrapper.setOnItemSwipeListener(mCallLogOnItemSwipeListener);
                 } else {
-                    wrapper = (FrameLayout) convertView;
+                    wrapper = (SwipeableCallLogRow) convertView;
                 }
 
                 // Special case wrapper view for the most recent call log item. This allows
@@ -174,17 +219,7 @@
                 final View view = mCallLogAdapter.getView(position, convertView == null ?
                         null : wrapper.getChildAt(0), parent);
                 wrapper.removeAllViews();
-                view.setBackgroundResource(R.drawable.dialer_recent_card_bg);
-
-                final FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
-                        FrameLayout.LayoutParams.WRAP_CONTENT,
-                        FrameLayout.LayoutParams.WRAP_CONTENT);
-
-                params.setMarginsRelative(mCallLogPadding, mCallLogPadding, mCallLogPadding,
-                        mCallLogPadding);
-                view.setLayoutParams(params);
                 wrapper.addView(view);
-
                 return wrapper;
             }
             // Set position to the position of the actual favorite contact in the
@@ -227,4 +262,91 @@
     private int getAdjustedFavoritePosition(int position, int callLogAdapterCount) {
         return position - callLogAdapterCount;
     }
+
+    /**
+     * The swipeable call log row.
+     * See also {@link PhoneFavoritesTileAdapter.ContactTileRow}.
+     */
+    private class SwipeableCallLogRow extends FrameLayout implements SwipeHelperCallback {
+        private SwipeHelper mSwipeHelper;
+        private OnItemGestureListener mOnItemSwipeListener;
+
+        public SwipeableCallLogRow(Context context) {
+            super(context);
+            final float densityScale = getResources().getDisplayMetrics().density;
+            final float pagingTouchSlop = ViewConfiguration.get(context)
+                    .getScaledPagingTouchSlop();
+            mSwipeHelper = new SwipeHelper(context, SwipeHelper.X, this,
+                    densityScale, pagingTouchSlop);
+        }
+
+        @Override
+        public void addView(View view) {
+            view.setBackgroundResource(R.drawable.dialer_recent_card_bg);
+
+            final FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
+                    FrameLayout.LayoutParams.WRAP_CONTENT,
+                    FrameLayout.LayoutParams.WRAP_CONTENT);
+            params.setMarginsRelative(mCallLogPadding, mCallLogPadding, mCallLogPadding,
+                    mCallLogPadding);
+            view.setLayoutParams(params);
+
+            super.addView(view);
+        }
+
+        @Override
+        public View getChildAtPosition(MotionEvent ev) {
+            return getChildCount() > 0 ? getChildAt(0) : null;
+        }
+
+        @Override
+        public View getChildContentView(View v) {
+            return v.findViewById(R.id.call_log_list_item);
+        }
+
+        @Override
+        public void onScroll() {}
+
+        @Override
+        public boolean canChildBeDismissed(View v) {
+            return true;
+        }
+
+        @Override
+        public void onBeginDrag(View v) {
+        }
+
+        @Override
+        public void onChildDismissed(View v) {
+            if (v != null && mOnItemSwipeListener != null) {
+                mOnItemSwipeListener.onSwipe(v);
+            }
+            removeAllViews();
+        }
+
+        @Override
+        public void onDragCancelled(View v) {}
+
+        @Override
+        public boolean onInterceptTouchEvent(MotionEvent ev) {
+            if (mSwipeHelper != null) {
+                return mSwipeHelper.onInterceptTouchEvent(ev) || super.onInterceptTouchEvent(ev);
+            } else {
+                return super.onInterceptTouchEvent(ev);
+            }
+        }
+
+        @Override
+        public boolean onTouchEvent(MotionEvent ev) {
+            if (mSwipeHelper != null) {
+                return mSwipeHelper.onTouchEvent(ev) || super.onTouchEvent(ev);
+            } else {
+                return super.onTouchEvent(ev);
+            }
+        }
+
+        public void setOnItemSwipeListener(OnItemGestureListener listener) {
+            mOnItemSwipeListener = listener;
+        }
+    }
 }
diff --git a/src/com/android/dialer/list/PhoneFavoriteRegularRowView.java b/src/com/android/dialer/list/PhoneFavoriteRegularRowView.java
index 11dc00a..374f733 100644
--- a/src/com/android/dialer/list/PhoneFavoriteRegularRowView.java
+++ b/src/com/android/dialer/list/PhoneFavoriteRegularRowView.java
@@ -57,6 +57,8 @@
         rowPaddingBottom = resources.getDimensionPixelSize(
                 R.dimen.favorites_row_bottom_padding);
 
+        favoriteContactCard.setBackgroundResource(R.drawable.bottom_border_background);
+
         favoriteContactCard.setPaddingRelative(rowPaddingStart, rowPaddingTop, rowPaddingEnd,
                 rowPaddingBottom);
 
diff --git a/src/com/android/dialer/list/PhoneFavoriteTileView.java b/src/com/android/dialer/list/PhoneFavoriteTileView.java
index 8887a2c..43dbad3 100644
--- a/src/com/android/dialer/list/PhoneFavoriteTileView.java
+++ b/src/com/android/dialer/list/PhoneFavoriteTileView.java
@@ -131,20 +131,10 @@
     public void displayRemovalDialog() {
         mRemovalDialogue.setVisibility(VISIBLE);
         mRemovalDialogue.setAlpha(0f);
-        final int animationLength = ANIMATION_LENGTH;
-        final AnimatorSet animSet = new AnimatorSet();
         final ObjectAnimator fadeIn = ObjectAnimator.ofFloat(mRemovalDialogue, "alpha",
-                1.f).setDuration(animationLength);
+                1.f).setDuration(ANIMATION_LENGTH);
 
-        if (mParentRow.getItemViewType() == ViewTypes.FREQUENT) {
-            final ObjectAnimator backgroundFadeIn = ObjectAnimator.ofInt(
-                    mParentRow.getBackground(), "alpha", 0).setDuration(animationLength);
-            animSet.playTogether(fadeIn, backgroundFadeIn);
-        } else {
-            animSet.playTogether(fadeIn);
-        }
-
-        animSet.addListener(new AnimatorListenerAdapter() {
+        fadeIn.addListener(new AnimatorListenerAdapter() {
             @Override
             public void onAnimationStart(Animator animation) {
                 mParentRow.setHasTransientState(true);
@@ -155,8 +145,7 @@
                 mParentRow.setHasTransientState(false);
             }
         });
-
-        animSet.start();
+        fadeIn.start();
     }
 
     /**
@@ -172,10 +161,11 @@
                 setDuration(ANIMATION_LENGTH);
         final ObjectAnimator moveBack = ObjectAnimator.ofFloat(mFavoriteContactCard, "translationX",
                 0.f).setDuration(ANIMATION_LENGTH);
-        final ObjectAnimator backgroundFadeOut = ObjectAnimator.ofInt(mParentRow.getBackground(),
-                "alpha", 255).setDuration(ANIMATION_LENGTH);
+
         final AnimatorSet animSet = new AnimatorSet();
-        animSet.playTogether(fadeIn, moveBack, backgroundFadeOut);
+
+        animSet.playTogether(fadeIn, moveBack);
+
         animSet.addListener(new AnimatorListenerAdapter() {
             @Override
             public void onAnimationStart(Animator animation) {
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
index 8eba964..91acc6f 100644
--- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
@@ -688,6 +688,8 @@
                         R.dimen.favorites_row_start_padding);
                 mRowPaddingEnd = resources.getDimensionPixelSize(
                         R.dimen.favorites_row_end_padding);
+
+                setBackgroundResource(R.drawable.bottom_border_background);
             } else {
                 // For row views, padding is set on the view itself.
                 mRowPaddingTop = 0;
@@ -696,8 +698,6 @@
                 mRowPaddingEnd = 0;
             }
 
-            setBackgroundResource(R.drawable.bottom_border_background);
-
             setPaddingRelative(mRowPaddingStart, mRowPaddingTop, mRowPaddingEnd,
                     mRowPaddingBottom);
 
@@ -743,7 +743,6 @@
                 }
             }
             setPressed(false);
-            getBackground().setAlpha(255);
         }
 
         private void addTileFromEntry(ContactEntry entry, int childIndex, boolean isLastRow) {
@@ -960,11 +959,12 @@
         public void onBeginDrag(View v) {
             removePendingContactEntry();
             final int index = indexOfChild(v);
-            // Move tile to front so that any overlap will be hidden behind its siblings
+
+            /*
             if (index > 0) {
                 detachViewFromParent(index);
                 attachViewToParent(v, 0, v.getLayoutParams());
-            }
+            }*/
 
             // We do this so the underlying ScrollView knows that it won't get
             // the chance to intercept events anymore
diff --git a/src/com/android/dialer/list/SwipeableListView.java b/src/com/android/dialer/list/SwipeableListView.java
index 8f50f4c..449628d 100644
--- a/src/com/android/dialer/list/SwipeableListView.java
+++ b/src/com/android/dialer/list/SwipeableListView.java
@@ -152,13 +152,12 @@
 
     @Override
     public void onDragCancelled(View v) {
-        v.setHasTransientState(false);
     }
 
     @Override
     public void onBeginDrag(View v) {
         final View tileRow = (View) v.getParent();
-        tileRow.setHasTransientState(true);
+
         // We do this so the underlying ScrollView knows that it won't get
         // the chance to intercept events anymore
         requestDisallowInterceptTouchEvent(true);