summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2014-06-09 17:27:43 -0700
committerAndrew Lee <anwlee@google.com>2014-06-10 11:52:01 -0700
commitbcb91d9c9539e03fdaec74bb38acecdd34552257 (patch)
tree83b0343f6a24370cbb6587488284896ccec6c02d
parent10fe6cbaf1ec65dd8c94d55e6a2f68d0d7679e07 (diff)
Adjust recent cards animation.
= Make the card clip more gradual (half that of before). = Accelerate the opacity fade so the content does not intersect with the card bounds when clipping. = Shift the search text 2dp to the left to better align with the recent card content. = Adjust the y translation of the recent card to "center" vertically. Bug: 15470880 Change-Id: I63b0742ff61d995b50257961bb317fa5d043a1bd
-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, 11 insertions, 4 deletions
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 53292e166..3533abd29 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -112,7 +112,7 @@
<!-- Padding around the icon in the search box. -->
<dimen name="search_box_icon_margin">4dp</dimen>
<dimen name="search_box_search_icon_padding">2dp</dimen>
- <dimen name="search_box_collapsed_text_margin_left">24dp</dimen>
+ <dimen name="search_box_collapsed_text_margin_left">22dp</dimen>
<dimen name="search_box_expanded_text_margin_left">26dp</dimen>
<!-- Size of the icon (voice search, close search) in the search box. -->
<dimen name="search_box_icon_size">28dp</dimen>
diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java
index bdd2d6c44..b50f94e62 100644
--- a/src/com/android/dialer/list/ListsFragment.java
+++ b/src/com/android/dialer/list/ListsFragment.java
@@ -135,12 +135,12 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste
private PanelSlideListener mPanelSlideListener = new PanelSlideListener() {
@Override
public void onPanelSlide(View panel, float slideOffset) {
- // For every 1 percent that the panel is slid upwards, clip 3 percent from each edge
+ // For every 1 percent that the panel is slid upwards, clip 1.5 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) * 3f;
+ float ratioCardHidden = (1 - slideOffset) * 1.5f;
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 088535ab7..dd198ec34 100644
--- a/src/com/android/dialer/list/ShortcutCardsAdapter.java
+++ b/src/com/android/dialer/list/ShortcutCardsAdapter.java
@@ -21,6 +21,7 @@ import android.content.res.Resources;
import android.database.Cursor;
import android.database.DataSetObserver;
import android.graphics.Rect;
+import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
@@ -252,6 +253,7 @@ public class ShortcutCardsAdapter extends BaseAdapter {
(CallLogListItemView) view.findViewById(R.id.call_log_list_item);
// Reset the internal call log item view if it is being recycled
callLogItem.setTranslationX(0);
+ callLogItem.setTranslationY(0);
callLogItem.setAlpha(1);
callLogItem.setClipBounds(null);
setChildrenOpacity(callLogItem, 1.0f);
@@ -344,12 +346,17 @@ public class ShortcutCardsAdapter extends BaseAdapter {
int newTop = (int) (ratioHidden * height);
int newBottom = (height - newTop);
mClipRect.set(newLeft, newTop, newRight, newBottom);
+
+ // Since the pane will be overlapping with the action bar, apply a vertical offset
+ // to visually center the clipped card in the viewable area;
+ int verticalOffset = -newTop / 2;
+ viewToClip.setTranslationY(verticalOffset);
}
viewToClip.setClipBounds(mClipRect);
// If the view has any children, fade them out of view.
final ViewGroup viewGroup = (ViewGroup) viewToClip;
- setChildrenOpacity(viewGroup, Math.max(0, 1 - 3 * ratioHidden));
+ setChildrenOpacity(viewGroup, Math.max(0, 1 - 4.5f * ratioHidden));
}
private void setChildrenOpacity(ViewGroup viewGroup, float alpha) {