From 2d0c7b02bc2e6e8393331f92d0e560abd786bde2 Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Thu, 18 Jun 2020 12:16:56 -0400 Subject: [PATCH] Resolver/Chooser - Fix reuse of textview Upon reuse of a view by the recyclerview, it was possible to show a reused view's sublabel, as it was doing incorrect comparisons. Make sure to always reset the textviews, and hide it if necessary. Fixes: 150813955 Test: manual, but helpful to have many apps installed and launch the sharesheet Change-Id: Idb0c03c0b0917104bd9f26cdd9ed33a0055fa6f2 --- .../android/internal/app/ResolverListAdapter.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/java/com/android/internal/app/ResolverListAdapter.java b/core/java/com/android/internal/app/ResolverListAdapter.java index 04a186c3207e3..094fb1e2f23c5 100644 --- a/core/java/com/android/internal/app/ResolverListAdapter.java +++ b/core/java/com/android/internal/app/ResolverListAdapter.java @@ -689,17 +689,17 @@ public class ResolverListAdapter extends BaseAdapter { } public void bindLabel(CharSequence label, CharSequence subLabel, boolean showSubLabel) { - if (!TextUtils.equals(text.getText(), label)) { - text.setText(label); - } + text.setText(label); if (TextUtils.equals(label, subLabel)) { - subLabel = ""; + subLabel = null; } - if (showSubLabel || !TextUtils.equals(text2.getText(), subLabel)) { + text2.setText(subLabel); + if (showSubLabel || subLabel != null) { text2.setVisibility(View.VISIBLE); - text2.setText(subLabel); + } else { + text2.setVisibility(View.GONE); } itemView.setContentDescription(null);