Merge "Add app grouping indicators to Sharesheet" into rvc-dev

This commit is contained in:
Mike Digman
2020-05-15 21:54:16 +00:00
committed by Android (Google) Code Review
4 changed files with 64 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ import android.content.pm.LabeledIntent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ShortcutInfo;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.UserHandle;
import android.os.UserManager;
@@ -253,6 +254,16 @@ public class ChooserListAdapter extends ResolverListAdapter {
holder.text.setBackground(null);
holder.itemView.setBackground(holder.defaultItemViewBackground);
}
// If the target is grouped show an indicator
if (info instanceof MultiDisplayResolveInfo) {
Drawable bkg = mContext.getDrawable(R.drawable.chooser_group_background);
holder.text.setPaddingRelative(0, 0, bkg.getIntrinsicWidth() /* end */, 0);
holder.text.setBackground(bkg);
} else {
holder.text.setBackground(null);
holder.text.setPaddingRelative(0, 0, 0, 0);
}
}
void updateAlphabeticalList() {

View 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_group_arrow"
android:gravity="end|center_vertical"
android:width="12dp"
android:height="12dp"
android:start="4dp"
android:end="4dp" />
</layer-list>

View File

@@ -0,0 +1,26 @@
<!--
~ 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="M2,4L6,8L10,4L2,4Z"
android:fillColor="#FF000000"/>
</vector>

View File

@@ -2745,6 +2745,8 @@
<java-symbol type="id" name="chooser_row_text_option" />
<java-symbol type="dimen" name="chooser_row_text_option_translate" />
<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="integer" name="config_maxShortcutTargetsPerApp" />
<java-symbol type="layout" name="resolve_grid_item" />
<java-symbol type="id" name="day_picker_view_pager" />