summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-06-24 18:48:58 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-06-24 18:48:58 +0000
commit68a01eb83a8894d930650c6a5034b0dd7dae106a (patch)
tree51b27e6350a40b3bd688f22d9cfadf2ee24cf582 /src
parent8b508e3c52adc80100fb35cf749042d02ac6f028 (diff)
parent6942eff643d11245a46376923f1bb2c5b1fce1cd (diff)
am 6942eff6: am b9b07de8: am 0feab022: Merge "Expand the first call log item for new cursors." into mnc-dev
* commit '6942eff643d11245a46376923f1bb2c5b1fce1cd': Expand the first call log item for new cursors.
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index cc3c5bad8..2ba257a3b 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -99,6 +99,8 @@ public class CallLogAdapter extends GroupingListAdapter
// Tracks the rowId of the currently expanded list item, so the position can be updated if there
// are any changes to the call log entries, such as additions or removals.
private long mCurrentlyExpandedRowId = NO_EXPANDED_LIST_ITEM;
+ // Whether the first call log list item has been automatically expanded for a new cursor.
+ private boolean mHasBoundFirstView;
/**
* Hashmap, keyed by call Id, used to track the day group for a call. As call log entries are
@@ -285,6 +287,16 @@ public class CallLogAdapter extends GroupingListAdapter
mCallFetcher.fetchCalls();
}
+ @Override
+ public void changeCursor(Cursor cursor) {
+ // Data has changed; reset so that the first call log list item will be expanded.
+ mHasBoundFirstView = false;
+ mCurrentlyExpandedPosition = RecyclerView.NO_POSITION;
+ mCurrentlyExpandedRowId = NO_EXPANDED_LIST_ITEM;
+
+ super.changeCursor(cursor);
+ }
+
public void setLoading(boolean loading) {
mLoading = loading;
}
@@ -489,10 +501,15 @@ public class CallLogAdapter extends GroupingListAdapter
mCallLogViewsHelper.setPhoneCallDetails(mContext, views, details);
- // Update the expanded position if the rowIds match, in case ViewHolders were added/removed.
- // Then restore the state of the row on rebind.
if (mCurrentlyExpandedRowId == views.rowId) {
+ // 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;
+ } else if (!mHasBoundFirstView) {
+ // Expand the first view when loading the call log to expose the actions.
+ mCurrentlyExpandedRowId = views.rowId;
mCurrentlyExpandedPosition = position;
+ mHasBoundFirstView = true;
}
views.showActions(mCurrentlyExpandedPosition == position);