Merge "Use custom path interpolators for dialpad slide in/out." into lmp-preview-dev
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index e884566..dc285cf 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -61,7 +61,7 @@
<dimen name="favorites_row_undo_text_side_padding">32dp</dimen>
<!-- Dimensions for most recent call shortcut cards -->
- <dimen name="recent_call_log_item_translation_z">5dp</dimen>
+ <dimen name="recent_call_log_item_translation_z">4dp</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>
@@ -112,7 +112,7 @@
<!-- Size of the icon (voice search, close search) in the search box. -->
<dimen name="search_box_icon_size">28dp</dimen>
<!-- Elevation of the search box -->
- <dimen name="search_box_elevation">5dp</dimen>
+ <dimen name="search_box_elevation">4dp</dimen>
<!-- Size of text in tabs. -->
<dimen name="tab_height">43dp</dimen>
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index 9906513..4752620 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -71,12 +71,13 @@
public void onItemExpanded(CallLogListItemView view);
/**
- * Determines whether a call log entry with a given ID is currently visible in the ListView.
+ * Retrieves the call log view for the specified call Id. If the view is not currently
+ * visible, returns null.
*
- * @param callId The call ID to check.
- * @return True if the call log entry with the given ID is visible.
+ * @param callId The call Id.
+ * @return The call log view.
*/
- public boolean isItemVisible(long callId);
+ public CallLogListItemView getViewForCallId(long callId);
}
/** Interface used to initiate a refresh of the content. */
@@ -283,9 +284,19 @@
// Animate the expansion or collapse.
if (mCallItemExpandedListener != null) {
mCallItemExpandedListener.onItemExpanded(callLogItem);
- }
- notifyDataSetChanged();
+ // Animate the collapse of the previous item if it is still visible on screen.
+ if (mPreviouslyExpanded != NONE_EXPANDED) {
+ CallLogListItemView previousItem = mCallItemExpandedListener.getViewForCallId(
+ mPreviouslyExpanded);
+
+ if (previousItem != null) {
+ expandOrCollapseActions(previousItem, false);
+ mCallItemExpandedListener.onItemExpanded(previousItem);
+ }
+ mPreviouslyExpanded = NONE_EXPANDED;
+ }
+ }
}
};
@@ -825,17 +836,7 @@
} else {
// Expanding a row (collapsing current expanded one).
- // Where an item which was previously expanded is still on screen, track it as being
- // previously expanded so that we will animate the collapse on re-bind.
- if (mCurrentlyExpanded != NONE_EXPANDED &&
- mCallItemExpandedListener != null &&
- mCallItemExpandedListener.isItemVisible(mCurrentlyExpanded)) {
-
- mPreviouslyExpanded = mCurrentlyExpanded;
- } else {
- // Item is no longer on screen, so we will not animate its collapse on rebind.
- mPreviouslyExpanded = NONE_EXPANDED;
- }
+ mPreviouslyExpanded = mCurrentlyExpanded;
mCurrentlyExpanded = rowId;
return true;
}
@@ -858,7 +859,7 @@
views.actionsView.setAlpha(1.0f);
views.callLogEntryView.setBackgroundColor(
callLogItem.getResources().getColor(R.color.background_dialer_light));
- views.callLogEntryView.setTranslationZ(callLogItem.getResources().getDimension(
+ callLogItem.setTranslationZ(callLogItem.getResources().getDimension(
R.dimen.call_log_expanded_translation_z));
// Attempt to give accessibility focus to one of the action buttons.
@@ -878,15 +879,7 @@
views.callLogEntryView.setBackgroundColor(
callLogItem.getResources().getColor(R.color.background_dialer_list_items));
- views.callLogEntryView.setElevation(0);
-
- // Where the current row was previously expanded, trigger a collapse animation.
- if (views.rowId == mPreviouslyExpanded) {
- if (mCallItemExpandedListener != null && views.actionsView != null) {
- mCallItemExpandedListener.onItemExpanded(callLogItem);
- }
- mPreviouslyExpanded = NONE_EXPANDED;
- }
+ callLogItem.setTranslationZ(0);
}
}
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index 6cf6e45..de00550 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -671,13 +671,14 @@
}
/**
- * Determines whether a call log entry with a given ID is currently visible in the list view.
+ * Retrieves the call log view for the specified call Id. If the view is not currently
+ * visible, returns null.
*
- * @param callId The call ID to check.
- * @return True if the call log entry with the given ID is visible.
+ * @param callId The call Id.
+ * @return The call log view.
*/
@Override
- public boolean isItemVisible(long callId) {
+ public CallLogListItemView getViewForCallId(long callId) {
ListView listView = getListView();
int firstPosition = listView.getFirstVisiblePosition();
@@ -689,10 +690,11 @@
if (view != null) {
final CallLogListItemViews viewHolder = (CallLogListItemViews) view.getTag();
if (viewHolder != null && viewHolder.rowId == callId) {
- return true;
+ return (CallLogListItemView)view;
}
}
}
- return false;
+
+ return null;
}
}
diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java
index 2ff5a2a..229f7f3 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 1 percent that the panel is slid upwards, clip 2 percent from each edge
+ // For every 1 percent that the panel is slid upwards, clip 3 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) * 2f;
+ float ratioCardHidden = (1 - slideOffset) * 3f;
if (mShortcutCardsListView.getCount() > 0) {
SwipeableShortcutCard v =
(SwipeableShortcutCard) mShortcutCardsListView.getChildAt(0);