diff options
author | Tyler Gunn <tgunn@google.com> | 2014-05-12 23:17:52 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-05-12 23:17:53 +0000 |
commit | 757981a0ab530d7ae7fbd83679b5aea86d02746d (patch) | |
tree | 27207bf41bf51b08a05b0e2dfeecb2d0f88a5f2d /src | |
parent | 73e8c7676cc9c7efa61b7cb2c225968b48834c40 (diff) | |
parent | 7be92c925c842d45aa14f4bb7edc2f64f528b58b (diff) |
Merge "Fixing bug where recycled call logs rows that were previously expanded but are not expanded on rebind appeared expanded even though they were not."
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogAdapter.java | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 407ba7595..77e6d00d8 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -245,7 +245,14 @@ public class CallLogAdapter extends GroupingListAdapter private final View.OnClickListener mExpandCollapseListener = new View.OnClickListener() { @Override public void onClick(View v) { - expandOrCollapseActions((View) v.getParent().getParent()); + final View callLogItem = (View) v.getParent().getParent(); + final CallLogListItemViews views = (CallLogListItemViews) callLogItem.getTag(); + + // Hide or show the actions view. + boolean expanded = toggleExpansion(views.rowId); + + // Trigger loading of the viewstub and visual expand or collapse. + expandOrCollapseActions(callLogItem, expanded); notifyDataSetChanged(); } }; @@ -616,13 +623,7 @@ public class CallLogAdapter extends GroupingListAdapter // Restore expansion state of the row on rebind. Inflate the actions ViewStub if required, // and set its visibility state accordingly. - if (isExpanded(rowId)) { - // Inflate the view stub if necessary, and wire up the event handlers. - inflateActionViewStub(view); - views.actionsView.setVisibility(View.VISIBLE); - } else if (views.actionsView != null) { - views.actionsView.setVisibility(View.GONE); - } + expandOrCollapseActions(view, isExpanded(rowId)); // Lookup contacts with this number NumberWithCountryIso numberCountryIso = new NumberWithCountryIso(number, countryIso); @@ -751,17 +752,15 @@ public class CallLogAdapter extends GroupingListAdapter * Expands or collapses the view containing the CALLBACK, VOICEMAIL and DELETE action buttons. * * @param callLogItem The call log entry parent view. + * @param isExpanded The new expansion state of the view. */ - private void expandOrCollapseActions(View callLogItem) { + private void expandOrCollapseActions(View callLogItem, boolean isExpanded) { final CallLogListItemViews views = (CallLogListItemViews)callLogItem.getTag(); - // Hide or show the actions view. - boolean expanded = toggleExpansion(views.rowId); - - // Inflate the view stub if necessary, and wire up the event handlers. - inflateActionViewStub(callLogItem); + if (isExpanded) { + // Inflate the view stub if necessary, and wire up the event handlers. + inflateActionViewStub(callLogItem); - if (expanded) { views.actionsView.setVisibility(View.VISIBLE); callLogItem.setBackgroundColor( callLogItem.getResources().getColor(R.color.background_dialer_light)); @@ -777,7 +776,12 @@ public class CallLogAdapter extends GroupingListAdapter views.voicemailButtonView.requestAccessibilityFocus() || views.deleteButtonView.requestAccessibilityFocus(); } else { - views.actionsView.setVisibility(View.GONE); + // When recycling a view, it is possible the actionsView ViewStub was previously + // inflated so we should hide it in this case. + if (views.actionsView != null ) { + views.actionsView.setVisibility(View.GONE); + } + callLogItem.setBackgroundColor( callLogItem.getResources().getColor(R.color.background_dialer_list_items)); callLogItem.setElevation(0); |