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

Commit caec1a74 authored by Mike Digman's avatar Mike Digman
Browse files

Add pinned target indicator to Sharesheet, update visuals

After a user pins an app it takes up a persistent space in the
suggested app row. Users may forget they've pinned an app as
there's no indicator. Add an in-line icon to label suggested
targets as pinned. No indicator should be shown in the A-Z list.
This CL also updates related visual styling to get close to
redlines.

Bug: 150405021
Bug: 152978014
Test: manual
Change-Id: Iee774b88e284617449a673d7e622c0ce233ded1a
parent 745202ff
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -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);
+3 −3
Original line number Diff line number Diff line
@@ -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(
+1 −1
Original line number Diff line number Diff line
@@ -21,5 +21,5 @@
          android:width="12dp"
          android:height="12dp"
          android:start="4dp"
          android:end="4dp" />
          android:end="0dp" />
</layer-list>
+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_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
+26 −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.
  -->
<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>
Loading