Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 438d1320 authored by Mike Digman's avatar Mike Digman
Browse files

Add app grouping indicators to Sharesheet

When an app publishes multiple share targets those are now
grouped under a single target. However, there is no visual
indicator of grouping. This adds that in.

Test: manual, custom built apks for testing
Fixes: 150481688
Change-Id: Ibf72cec3a337a71387928d30126b286519f03f73
parent 2dfc9f85
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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() {
+25 −0
Original line number Diff line number Diff line
<?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>
+26 −0
Original line number Diff line number Diff line
<!--
  ~ 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>
+2 −0
Original line number Diff line number Diff line
@@ -2744,6 +2744,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" />