summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-05-23 16:17:08 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-23 16:17:09 +0000
commitb09c17f79150441a946f4a3330cd14c6e5e49e3d (patch)
treee9f6b288d86d42a24c457d13c2a23569d0c21e69
parent13f6fd048f0cdc26e9dc6b78a02515e72fff2e27 (diff)
parent649fc77497df79f2837f314a53fafdd2dd2c67aa (diff)
Merge "Tweak card clipping effect" into lmp-preview-dev
-rw-r--r--res/values/dimens.xml2
-rw-r--r--src/com/android/dialer/list/ListsFragment.java4
-rw-r--r--src/com/android/dialer/list/ShortcutCardsAdapter.java9
3 files changed, 10 insertions, 5 deletions
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index f399e368e..795b2a3bc 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 ac3818c8b..78570e168 100644
--- a/src/com/android/dialer/list/ListsFragment.java
+++ b/src/com/android/dialer/list/ListsFragment.java
@@ -126,12 +126,12 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste
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 b4266d33d..4df44f0e2 100644
--- a/src/com/android/dialer/list/ShortcutCardsAdapter.java
+++ b/src/com/android/dialer/list/ShortcutCardsAdapter.java
@@ -55,6 +55,7 @@ public class ShortcutCardsAdapter extends BaseAdapter {
private final ListsFragment mFragment;
private final int mCallLogPadding;
+ private final int mCardMaxHorizontalClip;
private final Context mContext;
@@ -101,6 +102,8 @@ public class ShortcutCardsAdapter extends BaseAdapter {
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 @@ public class ShortcutCardsAdapter extends BaseAdapter {
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 @@ public class ShortcutCardsAdapter extends BaseAdapter {
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));
}
}
}