From 5fc200698096eb4666247c8ab1bda9573cb075a6 Mon Sep 17 00:00:00 2001 From: Andrey Epin Date: Fri, 6 Oct 2023 16:23:56 -0700 Subject: Fix shortcuts loading state Caused by ag/24642135: legacy code, effectively, did not set background for the shortcut placeholder labels. Specifically, for a placeholder TargetInfo with isPlaceholderTargetInfo() returning true, neither isMultiDisplayResolveInfo() nor isPinned() returned true as well thus the background drawable set for the label got immediately reset by the following logic (and ag/24642135 removed this overriding logic). This change removes the placeholder label background drawable and related view size limitation. Fix: 302391707 Test: manual testing -- simulate long shortcut loading (by a code injection), observe no visual artifacts in the shortcuts row. Change-Id: I86975407b729b488a0a5c924859bc218abc4444e --- .../chooser_direct_share_label_placeholder.xml | 37 ---------------------- java/res/values/dimens.xml | 1 - .../android/intentresolver/ChooserListAdapter.java | 7 +--- .../intentresolver/ResolverListAdapter.java | 5 +-- 4 files changed, 2 insertions(+), 48 deletions(-) delete mode 100644 java/res/drawable/chooser_direct_share_label_placeholder.xml (limited to 'java') diff --git a/java/res/drawable/chooser_direct_share_label_placeholder.xml b/java/res/drawable/chooser_direct_share_label_placeholder.xml deleted file mode 100644 index b21444bf..00000000 --- a/java/res/drawable/chooser_direct_share_label_placeholder.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index ae80815b..8843c81a 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -33,7 +33,6 @@ 200dp 4dp 288dp - 72dp 56dp 22dp 32dp diff --git a/java/src/com/android/intentresolver/ChooserListAdapter.java b/java/src/com/android/intentresolver/ChooserListAdapter.java index 35258317..9a15c919 100644 --- a/java/src/com/android/intentresolver/ChooserListAdapter.java +++ b/java/src/com/android/intentresolver/ChooserListAdapter.java @@ -375,13 +375,8 @@ public class ChooserListAdapter extends ResolverListAdapter { } } - // If target is loading, show a special placeholder shape in the label, make unclickable if (info.isPlaceHolderTargetInfo()) { - int maxTextWidth = mContext.getResources().getDimensionPixelSize( - R.dimen.chooser_direct_share_label_placeholder_max_width); - Drawable placeholderDrawable = mContext.getResources().getDrawable( - R.drawable.chooser_direct_share_label_placeholder, mContext.getTheme()); - holder.bindPlaceholderDrawable(maxTextWidth, placeholderDrawable); + holder.bindPlaceholder(); } if (info.isMultiDisplayResolveInfo()) { diff --git a/java/src/com/android/intentresolver/ResolverListAdapter.java b/java/src/com/android/intentresolver/ResolverListAdapter.java index d1e8c15b..0dd89d87 100644 --- a/java/src/com/android/intentresolver/ResolverListAdapter.java +++ b/java/src/com/android/intentresolver/ResolverListAdapter.java @@ -993,10 +993,7 @@ public class ResolverListAdapter extends BaseAdapter { } } - public void bindPlaceholderDrawable(int maxTextWidth, Drawable drawable) { - text.setMaxWidth(maxTextWidth); - text.setBackground(drawable); - // Prevent rippling by removing background containing ripple + public void bindPlaceholder() { itemView.setBackground(null); } -- cgit v1.2.3-59-g8ed1b