summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-05-22 18:03:17 -0700
committerYorke Lee <yorkelee@google.com>2014-05-22 18:03:17 -0700
commit649fc77497df79f2837f314a53fafdd2dd2c67aa (patch)
tree3a29d46babaa2886b8b0e6685e90d01168d4cba0 /src
parent91b50b81967409ef25b3b1893f2a63c0c5355c53 (diff)
Tweak card clipping effect
Bug: 15165470 Change-Id: I5e61d23dc02237d0cd7c0e3646ce71b93a68a143
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/list/ListsFragment.java4
-rw-r--r--src/com/android/dialer/list/ShortcutCardsAdapter.java9
2 files changed, 8 insertions, 5 deletions
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));
}
}
}