merge in klp-release history after reset to klp-dev
diff --git a/src/com/android/dialer/list/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java
index beeb320..84bd4b4 100644
--- a/src/com/android/dialer/list/PhoneFavoriteFragment.java
+++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java
@@ -454,7 +454,31 @@
child.animate().alpha(1.0f)
.setDuration(mAnimationDuration)
.start();
- break;
+ } else {
+ Integer startTop = mItemIdTopMap.get(itemId);
+ final int top = child.getTop();
+ if (DEBUG) {
+ Log.d(TAG, "Found itemId: " + itemId + " for listview child " + i +
+ " Top: " + top);
+ }
+ int delta = 0;
+ if (startTop != null) {
+ if (startTop != top) {
+ delta = startTop - top;
+ }
+ } else if (!mItemIdLeftMap.containsKey(itemId)) {
+ // Animate new views along with the others. The catch is that they did
+ // not exist in the start state, so we must calculate their starting
+ // position based on neighboring views.
+ int childHeight = child.getHeight() + mListView.getDividerHeight();
+ startTop = top + (i > 0 ? childHeight : -childHeight);
+ delta = startTop - top;
+ }
+
+ if (delta != 0) {
+ child.setTranslationY(delta);
+ child.animate().setDuration(mAnimationDuration).translationY(0);
+ }
}
}
mItemIdTopMap.clear();
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
index 73d3c36..2e18118 100644
--- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
@@ -21,7 +21,6 @@
import android.content.Context;
import android.content.res.Resources;
import android.database.Cursor;
-import android.graphics.Rect;
import android.net.Uri;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.Contacts;
@@ -930,18 +929,21 @@
*/
public int getItemIndex(float itemX, float itemY) {
if (mPosition < mMaxTiledRows) {
- final Rect childRect = new Rect();
if (DEBUG) {
Log.v(TAG, String.valueOf(itemX) + " " + String.valueOf(itemY));
}
for (int i = 0; i < getChildCount(); ++i) {
/** If the row contains multiple tiles, checks each tile to see if the point
* is contained in the tile. */
- getChildAt(i).getHitRect(childRect);
- if (DEBUG) {
- Log.v(TAG, childRect.toString());
- }
- if (childRect.contains((int)itemX, (int)itemY)) {
+ final View child = getChildAt(i);
+ /** The coordinates passed in are based on the ListView,
+ * translate for each child first */
+ final int xInListView = child.getLeft() + getLeft();
+ final int yInListView = child.getTop() + getTop();
+ final int distanceX = (int) itemX - xInListView;
+ final int distanceY = (int) itemY - yInListView;
+ if ((distanceX > 0 && distanceX < child.getWidth()) &&
+ (distanceY > 0 && distanceY < child.getHeight())) {
/** If the point is contained in the rectangle, computes the index of the
* item in the cached array. */
return i + (mPosition) * mColumnCount;