Merge "Tweak card clipping effect" into lmp-preview-dev
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index f399e36..795b2a3 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -69,6 +69,8 @@
     <!-- Dimensions for most recent call shortcut cards -->
     <dimen name="recent_call_log_item_translation_z">5dp</dimen>
     <dimen name="recent_call_log_item_padding">8dp</dimen>
+    <!-- The maximum amount to clip on the left and right of the recent call shortcut card -->
+    <dimen name="recent_call_log_item_horizontal_clip_limit">20dp</dimen>
 
     <!-- Size of the star icon on the favorites tile. -->
     <dimen name="favorites_star_icon_size">12dp</dimen>
diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java
index ac3818c..78570e1 100644
--- a/src/com/android/dialer/list/ListsFragment.java
+++ b/src/com/android/dialer/list/ListsFragment.java
@@ -126,12 +126,12 @@
     private PanelSlideListener mPanelSlideListener = new PanelSlideListener() {
         @Override
         public void onPanelSlide(View panel, float slideOffset) {
-            // For every 2 percent that the panel is slid upwards, clip 3 percent from each edge
+            // For every 1 percent that the panel is slid upwards, clip 2 percent from each edge
             // of the shortcut card, to achieve the animated effect of the shortcut card
             // rapidly shrinking and disappearing from view when the panel is slid upwards.
             // slideOffset is 1 when the shortcut card is fully exposed, and 0 when completely
             // hidden.
-            float ratioCardHidden = (1 - slideOffset) * 1.5f;
+            float ratioCardHidden = (1 - slideOffset) * 2f;
             if (mShortcutCardsListView.getCount() > 0) {
                 SwipeableShortcutCard v =
                         (SwipeableShortcutCard) mShortcutCardsListView.getChildAt(0);
diff --git a/src/com/android/dialer/list/ShortcutCardsAdapter.java b/src/com/android/dialer/list/ShortcutCardsAdapter.java
index b4266d3..4df44f0 100644
--- a/src/com/android/dialer/list/ShortcutCardsAdapter.java
+++ b/src/com/android/dialer/list/ShortcutCardsAdapter.java
@@ -55,6 +55,7 @@
     private final ListsFragment mFragment;
 
     private final int mCallLogPadding;
+    private final int mCardMaxHorizontalClip;
 
     private final Context mContext;
 
@@ -101,6 +102,8 @@
         final Resources resources = context.getResources();
         mContext = context;
         mFragment = fragment;
+        mCardMaxHorizontalClip = resources.getDimensionPixelSize(
+                R.dimen.recent_call_log_item_horizontal_clip_limit);
         mCallLogPadding = resources.getDimensionPixelSize(R.dimen.recent_call_log_item_padding);
         mCallLogAdapter = callLogAdapter;
         mObserver = new CustomDataSetObserver();
@@ -301,8 +304,8 @@
             if (ratioHidden > 0.5f) {
                 mClipRect.set(0, 0 , 0, 0);
             } else {
-                int newLeft = (int) (ratioHidden * width);
-                int newRight = (width - newLeft);
+                int newLeft = (int) (ratioHidden * mCardMaxHorizontalClip);
+                int newRight = width - newLeft;
                 int newTop = (int) (ratioHidden * height);
                 int newBottom = (height - newTop);
                 mClipRect.set(newLeft, newTop, newRight, newBottom);
@@ -313,7 +316,7 @@
             final ViewGroup viewGroup = (ViewGroup) viewToClip;
             final int count = viewGroup.getChildCount();
             for (int i = 0; i < count; i++) {
-                viewGroup.getChildAt(i).setAlpha(Math.max(0, 1 - 4 * ratioHidden));
+                viewGroup.getChildAt(i).setAlpha(Math.max(0, 1 - 3 * ratioHidden));
             }
         }
     }