diff options
| author | 2023-10-06 16:23:56 -0700 | |
|---|---|---|
| committer | 2023-10-12 10:03:08 -0700 | |
| commit | 5fc200698096eb4666247c8ab1bda9573cb075a6 (patch) | |
| tree | 0f6c424fdf490235bbe9160ac7dccabf478a26cb /java | |
| parent | 3b306cbbce743466212778fdda51cd1600b0711d (diff) | |
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
Diffstat (limited to 'java')
4 files changed, 2 insertions, 48 deletions
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 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2019 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License - --> -<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> - - <!-- This drawable is intended to be used as the background of a two line TextView. We only - want the height to be ~1 line. Do this cheaply by applying padding to the bottom. --> - <item android:bottom="18dp"> - <shape android:shape="rectangle" > - - <!-- Size used for scaling should the container be different dimensions --> - <size android:width="@dimen/chooser_direct_share_label_placeholder_max_width" - android:height="18dp"/> - - <!-- Absurd corner radius to ensure pill shape --> - <corners android:bottomLeftRadius="100dp" - android:bottomRightRadius="100dp" - android:topLeftRadius="100dp" - android:topRightRadius="100dp" /> - - <solid android:color="@color/chooser_gradient_background "/> - </shape> - </item> -</layer-list>
\ 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 @@ <dimen name="chooser_preview_image_max_dimen">200dp</dimen> <dimen name="chooser_header_scroll_elevation">4dp</dimen> <dimen name="chooser_max_collapsed_height">288dp</dimen> - <dimen name="chooser_direct_share_label_placeholder_max_width">72dp</dimen> <dimen name="chooser_icon_size">56dp</dimen> <dimen name="chooser_badge_size">22dp</dimen> <dimen name="resolver_icon_size">32dp</dimen> 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); } |