Loading core/java/com/android/internal/app/ChooserActivity.java +18 −0 Original line number Diff line number Diff line Loading @@ -2136,6 +2136,24 @@ public class ChooserActivity extends ResolverActivity { com.android.internal.R.layout.resolve_grid_item, parent, false); } @Override protected void onBindView(View view, TargetInfo info) { super.onBindView(view, info); // If target is loading, show a special placeholder shape in the label final ViewHolder holder = (ViewHolder) view.getTag(); if (info instanceof PlaceHolderTargetInfo) { final int maxWidth = getResources().getDimensionPixelSize( R.dimen.chooser_direct_share_label_placeholder_max_width); holder.text.setMaxWidth(maxWidth); holder.text.setBackground(getResources().getDrawable( R.drawable.chooser_direct_share_label_placeholder, getTheme())); } else { holder.text.setMaxWidth(Integer.MAX_VALUE); holder.text.setBackground(null); } } @Override public void onListRebuilt() { // don't support direct share on low ram devices Loading core/res/res/drawable/chooser_direct_share_label_placeholder.xml 0 → 100644 +37 −0 Original line number Diff line number Diff line <?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 core/res/res/values/dimens.xml +1 −0 Original line number Diff line number Diff line Loading @@ -731,4 +731,5 @@ <dimen name="chooser_target_width">90dp</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> </resources> core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -3769,4 +3769,6 @@ <java-symbol type="drawable" name="chooser_direct_share_icon_placeholder" /> <java-symbol type="color" name="chooser_gradient_background" /> <java-symbol type="color" name="chooser_gradient_highlight" /> <java-symbol type="drawable" name="chooser_direct_share_label_placeholder" /> <java-symbol type="dimen" name="chooser_direct_share_label_placeholder_max_width" /> </resources> Loading
core/java/com/android/internal/app/ChooserActivity.java +18 −0 Original line number Diff line number Diff line Loading @@ -2136,6 +2136,24 @@ public class ChooserActivity extends ResolverActivity { com.android.internal.R.layout.resolve_grid_item, parent, false); } @Override protected void onBindView(View view, TargetInfo info) { super.onBindView(view, info); // If target is loading, show a special placeholder shape in the label final ViewHolder holder = (ViewHolder) view.getTag(); if (info instanceof PlaceHolderTargetInfo) { final int maxWidth = getResources().getDimensionPixelSize( R.dimen.chooser_direct_share_label_placeholder_max_width); holder.text.setMaxWidth(maxWidth); holder.text.setBackground(getResources().getDrawable( R.drawable.chooser_direct_share_label_placeholder, getTheme())); } else { holder.text.setMaxWidth(Integer.MAX_VALUE); holder.text.setBackground(null); } } @Override public void onListRebuilt() { // don't support direct share on low ram devices Loading
core/res/res/drawable/chooser_direct_share_label_placeholder.xml 0 → 100644 +37 −0 Original line number Diff line number Diff line <?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
core/res/res/values/dimens.xml +1 −0 Original line number Diff line number Diff line Loading @@ -731,4 +731,5 @@ <dimen name="chooser_target_width">90dp</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> </resources>
core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -3769,4 +3769,6 @@ <java-symbol type="drawable" name="chooser_direct_share_icon_placeholder" /> <java-symbol type="color" name="chooser_gradient_background" /> <java-symbol type="color" name="chooser_gradient_highlight" /> <java-symbol type="drawable" name="chooser_direct_share_label_placeholder" /> <java-symbol type="dimen" name="chooser_direct_share_label_placeholder_max_width" /> </resources>