summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-05-23 16:21:42 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-23 16:21:42 +0000
commit89e59d6059c9f547ac1351efe89360af862dbe1f (patch)
tree973edfc4ee914699d3db4bf9dfc1e309575d3c7a
parentfb59a328b99669b819c88983561bb1549b6cafeb (diff)
parentb09c17f79150441a946f4a3330cd14c6e5e49e3d (diff)
am b09c17f7: Merge "Tweak card clipping effect" into lmp-preview-dev
* commit 'b09c17f79150441a946f4a3330cd14c6e5e49e3d': Tweak card clipping effect
-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 8181579f5..433300db3 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -63,6 +63,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));
}
}
}