Search in sources :

Example 1 with LetterSectionCell

use of org.telegram.ui.Cells.LetterSectionCell in project Telegram-FOSS by Telegram-FOSS-Team.

the class ContactsAdapter method getSectionHeaderView.

@Override
public View getSectionHeaderView(int section, View view) {
    HashMap<String, ArrayList<TLRPC.TL_contact>> usersSectionsDict = onlyUsers == 2 ? ContactsController.getInstance(currentAccount).usersMutualSectionsDict : ContactsController.getInstance(currentAccount).usersSectionsDict;
    ArrayList<String> sortedUsersSectionsArray = onlyUsers == 2 ? ContactsController.getInstance(currentAccount).sortedUsersMutualSectionsArray : ContactsController.getInstance(currentAccount).sortedUsersSectionsArray;
    if (view == null) {
        view = new LetterSectionCell(mContext);
    }
    LetterSectionCell cell = (LetterSectionCell) view;
    if (sortType == 2 || disableSections || isEmpty) {
        cell.setLetter("");
    } else {
        if (onlyUsers != 0 && !isAdmin) {
            if (section < sortedUsersSectionsArray.size()) {
                cell.setLetter(sortedUsersSectionsArray.get(section));
            } else {
                cell.setLetter("");
            }
        } else {
            if (section == 0) {
                cell.setLetter("");
            } else if (section - 1 < sortedUsersSectionsArray.size()) {
                cell.setLetter(sortedUsersSectionsArray.get(section - 1));
            } else {
                cell.setLetter("");
            }
        }
    }
    return view;
}
Also used : ArrayList(java.util.ArrayList) LetterSectionCell(org.telegram.ui.Cells.LetterSectionCell) TLRPC(org.telegram.tgnet.TLRPC)

Aggregations

ArrayList (java.util.ArrayList)1 TLRPC (org.telegram.tgnet.TLRPC)1 LetterSectionCell (org.telegram.ui.Cells.LetterSectionCell)1