Example usage for android.graphics Typeface NORMAL

List of usage examples for android.graphics Typeface NORMAL

Introduction

In this page you can find the example usage for android.graphics Typeface NORMAL.

Prototype

int NORMAL

To view the source code for android.graphics Typeface NORMAL.

Click Source Link

Usage

From source file:devlight.io.library.ntb.NavigationTabBar.java

protected void setBadgeTypeface() {
    mBadgePaint
            .setTypeface(mIsBadgeUseTypeface ? mTypeface : Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
}

From source file:com.andexert.calendarlistview.library.SimpleMonthView.java

protected void initView() {
    mMonthTitlePaint = new Paint();
    //        mMonthTitlePaint.setFakeBoldText(true);
    mMonthTitlePaint.setAntiAlias(true);
    mMonthTitlePaint.setTextSize(MONTH_LABEL_TEXT_SIZE);
    //        mMonthTitlePaint.setTypeface(Typeface.create(mMonthTitleTypeface, Typeface.BOLD));
    mMonthTitlePaint.setColor(mMonthTextColor);
    mMonthTitlePaint.setTextAlign(Align.CENTER);
    mMonthTitlePaint.setStyle(Style.FILL);

    mMonthTitleBGPaint = new Paint();
    mMonthTitleBGPaint.setFakeBoldText(true);
    mMonthTitleBGPaint.setAntiAlias(true);
    mMonthTitleBGPaint.setColor(mMonthTitleBGColor);
    mMonthTitleBGPaint.setTextAlign(Align.CENTER);
    mMonthTitleBGPaint.setStyle(Style.FILL);

    mSelectedCirclePaint = new Paint();
    mSelectedCirclePaint.setFakeBoldText(true);
    mSelectedCirclePaint.setAntiAlias(true);
    mSelectedCirclePaint.setColor(mSelectedDaysColor);
    mSelectedCirclePaint.setTextAlign(Align.CENTER);
    mSelectedCirclePaint.setStyle(Style.FILL);
    //        mSelectedCirclePaint.setAlpha(SELECTED_CIRCLE_ALPHA);

    mMonthDayLabelPaint = new Paint();
    mMonthDayLabelPaint.setAntiAlias(true);
    mMonthDayLabelPaint.setTextSize(MONTH_DAY_LABEL_TEXT_SIZE);
    mMonthDayLabelPaint.setColor(mDayTextColor);
    mMonthDayLabelPaint.setTypeface(Typeface.create(mDayOfWeekTypeface, Typeface.NORMAL));
    mMonthDayLabelPaint.setStyle(Style.FILL);
    mMonthDayLabelPaint.setTextAlign(Align.CENTER);
    mMonthDayLabelPaint.setFakeBoldText(true);

    mMonthNumPaint = new Paint();
    mMonthNumPaint.setAntiAlias(true);/*from   w  w w .  ja  v a2s .co  m*/
    mMonthNumPaint.setTextSize(MINI_DAY_NUMBER_TEXT_SIZE);
    mMonthNumPaint.setStyle(Style.FILL);
    mMonthNumPaint.setTextAlign(Align.CENTER);
    //        mMonthNumPaint.setFakeBoldText(false);

    mMonthNumLinePaint = new Paint();
    mMonthNumLinePaint.setAntiAlias(true);
    mMonthNumLinePaint.setStrokeWidth(getResources().getDimensionPixelSize(R.dimen.month_day_line_width));
    mMonthNumLinePaint.setColor(ContextCompat.getColor(getContext(), R.color.month_num_line));
}

From source file:com.android.argb.edhlc.Utils.java

public static void createRecordListElement(View parent, Record currentRecord, String highlightedPlayerName) {
    RelativeLayout selectedRecord = (RelativeLayout) parent.findViewById(R.id.selectedRecord);
    selectedRecord.setVisibility(currentRecord.isSelected() ? View.VISIBLE : View.GONE);

    TextView textDateRecordCard = (TextView) parent.findViewById(R.id.textDateRecordCard);
    LinearLayout linearFirstLineRecordCard = (LinearLayout) parent.findViewById(R.id.linearFirstLineRecordCard);
    TextView textFirstIndicatorRecordCard = (TextView) parent.findViewById(R.id.textFirstIndicatorRecordCard);
    TextView textFirstPlayerRecordCard = (TextView) parent.findViewById(R.id.textFirstPlayerRecordCard);
    TextView textFirstDeckRecordCard = (TextView) parent.findViewById(R.id.textFirstDeckRecordCard);

    View divider1RecordCard = parent.findViewById(R.id.divider1RecordCard);

    LinearLayout linearSecondLineRecordCard = (LinearLayout) parent
            .findViewById(R.id.linearSecondLineRecordCard);
    TextView textSecondIndicatorRecordCard = (TextView) parent.findViewById(R.id.textSecondIndicatorRecordCard);
    TextView textSecondPlayerRecordCard = (TextView) parent.findViewById(R.id.textSecondPlayerRecordCard);
    TextView textSecondDeckRecordCard = (TextView) parent.findViewById(R.id.textSecondDeckRecordCard);

    View divider2RecordCard = parent.findViewById(R.id.divider2RecordCard);

    LinearLayout linearThirdLineRecordCard = (LinearLayout) parent.findViewById(R.id.linearThirdLineRecordCard);
    TextView textThirdIndicatorRecordCard = (TextView) parent.findViewById(R.id.textThirdIndicatorRecordCard);
    TextView textThirdPlayerRecordCard = (TextView) parent.findViewById(R.id.textThirdPlayerRecordCard);
    TextView textThirdDeckRecordCard = (TextView) parent.findViewById(R.id.textThirdDeckRecordCard);

    View divider3RecordCard = parent.findViewById(R.id.divider3RecordCard);

    LinearLayout linearFourthLineRecordCard = (LinearLayout) parent
            .findViewById(R.id.linearFourthLineRecordCard);
    TextView textFourthIndicatorRecordCard = (TextView) parent.findViewById(R.id.textFourthIndicatorRecordCard);
    TextView textFourthPlayerRecordCard = (TextView) parent.findViewById(R.id.textFourthPlayerRecordCard);
    TextView textFourthDeckRecordCard = (TextView) parent.findViewById(R.id.textFourthDeckRecordCard);

    Typeface typefaceMedium = Typeface.create("sans-serif-medium", Typeface.NORMAL);
    Typeface typefaceNormal = Typeface.create("sans-serif", Typeface.NORMAL);
    int colorAccent = ContextCompat.getColor(parent.getContext(), R.color.accent_color);
    int colorSecondary = ContextCompat.getColor(parent.getContext(), R.color.secondary_text);

    textDateRecordCard.setText(String.format("Played on %s", currentRecord.getDate()));

    switch (currentRecord.getTotalPlayers()) {
    case 2://from ww  w  . j  av a 2 s  .  co m
        linearFirstLineRecordCard.setVisibility(View.VISIBLE);
        linearSecondLineRecordCard.setVisibility(View.VISIBLE);
        linearThirdLineRecordCard.setVisibility(View.GONE);
        linearFourthLineRecordCard.setVisibility(View.GONE);

        divider1RecordCard.setVisibility(View.VISIBLE);
        divider2RecordCard.setVisibility(View.GONE);
        divider3RecordCard.setVisibility(View.GONE);

        textFirstDeckRecordCard.setText(currentRecord.getFirstPlace().getDeckName());
        textFirstPlayerRecordCard.setText(currentRecord.getFirstPlace().getDeckOwnerName());

        textSecondDeckRecordCard.setText(currentRecord.getSecondPlace().getDeckName());
        textSecondPlayerRecordCard.setText(currentRecord.getSecondPlace().getDeckOwnerName());

        if (highlightedPlayerName != null) {
            textFirstDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textFirstIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textSecondDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textSecondIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
        }
        break;

    case 3:
        linearFirstLineRecordCard.setVisibility(View.VISIBLE);
        linearSecondLineRecordCard.setVisibility(View.VISIBLE);
        linearThirdLineRecordCard.setVisibility(View.VISIBLE);
        linearFourthLineRecordCard.setVisibility(View.GONE);

        divider1RecordCard.setVisibility(View.VISIBLE);
        divider2RecordCard.setVisibility(View.VISIBLE);
        divider3RecordCard.setVisibility(View.GONE);

        textFirstDeckRecordCard.setText(currentRecord.getFirstPlace().getDeckName());
        textFirstPlayerRecordCard.setText(currentRecord.getFirstPlace().getDeckOwnerName());

        textSecondDeckRecordCard.setText(currentRecord.getSecondPlace().getDeckName());
        textSecondPlayerRecordCard.setText(currentRecord.getSecondPlace().getDeckOwnerName());

        textThirdDeckRecordCard.setText(currentRecord.getThirdPlace().getDeckName());
        textThirdPlayerRecordCard.setText(currentRecord.getThirdPlace().getDeckOwnerName());

        if (highlightedPlayerName != null) {
            textFirstDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textFirstIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textSecondDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textSecondIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textThirdDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textThirdPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textThirdIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textThirdIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
        }
        break;

    case 4:
        linearFirstLineRecordCard.setVisibility(View.VISIBLE);
        linearSecondLineRecordCard.setVisibility(View.VISIBLE);
        linearThirdLineRecordCard.setVisibility(View.VISIBLE);
        linearFourthLineRecordCard.setVisibility(View.VISIBLE);

        divider1RecordCard.setVisibility(View.VISIBLE);
        divider2RecordCard.setVisibility(View.VISIBLE);
        divider3RecordCard.setVisibility(View.VISIBLE);

        textFirstDeckRecordCard.setText(currentRecord.getFirstPlace().getDeckName());
        textFirstPlayerRecordCard.setText(currentRecord.getFirstPlace().getDeckOwnerName());

        textSecondDeckRecordCard.setText(currentRecord.getSecondPlace().getDeckName());
        textSecondPlayerRecordCard.setText(currentRecord.getSecondPlace().getDeckOwnerName());

        textThirdDeckRecordCard.setText(currentRecord.getThirdPlace().getDeckName());
        textThirdPlayerRecordCard.setText(currentRecord.getThirdPlace().getDeckOwnerName());

        textFourthDeckRecordCard.setText(currentRecord.getFourthPlace().getDeckName());
        textFourthPlayerRecordCard.setText(currentRecord.getFourthPlace().getDeckOwnerName());

        if (highlightedPlayerName != null) {
            textFirstDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textFirstIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textSecondDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textSecondIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textThirdDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textThirdPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textThirdIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textThirdIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textFourthDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFourthPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFourthPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFourthPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFourthIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFourthPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textFourthIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFourthPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
        }
        break;
    }
}

From source file:com.eurotong.orderhelperandroid.OrderMenuActivity.java

void SetStyleForOrderedMenu(VMMenulistOrder menu, TextView textViewOrderCount) {
    if (menu.OrderCount > 0) {
        textViewOrderCount.setTextColor(Color.RED);
        //textViewOrderCount.setTextSize((float) (textCountSize*1.5));
        //textViewOrderCount.setTextSize((float) (textCountSize));
        textViewOrderCount.setTypeface(null, Typeface.BOLD);
    } else {/*from www .ja va 2s .c  o m*/
        textViewOrderCount.setTextColor(Color.BLACK);
        //textViewOrderCount.setTextSize((float) (textCountSize));
        textViewOrderCount.setTypeface(null, Typeface.NORMAL);
    }
}

From source file:org.wikipedia.edit.EditSectionActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_edit_section, menu);
    MenuItem item = menu.findItem(R.id.menu_save_section);

    if (editSummaryFragment.isActive()) {
        item.setTitle(getString(R.string.edit_next));
    } else if (editPreviewFragment.isActive()) {
        item.setTitle(getString(R.string.edit_done));
    } else {//from   w  w w. ja va2s. c o m
        item.setTitle(getString(R.string.edit_next));
    }

    if (abusefilterEditResult != null) {
        if (abusefilterEditResult.getType() == EditAbuseFilterResult.TYPE_ERROR) {
            item.setEnabled(false);
        } else {
            item.setEnabled(true);
        }
    } else {
        item.setEnabled(sectionTextModified);
    }

    View v = getLayoutInflater().inflate(R.layout.item_edit_actionbar_button, null);
    item.setActionView(v);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    v.setLayoutParams(params);
    TextView txtView = v.findViewById(R.id.edit_actionbar_button_text);
    txtView.setText(item.getTitle());
    txtView.setTypeface(null, item.isEnabled() ? Typeface.BOLD : Typeface.NORMAL);
    v.setTag(item);
    v.setClickable(true);
    v.setEnabled(item.isEnabled());
    v.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            onOptionsItemSelected((MenuItem) view.getTag());
        }
    });

    v.setBackgroundColor(ContextCompat.getColor(this,
            item.isEnabled()
                    ? (editPreviewFragment.isActive() ? R.color.accent50
                            : ResourceUtil.getThemedAttributeId(this, R.attr.colorAccent))
                    : R.color.base50));

    return true;
}

From source file:org.appcelerator.titanium.util.TiUIHelper.java

@SuppressLint("DefaultLocale")
private static Typeface loadTypeface(final Context context, final String fontFamily) {
    if (context == null) {
        return null;
    }/*from   w  w w .j a  va2 s.co  m*/
    if (mCustomTypeFaces.containsKey(fontFamily)) {
        return mCustomTypeFaces.get(fontFamily);
    }
    if (mCustomTypeFacesList == null) {
        AssetManager mgr = context.getAssets();
        try {
            ArrayList<String> fileList = new ArrayList<String>(Arrays.asList(mgr.list(customFontPath)));
            Iterator it = fileList.iterator();
            while (it.hasNext()) {
                String text = (String) it.next();
                if (!text.endsWith(".ttf") && !text.endsWith(".otf")) {
                    it.remove();
                }
            }
            mCustomTypeFacesList = fileList.toArray(new String[] {});
        } catch (Exception e) {
            Log.e(TAG, "Unable to load 'fonts' assets. Perhaps doesn't exist? " + e.getMessage());
        }
    }
    if (mCustomTypeFacesList != null) {
        Typeface tf = null;
        AssetManager mgr = context.getAssets();
        for (String f : mCustomTypeFacesList) {
            if (f.equals(fontFamily) || f.startsWith(fontFamily + ".") || f.startsWith(fontFamily + "-")) {
                tf = Typeface.createFromAsset(mgr, customFontPath + "/" + f);
                synchronized (mCustomTypeFaces) {
                    mCustomTypeFaces.put(fontFamily, tf);
                }
                return tf;
            }
        }
        tf = Typeface.create(fontFamily, Typeface.NORMAL);
        if (tf != null) {
            synchronized (mCustomTypeFaces) {
                mCustomTypeFaces.put(fontFamily, tf);
            }
            return tf;
        }
    }

    mCustomTypeFaces.put(fontFamily, null);
    return null;
}

From source file:com.github.omadahealth.slidepager.lib.views.ProgressView.java

/**
 * Sets the font type of {@link ViewProgressBinding#progressText}
 *
 * @param selected True for {@link TypefaceType#getDefaultTypeface(Context)} in bold, false for normal
 *///from   w  ww  .  j a  v  a  2 s .  c o  m
public void isSelected(boolean selected) {
    Resources res = getContext().getResources();
    Typeface typeface = TypefaceTextView.getFont(getContext(),
            TypefaceType.getTypeface(TypefaceType.getDefaultTypeface(getContext())).getAssetFileName());
    mBinding.progressText.setTypeface(typeface, selected ? Typeface.BOLD : Typeface.NORMAL);
}

From source file:com.sigilance.CardEdit.MainActivity.java

private void populateSimpleField(int id, String text) {
    TextView textView = findTextViewById(id);
    if (text.equals("") || text.equals(BLANK_FINGERPRINT)) {
        textView.setText(R.string.lbl_empty);
        textView.setTypeface(null, Typeface.ITALIC);
    } else {/*from   w  ww . j  a v  a  2 s  .co m*/
        textView.setText(text);
        textView.setTypeface(null, Typeface.NORMAL);
    }
}

From source file:org.mariotaku.twidere.util.ThemeUtils.java

public static Typeface getUserTypeface(final Context context, final String fontFamily,
        final Typeface defTypeface) {
    if (context == null || Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
        return Typeface.DEFAULT;
    final int fontStyle = defTypeface != null ? defTypeface.getStyle() : Typeface.NORMAL;
    final Typeface tf = Typeface.create(fontFamily, fontStyle);
    if (tf != null)
        return tf;
    return Typeface.create(Typeface.DEFAULT, fontStyle);
}

From source file:im.vector.adapters.VectorRoomSummaryAdapter.java

/**
 * Compute the View that should be used to render the child,
 * given its position and its groups position
 *//* w  w w.  j  ava 2 s .c om*/
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView,
        ViewGroup parent) {
    // sanity check
    if (null == mSummaryListByGroupPosition) {
        return null;
    }
    if (convertView == null) {
        convertView = mLayoutInflater.inflate(mChildLayoutResourceId, parent, false);
    }

    if (!mMxSession.isAlive()) {
        return convertView;
    }

    int roomNameBlack = ThemeUtils.getColor(mContext, R.attr.riot_primary_text_color);
    int fushiaColor = ContextCompat.getColor(mContext, R.color.vector_fuchsia_color);
    int vectorDefaultTimeStampColor = ThemeUtils.getColor(mContext, R.attr.default_text_light_color);
    int vectorGreenColor = ContextCompat.getColor(mContext, R.color.vector_green_color);
    int vectorSilverColor = ContextCompat.getColor(mContext, R.color.vector_silver_color);

    // retrieve the UI items
    ImageView avatarImageView = convertView.findViewById(R.id.room_avatar);
    TextView roomNameTxtView = convertView.findViewById(R.id.roomSummaryAdapter_roomName);
    TextView roomMsgTxtView = convertView.findViewById(R.id.roomSummaryAdapter_roomMessage);
    View bingUnreadMsgView = convertView.findViewById(R.id.bing_indicator_unread_message);
    TextView timestampTxtView = convertView.findViewById(R.id.roomSummaryAdapter_ts);
    View separatorView = convertView.findViewById(R.id.recents_separator);
    View separatorGroupView = convertView.findViewById(R.id.recents_groups_separator_line);
    final View actionView = convertView.findViewById(R.id.roomSummaryAdapter_action);
    final ImageView actionImageView = convertView.findViewById(R.id.roomSummaryAdapter_action_image);
    TextView unreadCountTxtView = convertView.findViewById(R.id.roomSummaryAdapter_unread_count);
    View directChatIcon = convertView.findViewById(R.id.room_avatar_direct_chat_icon);
    View encryptedIcon = convertView.findViewById(R.id.room_avatar_encrypted_icon);

    View invitationView = convertView.findViewById(R.id.recents_groups_invitation_group);
    Button preViewButton = convertView.findViewById(R.id.recents_invite_preview_button);
    Button rejectButton = convertView.findViewById(R.id.recents_invite_reject_button);

    View showMoreView = convertView.findViewById(R.id.roomSummaryAdapter_show_more_layout);
    View actionClickArea = convertView.findViewById(R.id.roomSummaryAdapter_action_click_area);

    // directory management
    if ((mDirectoryGroupPosition == groupPosition) || (mRoomByAliasGroupPosition == groupPosition)) {
        // some items are show
        bingUnreadMsgView.setVisibility(View.INVISIBLE);
        timestampTxtView.setVisibility(View.GONE);
        actionImageView.setVisibility(View.GONE);
        invitationView.setVisibility(View.GONE);
        separatorView.setVisibility(View.GONE);
        separatorGroupView.setVisibility(View.VISIBLE);
        showMoreView.setVisibility(View.VISIBLE);
        actionClickArea.setVisibility(View.GONE);
        unreadCountTxtView.setVisibility(View.GONE);
        directChatIcon.setVisibility(View.GONE);
        encryptedIcon.setVisibility(View.GONE);

        if (mDirectoryGroupPosition == groupPosition) {
            roomNameTxtView.setText(mContext.getResources().getString(R.string.directory_search_results_title));

            if (!TextUtils.isEmpty(mSearchedPattern)) {
                if (null == mMatchedPublicRoomsCount) {
                    roomMsgTxtView
                            .setText(mContext.getResources().getString(R.string.directory_searching_title));
                } else {
                    String value = mMatchedPublicRoomsCount.toString();

                    if (mMatchedPublicRoomsCount >= PublicRoomsManager.PUBLIC_ROOMS_LIMIT) {
                        value = "> " + PublicRoomsManager.PUBLIC_ROOMS_LIMIT;
                    }

                    roomMsgTxtView.setText(
                            mContext.getResources().getQuantityString(R.plurals.directory_search_rooms_for,
                                    mMatchedPublicRoomsCount, value, mSearchedPattern));
                }
            } else {
                if (null == mPublicRoomsCount) {
                    roomMsgTxtView.setText(null);
                } else {
                    roomMsgTxtView.setText(mContext.getResources().getQuantityString(
                            R.plurals.directory_search_rooms, mPublicRoomsCount, mPublicRoomsCount));
                }
            }

            avatarImageView.setImageBitmap(VectorUtils.getAvatar(avatarImageView.getContext(),
                    VectorUtils.getAvatarColor(null), null, true));
        } else {
            roomNameTxtView.setText(mSearchedPattern);
            roomMsgTxtView.setText("");
            avatarImageView.setImageBitmap(VectorUtils.getAvatar(avatarImageView.getContext(),
                    VectorUtils.getAvatarColor(null), "@", true));
        }
        return convertView;
    }

    showMoreView.setVisibility(View.GONE);

    RoomSummary childRoomSummary = mSummaryListByGroupPosition.get(groupPosition).get(childPosition);
    final Room childRoom = mMxSession.getDataHandler().getStore().getRoom(childRoomSummary.getRoomId());
    int unreadMsgCount = childRoomSummary.getUnreadEventsCount();
    int highlightCount = 0;
    int notificationCount = 0;

    if (null != childRoom) {
        highlightCount = childRoom.getHighlightCount();
        notificationCount = childRoom.getNotificationCount();

        if (mMxSession.getDataHandler().getBingRulesManager().isRoomMentionOnly(childRoom.getRoomId())) {
            notificationCount = highlightCount;
        }
    }

    // get last message to be displayed
    CharSequence lastMsgToDisplay = getChildMessageToDisplay(childRoomSummary);

    // display the room avatar
    final String roomName = VectorUtils.getRoomDisplayName(mContext, mMxSession, childRoom);
    VectorUtils.loadRoomAvatar(mContext, mMxSession, avatarImageView, childRoom);

    // display the room name
    roomNameTxtView.setText(roomName);
    roomNameTxtView.setTextColor(roomNameBlack);
    roomNameTxtView.setTypeface(null, (0 != unreadMsgCount) ? Typeface.BOLD : Typeface.NORMAL);

    // display the last message
    roomMsgTxtView.setText(lastMsgToDisplay);

    // set the timestamp
    timestampTxtView.setText(getFormattedTimestamp(childRoomSummary.getLatestReceivedEvent()));
    timestampTxtView.setTextColor(vectorDefaultTimeStampColor);
    timestampTxtView.setTypeface(null, Typeface.NORMAL);

    // set bing view background colour
    int bingUnreadColor;
    if (0 != highlightCount) {
        bingUnreadColor = fushiaColor;
    } else if (0 != notificationCount) {
        bingUnreadColor = vectorGreenColor;
    } else if (0 != unreadMsgCount) {
        bingUnreadColor = vectorSilverColor;
    } else {
        bingUnreadColor = Color.TRANSPARENT;
    }
    bingUnreadMsgView.setBackgroundColor(bingUnreadColor);

    // display the unread badge counter
    if ((0 != notificationCount)) {
        unreadCountTxtView.setVisibility(View.VISIBLE);
        unreadCountTxtView.setText(String.valueOf(notificationCount));
        unreadCountTxtView.setTypeface(null, Typeface.BOLD);
        setUnreadBackground(unreadCountTxtView, bingUnreadColor);
    } else {
        unreadCountTxtView.setVisibility(View.GONE);
    }

    // some items are shown
    boolean isInvited = false;

    if (null != childRoom) {
        isInvited = childRoom.isInvited();
    }

    if (null != childRoom) {
        directChatIcon.setVisibility(
                RoomUtils.isDirectChat(mMxSession, childRoom.getRoomId()) ? View.VISIBLE : View.GONE);
        encryptedIcon.setVisibility(childRoom.isEncrypted() ? View.VISIBLE : View.GONE);
    } else {
        directChatIcon.setVisibility(View.GONE);
        encryptedIcon.setVisibility(View.GONE);
    }

    bingUnreadMsgView.setVisibility(isInvited ? View.INVISIBLE : View.VISIBLE);
    invitationView.setVisibility(isInvited ? View.VISIBLE : View.GONE);

    final String fRoomId = childRoomSummary.getRoomId();

    if (isInvited) {
        actionClickArea.setVisibility(View.GONE);

        preViewButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (null != mListener) {
                    mListener.onPreviewRoom(mMxSession, fRoomId);
                }
            }
        });

        rejectButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (null != mListener) {
                    mListener.onRejectInvitation(mMxSession, fRoomId);
                }
            }
        });

        // display an exclamation mark like the webclient
        unreadCountTxtView.setVisibility(View.VISIBLE);
        unreadCountTxtView.setText("!");
        unreadCountTxtView.setTypeface(null, Typeface.BOLD);
        setUnreadBackground(unreadCountTxtView, fushiaColor);
        timestampTxtView.setVisibility(View.GONE);
        actionImageView.setVisibility(View.GONE);
    } else {

        final boolean isFavorite = groupPosition == mFavouritesGroupPosition;
        final boolean isLowPrior = groupPosition == mLowPriorGroupPosition;

        actionClickArea.setVisibility(View.VISIBLE);
        actionClickArea.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                RoomUtils.displayPopupMenu(mContext, mMxSession, childRoom, actionView, isFavorite, isLowPrior,
                        mMoreActionListener);
            }
        });

        timestampTxtView.setVisibility(mIsSearchMode ? View.INVISIBLE : View.VISIBLE);
        actionImageView.setVisibility(mIsSearchMode ? View.INVISIBLE : View.VISIBLE);
    }

    separatorView.setVisibility(isLastChild ? View.GONE : View.VISIBLE);
    separatorGroupView
            .setVisibility((isLastChild && ((groupPosition + 1) < getGroupCount())) ? View.VISIBLE : View.GONE);

    return convertView;
}