Merge "Add pinned target indicator to Sharesheet, update visuals" into rvc-dev am: aa96eb5733
Change-Id: I952e52cd4384ab5a5c56557e4a64241012286b90
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -21,5 +21,5 @@
|
||||
android:width="12dp"
|
||||
android:height="12dp"
|
||||
android:start="4dp"
|
||||
android:end="4dp" />
|
||||
android:end="0dp" />
|
||||
</layer-list>
|
||||
|
||||
25
core/res/res/drawable/chooser_pinned_background.xml
Normal file
25
core/res/res/drawable/chooser_pinned_background.xml
Normal file
@@ -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>
|
||||
26
core/res/res/drawable/ic_chooser_pin.xml
Normal file
26
core/res/res/drawable/ic_chooser_pin.xml
Normal file
@@ -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>
|
||||
@@ -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" />
|
||||
|
||||
@@ -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" />
|
||||
|
||||
Reference in New Issue
Block a user