Sharesheet - make loading placeholders unclickable
The AVD used to animate loading ds targets is build using a
square with a ds shaped cutout. Ripples on touch that go below
the AVD show a square bounding box. This looks awful, prevent
ripples as clicking the placeholder does nothing anyway.
Fixes: 129979593
Test: visual inspection
Change-Id: Id8734f3d92bd104097a60a6aa411be71db3e4efe
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index 1eabbd8..1520b1b 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -2168,7 +2168,7 @@
protected void onBindView(View view, TargetInfo info) {
super.onBindView(view, info);
- // If target is loading, show a special placeholder shape in the label
+ // If target is loading, show a special placeholder shape in the label, make unclickable
final ViewHolder holder = (ViewHolder) view.getTag();
if (info instanceof PlaceHolderTargetInfo) {
final int maxWidth = getResources().getDimensionPixelSize(
@@ -2176,9 +2176,12 @@
holder.text.setMaxWidth(maxWidth);
holder.text.setBackground(getResources().getDrawable(
R.drawable.chooser_direct_share_label_placeholder, getTheme()));
+ // Prevent rippling by removing background containing ripple
+ holder.itemView.setBackground(null);
} else {
holder.text.setMaxWidth(Integer.MAX_VALUE);
holder.text.setBackground(null);
+ holder.itemView.setBackground(holder.defaultItemViewBackground);
}
}
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 5e4918d..3ea746d 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -2061,11 +2061,16 @@
}
static class ViewHolder {
+ public View itemView;
+ public Drawable defaultItemViewBackground;
+
public TextView text;
public TextView text2;
public ImageView icon;
public ViewHolder(View view) {
+ itemView = view;
+ defaultItemViewBackground = view.getBackground();
text = (TextView) view.findViewById(com.android.internal.R.id.text1);
text2 = (TextView) view.findViewById(com.android.internal.R.id.text2);
icon = (ImageView) view.findViewById(R.id.icon);