summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2014-05-12 15:41:25 -0700
committerTyler Gunn <tgunn@google.com>2014-05-12 15:41:25 -0700
commit7be92c925c842d45aa14f4bb7edc2f64f528b58b (patch)
tree0f312f5552bd132f4b4e279f6ce1b5e4514ee159 /src
parent48d0e836fd506fbf12c93e3ac233588e967b08d6 (diff)
Fixing bug where recycled call logs rows that were previously expanded but
are not expanded on rebind appeared expanded even though they were not. Refactored code to enable better re-use of expandeOrCollapseActions. Bug: 13962594 Change-Id: Ife8355dcce44fc258334516ad81797af987f83f1
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java36
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);