summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java13
-rw-r--r--java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java9
2 files changed, 21 insertions, 1 deletions
diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java b/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java
index 6f6a87cef..1c53e3801 100644
--- a/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java
+++ b/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java
@@ -102,4 +102,17 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<NewVoicemailViewHol
}
}
}
+
+ /**
+ * Ensures that when we collapse the expanded view, we don't expand it again when we are recycling
+ * the viewholders.
+ *
+ * @param collapseViewHolder is the view holder that is currently collapsed.
+ */
+ @Override
+ public void onViewHolderCollapsed(NewVoicemailViewHolder collapseViewHolder) {
+ if (collapseViewHolder.getViewHolderId() == currentlyExpandedViewHolderId) {
+ currentlyExpandedViewHolderId = -1;
+ }
+ }
}
diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java b/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java
index f8de01f58..f08e6bfd7 100644
--- a/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java
+++ b/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java
@@ -119,13 +119,20 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On
interface NewVoicemailViewHolderListener {
void onViewHolderExpanded(NewVoicemailViewHolder expandedViewHolder);
+
+ void onViewHolderCollapsed(NewVoicemailViewHolder expandedViewHolder);
}
@Override
public void onClick(View v) {
- LogUtil.i("NewVoicemailViewHolder.onClick", "voicemail id: %d", viewHolderId);
+ LogUtil.i(
+ "NewVoicemailViewHolder.onClick",
+ "voicemail id: %d, isViewHolderExpanded:%b",
+ viewHolderId,
+ isViewHolderExpanded);
if (isViewHolderExpanded) {
collapseViewHolder();
+ voicemailViewHolderListener.onViewHolderCollapsed(this);
} else {
expandViewHolder();
voicemailViewHolderListener.onViewHolderExpanded(this);