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

Commit 2ed2a73d authored by Paul Soulos's avatar Paul Soulos
Browse files

Fixes text overlapping secondary icon

Bug: 16858313
Change-Id: I64f535b8f803ebb9e60ce3337aa1f64e995f2222
parent fa238949
Loading
Loading
Loading
Loading
+27 −11
Original line number Original line Diff line number Diff line
@@ -67,7 +67,7 @@ public class ExpandingEntryCardView extends CardView {
     */
     */
    public static final class Entry {
    public static final class Entry {


        private final int mViewId;
        private final int mId;
        private final Drawable mIcon;
        private final Drawable mIcon;
        private final String mHeader;
        private final String mHeader;
        private final String mSubHeader;
        private final String mSubHeader;
@@ -82,21 +82,21 @@ public class ExpandingEntryCardView extends CardView {
        private final boolean mIsEditable;
        private final boolean mIsEditable;
        private final EntryContextMenuInfo mEntryContextMenuInfo;
        private final EntryContextMenuInfo mEntryContextMenuInfo;


        public Entry(int viewId, Drawable icon, String header, String subHeader, String text,
        public Entry(int id, Drawable icon, String header, String subHeader, String text,
                Intent intent, Drawable alternateIcon, Intent alternateIntent,
                Intent intent, Drawable alternateIcon, Intent alternateIntent,
                String alternateContentDescription, boolean shouldApplyColor,
                String alternateContentDescription, boolean shouldApplyColor,
                boolean isEditable, EntryContextMenuInfo entryContextMenuInfo) {
                boolean isEditable, EntryContextMenuInfo entryContextMenuInfo) {
            this(viewId, icon, header, subHeader, null, text, null, intent, alternateIcon,
            this(id, icon, header, subHeader, null, text, null, intent, alternateIcon,
                    alternateIntent, alternateContentDescription, shouldApplyColor, isEditable,
                    alternateIntent, alternateContentDescription, shouldApplyColor, isEditable,
                    entryContextMenuInfo);
                    entryContextMenuInfo);
        }
        }


        public Entry(int viewId, Drawable mainIcon, String header, String subHeader,
        public Entry(int id, Drawable mainIcon, String header, String subHeader,
                Drawable subHeaderIcon, String text, Drawable textIcon, Intent intent,
                Drawable subHeaderIcon, String text, Drawable textIcon, Intent intent,
                Drawable alternateIcon, Intent alternateIntent, String alternateContentDescription,
                Drawable alternateIcon, Intent alternateIntent, String alternateContentDescription,
                boolean shouldApplyColor, boolean isEditable,
                boolean shouldApplyColor, boolean isEditable,
                EntryContextMenuInfo entryContextMenuInfo) {
                EntryContextMenuInfo entryContextMenuInfo) {
            mViewId = viewId;
            mId = id;
            mIcon = mainIcon;
            mIcon = mainIcon;
            mHeader = header;
            mHeader = header;
            mSubHeader = subHeader;
            mSubHeader = subHeader;
@@ -160,8 +160,8 @@ public class ExpandingEntryCardView extends CardView {
            return mIsEditable;
            return mIsEditable;
        }
        }


        int getViewId() {
        int getId() {
            return mViewId;
            return mId;
        }
        }


        EntryContextMenuInfo getEntryContextMenuInfo() {
        EntryContextMenuInfo getEntryContextMenuInfo() {
@@ -491,7 +491,6 @@ public class ExpandingEntryCardView extends CardView {
                R.layout.expanding_entry_card_item, this, false);
                R.layout.expanding_entry_card_item, this, false);


        view.setContextMenuInfo(entry.getEntryContextMenuInfo());
        view.setContextMenuInfo(entry.getEntryContextMenuInfo());
        view.setId(entry.getViewId());


        final ImageView icon = (ImageView) view.findViewById(R.id.icon);
        final ImageView icon = (ImageView) view.findViewById(R.id.icon);
        icon.setVisibility(iconVisibility);
        icon.setVisibility(iconVisibility);
@@ -535,7 +534,7 @@ public class ExpandingEntryCardView extends CardView {


        if (entry.getIntent() != null) {
        if (entry.getIntent() != null) {
            view.setOnClickListener(mOnClickListener);
            view.setOnClickListener(mOnClickListener);
            view.setTag(entry.getIntent());
            view.setTag(new EntryTag(entry.getId(), entry.getIntent()));
        }
        }


        // If only the header is visible, add a top margin to match icon's top margin.
        // If only the header is visible, add a top margin to match icon's top margin.
@@ -555,8 +554,7 @@ public class ExpandingEntryCardView extends CardView {
        if (entry.getAlternateIcon() != null && entry.getAlternateIntent() != null) {
        if (entry.getAlternateIcon() != null && entry.getAlternateIntent() != null) {
            alternateIcon.setImageDrawable(entry.getAlternateIcon());
            alternateIcon.setImageDrawable(entry.getAlternateIcon());
            alternateIcon.setOnClickListener(mOnClickListener);
            alternateIcon.setOnClickListener(mOnClickListener);
            alternateIcon.setTag(entry.getAlternateIntent());
            alternateIcon.setTag(new EntryTag(entry.getId(), entry.getAlternateIntent()));
            alternateIcon.setId(entry.getViewId());
            alternateIcon.setVisibility(View.VISIBLE);
            alternateIcon.setVisibility(View.VISIBLE);
            alternateIcon.setContentDescription(entry.getAlternateContentDescription());
            alternateIcon.setContentDescription(entry.getAlternateContentDescription());


@@ -808,4 +806,22 @@ public class ExpandingEntryCardView extends CardView {
            return mCopyLabel;
            return mCopyLabel;
        }
        }
    }
    }

    static final class EntryTag {
        private final int mId;
        private final Intent mIntent;

        public EntryTag(int id, Intent intent) {
            mId = id;
            mIntent = intent;
        }

        public int getId() {
            return mId;
        }

        public Intent getIntent() {
            return mIntent;
        }
    }
}
}
+10 −8
Original line number Original line Diff line number Diff line
@@ -128,6 +128,7 @@ import com.android.contacts.interactions.ContactInteraction;
import com.android.contacts.interactions.SmsInteractionsLoader;
import com.android.contacts.interactions.SmsInteractionsLoader;
import com.android.contacts.quickcontact.ExpandingEntryCardView.Entry;
import com.android.contacts.quickcontact.ExpandingEntryCardView.Entry;
import com.android.contacts.quickcontact.ExpandingEntryCardView.EntryContextMenuInfo;
import com.android.contacts.quickcontact.ExpandingEntryCardView.EntryContextMenuInfo;
import com.android.contacts.quickcontact.ExpandingEntryCardView.EntryTag;
import com.android.contacts.quickcontact.ExpandingEntryCardView.ExpandingEntryCardViewListener;
import com.android.contacts.quickcontact.ExpandingEntryCardView.ExpandingEntryCardViewListener;
import com.android.contacts.util.ImageViewDrawableSetter;
import com.android.contacts.util.ImageViewDrawableSetter;
import com.android.contacts.util.PhoneCapabilityTester;
import com.android.contacts.util.PhoneCapabilityTester;
@@ -287,18 +288,19 @@ public class QuickContactActivity extends ContactsActivity {
    final OnClickListener mEntryClickHandler = new OnClickListener() {
    final OnClickListener mEntryClickHandler = new OnClickListener() {
        @Override
        @Override
        public void onClick(View v) {
        public void onClick(View v) {
            // Data Id is stored as the entry view id
            final Object entryTagObject = v.getTag();
            final int dataId = v.getId();
            if (entryTagObject == null || !(entryTagObject instanceof EntryTag)) {
            if (dataId == CARD_ENTRY_ID_EDIT_CONTACT) {
                Log.w(TAG, "EntryTag was not used correctly");
                editContact();
                return;
                return;
            }
            }
            final Object intentObject = v.getTag();
            final EntryTag entryTag = (EntryTag) entryTagObject;
            if (intentObject == null || !(intentObject instanceof Intent)) {
            final Intent intent = entryTag.getIntent();
                Log.w(TAG, "Intent tag was not used correctly");
            final int dataId = entryTag.getId();

            if (dataId == CARD_ENTRY_ID_EDIT_CONTACT) {
                editContact();
                return;
                return;
            }
            }
            final Intent intent = (Intent) intentObject;


            // Default to USAGE_TYPE_CALL. Usage is summed among all types for sorting each data id
            // Default to USAGE_TYPE_CALL. Usage is summed among all types for sorting each data id
            // so the exact usage type is not necessary in all cases
            // so the exact usage type is not necessary in all cases