summaryrefslogtreecommitdiff
path: root/src/com
diff options
context:
space:
mode:
authorTa-wei Yen <twyen@google.com>2016-03-16 12:32:49 -0700
committerTa-wei Yen <twyen@google.com>2016-03-16 12:32:49 -0700
commitfa15094f656599b24e1c2a5d59ca1d8c0e515d10 (patch)
tree5acf4f770e91102f8124e60916966caec72efcec /src/com
parentfb2993167fcb6315c95e9925a1526c36b0bc0602 (diff)
Prevent incorrect call log item from expanding when new item arrives
mCurrentlyExpandedPosition is unreliable when the list is changing, use mCurrentlyExpandedRowId to determine which item is expanded instead. Positions stored in CallLogAdaptor are also invalidated when the list is changing. Bug:25283769 Change-Id: Iffca8c7d65933cfcdd12f2f3cc85170226db1c4a
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java13
-rw-r--r--src/com/android/dialer/calllog/CallLogFragment.java1
2 files changed, 12 insertions, 2 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index dfb5190e1..165594efa 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -595,9 +595,10 @@ public class CallLogAdapter extends GroupingListAdapter
// In case ViewHolders were added/removed, update the expanded position if the rowIds
// match so that we can restore the correct expanded state on rebind.
mCurrentlyExpandedPosition = position;
+ views.showActions(true);
+ } else {
+ views.showActions(false);
}
-
- views.showActions(mCurrentlyExpandedPosition == position);
views.updatePhoto();
mCallLogListItemHelper.setPhoneCallDetails(views, details);
@@ -684,6 +685,14 @@ public class CallLogAdapter extends GroupingListAdapter
}
/**
+ * When the list is changing all stored position is no longer valid.
+ */
+ public void invalidatePositions() {
+ mCurrentlyExpandedPosition = RecyclerView.NO_POSITION;
+ mHiddenPosition = RecyclerView.NO_POSITION;
+ }
+
+ /**
* When the user clicks "undo", the hidden item is unhidden.
*/
@Override
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index 07299a2fb..67b72a5a3 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -217,6 +217,7 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis
// Return false; we did not take ownership of the cursor
return false;
}
+ mAdapter.invalidatePositions();
mAdapter.setLoading(false);
mAdapter.changeCursor(cursor);
// This will update the state of the "Clear call log" menu item.