diff options
| author | 2020-05-18 23:12:15 +0000 | |
|---|---|---|
| committer | 2020-05-18 23:12:15 +0000 | |
| commit | aa96eb5733d38ac8c380dead672ada0edb34cd19 (patch) | |
| tree | aaf48f991840e683af6a0a8202414cf348d203e8 | |
| parent | b8ec05c9f01458ddbe658846d358d748381004af (diff) | |
| parent | caec1a7440ae42fcd26680f3143a352519850634 (diff) | |
Merge "Add pinned target indicator to Sharesheet, update visuals" into rvc-dev
| -rw-r--r-- | core/java/com/android/internal/app/ChooserListAdapter.java | 12 | ||||
| -rw-r--r-- | core/java/com/android/internal/app/ResolverListAdapter.java | 6 | ||||
| -rw-r--r-- | core/res/res/drawable/chooser_group_background.xml | 2 | ||||
| -rw-r--r-- | core/res/res/drawable/chooser_pinned_background.xml | 25 | ||||
| -rw-r--r-- | core/res/res/drawable/ic_chooser_pin.xml | 26 | ||||
| -rw-r--r-- | core/res/res/layout/resolve_grid_item.xml | 2 | ||||
| -rw-r--r-- | core/res/res/values/symbols.xml | 2 |
7 files changed, 67 insertions, 8 deletions
diff --git a/core/java/com/android/internal/app/ChooserListAdapter.java b/core/java/com/android/internal/app/ChooserListAdapter.java index 2568d097d404..f1b716143787 100644 --- a/core/java/com/android/internal/app/ChooserListAdapter.java +++ b/core/java/com/android/internal/app/ChooserListAdapter.java @@ -238,8 +238,9 @@ public class ChooserListAdapter extends ResolverListAdapter { } @Override - protected void onBindView(View view, TargetInfo info) { - super.onBindView(view, info); + protected void onBindView(View view, TargetInfo info, int position) { + super.onBindView(view, info, position); + if (info == null) return; // If target is loading, show a special placeholder shape in the label, make unclickable final ViewHolder holder = (ViewHolder) view.getTag(); @@ -257,11 +258,16 @@ public class ChooserListAdapter extends ResolverListAdapter { holder.itemView.setBackground(holder.defaultItemViewBackground); } - // If the target is grouped show an indicator if (info instanceof MultiDisplayResolveInfo) { + // If the target is grouped show an indicator Drawable bkg = mContext.getDrawable(R.drawable.chooser_group_background); holder.text.setPaddingRelative(0, 0, bkg.getIntrinsicWidth() /* end */, 0); holder.text.setBackground(bkg); + } else if (info.isPinned() && getPositionTargetType(position) == TARGET_STANDARD) { + // If the target is pinned and in the suggested row show a pinned indicator + Drawable bkg = mContext.getDrawable(R.drawable.chooser_pinned_background); + holder.text.setPaddingRelative(bkg.getIntrinsicWidth() /* start */, 0, 0, 0); + holder.text.setBackground(bkg); } else { holder.text.setBackground(null); holder.text.setPaddingRelative(0, 0, 0, 0); diff --git a/core/java/com/android/internal/app/ResolverListAdapter.java b/core/java/com/android/internal/app/ResolverListAdapter.java index af9c0408ccaa..d942e859ccd0 100644 --- a/core/java/com/android/internal/app/ResolverListAdapter.java +++ b/core/java/com/android/internal/app/ResolverListAdapter.java @@ -524,7 +524,7 @@ public class ResolverListAdapter extends BaseAdapter { if (view == null) { view = createView(parent); } - onBindView(view, getItem(position)); + onBindView(view, getItem(position), position); return view; } @@ -541,10 +541,10 @@ public class ResolverListAdapter extends BaseAdapter { } public final void bindView(int position, View view) { - onBindView(view, getItem(position)); + onBindView(view, getItem(position), position); } - protected void onBindView(View view, TargetInfo info) { + protected void onBindView(View view, TargetInfo info, int position) { final ViewHolder holder = (ViewHolder) view.getTag(); if (info == null) { holder.icon.setImageDrawable( diff --git a/core/res/res/drawable/chooser_group_background.xml b/core/res/res/drawable/chooser_group_background.xml index 2bf9337557ed..036028de7bcb 100644 --- a/core/res/res/drawable/chooser_group_background.xml +++ b/core/res/res/drawable/chooser_group_background.xml @@ -21,5 +21,5 @@ android:width="12dp" android:height="12dp" android:start="4dp" - android:end="4dp" /> + android:end="0dp" /> </layer-list> diff --git a/core/res/res/drawable/chooser_pinned_background.xml b/core/res/res/drawable/chooser_pinned_background.xml new file mode 100644 index 000000000000..fbbe8c107fb9 --- /dev/null +++ b/core/res/res/drawable/chooser_pinned_background.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2020 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"> + <item android:drawable="@drawable/ic_chooser_pin" + android:gravity="start|center_vertical" + android:width="12dp" + android:height="12dp" + android:start="0dp" + android:end="4dp" /> +</layer-list>
\ No newline at end of file diff --git a/core/res/res/drawable/ic_chooser_pin.xml b/core/res/res/drawable/ic_chooser_pin.xml new file mode 100644 index 000000000000..47851dcbf5bd --- /dev/null +++ b/core/res/res/drawable/ic_chooser_pin.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2020 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. + --> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="12dp" + android:height="12dp" + android:viewportWidth="12" + android:viewportHeight="12" + android:tint="?attr/textColorSecondary"> + <path + android:pathData="M8.5,2C8.5,1.45 8.055,1 7.5,1L4.5,1C3.95,1 3.5,1.45 3.5,2L3.5,5.5L2.5,7L2.5,8L5.5,8L5.5,10.5L6,11L6.5,10.5L6.5,8L9.5,8L9.5,7L8.5,5.5L8.5,2Z" + android:fillColor="#FF000000" /> +</vector> diff --git a/core/res/res/layout/resolve_grid_item.xml b/core/res/res/layout/resolve_grid_item.xml index fdd965f3b157..50e6f33f628a 100644 --- a/core/res/res/layout/resolve_grid_item.xml +++ b/core/res/res/layout/resolve_grid_item.xml @@ -44,7 +44,7 @@ android:layout_height="wrap_content" android:textAppearance="?attr/textAppearanceSmall" android:textColor="?attr/textColorPrimary" - android:textSize="14sp" + android:textSize="12sp" android:gravity="top|center_horizontal" android:lines="1" android:ellipsize="end" /> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index b483ee04a7ec..a9e0b58f75a1 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2747,6 +2747,8 @@ <java-symbol type="dimen" name="chooser_preview_image_max_dimen"/> <java-symbol type="drawable" name="ic_chooser_group_arrow"/> <java-symbol type="drawable" name="chooser_group_background"/> + <java-symbol type="drawable" name="ic_chooser_pin"/> + <java-symbol type="drawable" name="chooser_pinned_background"/> <java-symbol type="integer" name="config_maxShortcutTargetsPerApp" /> <java-symbol type="layout" name="resolve_grid_item" /> <java-symbol type="id" name="day_picker_view_pager" /> |