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

Commit dfc138f4 authored by yaolu's avatar yaolu
Browse files

Remove unnecessay icons on QuickContact Recent card

Bug: 28944282
Test: Manually verified icons are removed and the rest UI stays the same
when:
1. recent card has no expand button
2. recent card is expanded/collapsed in portrait, landscape, RTL

Change-Id: I550eb75b716f0ef15d8f243c4c1f0a57d726a3e5
parent 8e7262db
Loading
Loading
Loading
Loading
+1 −14
Original line number Diff line number Diff line
@@ -37,8 +37,7 @@
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/expanding_entry_card_item_padding_start"
            android:paddingBottom="@dimen/expanding_entry_card_button_padding_vertical"
            android:paddingTop="@dimen/expanding_entry_card_button_padding_vertical"
            android:layout_weight="0" />
            android:paddingTop="@dimen/expanding_entry_card_button_padding_vertical"/>

        <TextView
            android:id="@+id/text"
@@ -46,22 +45,10 @@
            android:layout_height="wrap_content"
            android:paddingStart="@dimen/expanding_entry_card_item_image_spacing"
            android:gravity="center_vertical"
            android:layout_weight="0"
            android:paddingBottom="@dimen/expanding_entry_card_button_padding_vertical"
            android:paddingTop="@dimen/expanding_entry_card_button_padding_vertical"
            android:textColor="@color/expanding_entry_card_button_text_color"
            android:textSize="@dimen/expanding_entry_card_title_text_size" />

        <LinearLayout
            android:id="@+id/badge_container"
            android:gravity="end"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="11dp"
            android:layout_marginTop="@dimen/expanding_entry_card_button_padding_vertical"
            android:layout_weight="1"
            android:alpha=".3"
            android:orientation="horizontal" />
    </LinearLayout>

</LinearLayout>
 No newline at end of file
+0 −1
Original line number Diff line number Diff line
@@ -214,7 +214,6 @@
    <dimen name="expanding_entry_card_item_icon_margin_right">12dp</dimen>
    <dimen name="expanding_entry_card_item_header_only_margin_top">6dp</dimen>

    <dimen name="expanding_entry_card_badge_separator_margin">8dp</dimen>
    <dimen name="expanding_entry_card_card_corner_radius">2dp</dimen>
    <dimen name="expanding_entry_card_header_margin_bottom">2dp</dimen>
    <!-- The top margin when the sub header and text views are both gone -->
+0 −47
Original line number Diff line number Diff line
@@ -264,9 +264,6 @@ public class ExpandingEntryCardView extends CardView {
    private boolean mIsAlwaysExpanded;
    /** The ViewGroup to run the expand/collapse animation on */
    private ViewGroup mAnimationViewGroup;
    private LinearLayout mBadgeContainer;
    private final List<ImageView> mBadges;
    private final List<Integer> mBadgeIds;
    private final int mDividerLineHeightPixels;
    /**
     * List to hold the separators. This saves us from reconstructing every expand/collapse and
@@ -304,12 +301,8 @@ public class ExpandingEntryCardView extends CardView {
        mExpandCollapseTextView = (TextView) mExpandCollapseButton.findViewById(R.id.text);
        mExpandCollapseArrow = (ImageView) mExpandCollapseButton.findViewById(R.id.arrow);
        mExpandCollapseButton.setOnClickListener(mExpandCollapseButtonListener);
        mBadgeContainer = (LinearLayout) mExpandCollapseButton.findViewById(R.id.badge_container);
        mDividerLineHeightPixels = getResources()
                .getDimensionPixelSize(R.dimen.divider_line_height);

        mBadges = new ArrayList<ImageView>();
        mBadgeIds = new ArrayList<Integer>();
    }

    /**
@@ -773,49 +766,9 @@ public class ExpandingEntryCardView extends CardView {
            animator.setDuration(duration);
            animator.start();
        }
        updateBadges();

        mExpandCollapseTextView.setText(buttonText);
    }

    private void updateBadges() {
        if (mIsExpanded) {
            mBadgeContainer.removeAllViews();
        } else {
            int numberOfMimeTypesShown = mCollapsedEntriesCount;

            // Inflate badges if not yet created
            if (mBadges.size() < mEntries.size() - numberOfMimeTypesShown) {
                for (int i = numberOfMimeTypesShown; i < mEntries.size(); i++) {
                    Drawable badgeDrawable = mEntries.get(i).get(0).getIcon();
                    int badgeResourceId = mEntries.get(i).get(0).getIconResourceId();
                    // Do not add the same badge twice
                    if (badgeResourceId != 0 && mBadgeIds.contains(badgeResourceId)) {
                        continue;
                    }
                    if (badgeDrawable != null) {
                        ImageView badgeView = new ImageView(getContext());
                        LinearLayout.LayoutParams badgeViewParams = new LinearLayout.LayoutParams(
                                (int) getResources().getDimension(
                                        R.dimen.expanding_entry_card_item_icon_width),
                                (int) getResources().getDimension(
                                        R.dimen.expanding_entry_card_item_icon_height));
                        badgeViewParams.setMarginEnd((int) getResources().getDimension(
                                R.dimen.expanding_entry_card_badge_separator_margin));
                        badgeView.setLayoutParams(badgeViewParams);
                        badgeView.setImageDrawable(badgeDrawable);
                        mBadges.add(badgeView);
                        mBadgeIds.add(badgeResourceId);
                    }
                }
            }
            mBadgeContainer.removeAllViews();
            for (ImageView badge : mBadges) {
                mBadgeContainer.addView(badge);
            }
        }
    }

    private void expand() {
        ChangeBounds boundsTransition = new ChangeBounds();
        boundsTransition.setDuration(DURATION_EXPAND_ANIMATION_CHANGE_BOUNDS);