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

Commit 7d5be056 authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Show star icon explicitly if needed

Bug 30370500
Bug 28426878

Change-Id: Ic7df26dc7926d6efbe1d1ae926dbcd2b019c9935
parent 08ca0463
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -976,14 +976,22 @@ public class ContactListItemView extends ViewGroup
    public void setSectionHeader(String title) {
        if (!TextUtils.isEmpty(title)) {
            if (TextUtils.equals(getContext().getString(R.string.star_sign), title)) {
                if (mHeaderView == null || mHeaderView instanceof TextView) {
                if (mHeaderView == null) {
                    addStarImageHeader();
                } else if (mHeaderView instanceof TextView) {
                    removeView(mHeaderView);
                    addStarImageHeader();
                } else {
                    mHeaderView.setVisibility(View.VISIBLE);
                }
            } else {
                if (mHeaderView == null || mHeaderView instanceof ImageView ) {
                if (mHeaderView == null) {
                    addTextHeader(title);
                } else if (mHeaderView instanceof ImageView) {
                    removeView(mHeaderView);
                    addTextHeader(title);
                } else {
                    updateHeaderText(((TextView) mHeaderView), title);
                    updateHeaderText((TextView) mHeaderView, title);
                }
            }
        } else if (mHeaderView != null) {
@@ -992,9 +1000,8 @@ public class ContactListItemView extends ViewGroup
    }

    private void addTextHeader(String title) {
        removeView(mHeaderView);
        mHeaderView = new TextView(getContext());
        final TextView headerTextView = ((TextView) mHeaderView);
        final TextView headerTextView = (TextView) mHeaderView;
        headerTextView.setTextAppearance(getContext(), R.style.SectionHeaderStyle);
        headerTextView.setGravity(Gravity.CENTER_HORIZONTAL);
        updateHeaderText(headerTextView, title);
@@ -1014,9 +1021,8 @@ public class ContactListItemView extends ViewGroup
    }

    private void addStarImageHeader() {
        removeView(mHeaderView);
        mHeaderView = new ImageView(getContext());
        final ImageView headerImageView = ((ImageView) mHeaderView);
        final ImageView headerImageView = (ImageView) mHeaderView;
        headerImageView.setImageDrawable(
                getResources().getDrawable(R.drawable.ic_material_star, getContext().getTheme()));
        headerImageView.setImageTintList(ColorStateList.valueOf(getResources()