<commit_before>package im.actor.messenger.app.fragment.chat;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;

import im.actor.messenger.R;
import im.actor.messenger.app.util.Screen;
import im.actor.messenger.app.util.TextUtils;
import im.actor.messenger.app.view.AvatarView;
import im.actor.messenger.app.view.HolderAdapter;
import im.actor.messenger.app.view.OnItemClickedListener;
import im.actor.messenger.app.view.SearchHighlight;
import im.actor.messenger.app.view.ViewHolder;
import im.actor.model.entity.GroupMember;
import im.actor.model.viewmodel.UserVM;

import static im.actor.messenger.app.Core.users;

/**
 * Created by ex3ndr on 07.10.14.
 */
public class MentionsAdapter extends HolderAdapter<GroupMember> {
    private GroupMember[] membersToShow;
    private GroupMember[] allMembers;
    private HashMap<String, GroupMember> searchMap;
    private String query;
    MentionsUpdatedCallback updatedCallback;
    private int highlightColor;

    public MentionsAdapter(Collection<GroupMember> members, Context context, MentionsUpdatedCallback updatedCallback, boolean initEmpty) {
        super(context);
        highlightColor = context.getResources().getColor(R.color.primary);

        this.allMembers = members.toArray(new GroupMember[0]);
        this.membersToShow = initEmpty?new GroupMember[]{}:allMembers;
        searchMap = new HashMap<String, GroupMember>();
        this.updatedCallback = updatedCallback;
        String userName;
        for(GroupMember m:members){
            userName = users().get(m.getUid()).getName().get();
            String[] userNameSplit = userName.split("\\s+");
            String initials = "";
            for (int i = 0; i < userNameSplit.length; i++) {
                initials+=userNameSplit[i].charAt(0);
            }
            searchMap.put(initials.toLowerCase(),m);
            searchMap.put(userName.toLowerCase(),m);

            searchMap.put(TextUtils.transliterate(initials.toLowerCase()),m);
            searchMap.put(TextUtils.transliterate(userName.toLowerCase()), m);
        }
    }



    public void updateUid(Collection<GroupMember> members) {<commit_msg>android(fix) remove current user from mentions<commit_after>package im.actor.messenger.app.fragment.chat;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;

import im.actor.messenger.R;
import im.actor.messenger.app.util.Screen;
import im.actor.messenger.app.util.TextUtils;
import im.actor.messenger.app.view.AvatarView;
import im.actor.messenger.app.view.HolderAdapter;
import im.actor.messenger.app.view.OnItemClickedListener;
import im.actor.messenger.app.view.SearchHighlight;
import im.actor.messenger.app.view.ViewHolder;
import im.actor.model.entity.GroupMember;
import im.actor.model.viewmodel.UserVM;

import static im.actor.messenger.app.Core.myUid;
import static im.actor.messenger.app.Core.users;

/**
 * Created by ex3ndr on 07.10.14.
 */
public class MentionsAdapter extends HolderAdapter<GroupMember> {
    private GroupMember[] membersToShow;
    private GroupMember[] allMembers;
    private HashMap<String, GroupMember> searchMap;
    private String query;
    MentionsUpdatedCallback updatedCallback;
    private int highlightColor;

    public MentionsAdapter(Collection<GroupMember> members, Context context, MentionsUpdatedCallback updatedCallback, boolean initEmpty) {
        super(context);
        highlightColor = context.getResources().getColor(R.color.primary);
        GroupMember currentUser = null;
        for(GroupMember m:members){
            if(m.getUid()==myUid())currentUser = m;
        }
        if(currentUser!=null)members.remove(currentUser);
        this.allMembers = members.toArray(new GroupMember[0]);
        this.membersToShow = initEmpty?new GroupMember[]{}:allMembers;
        searchMap = new HashMap<String, GroupMember>();
        this.updatedCallback = updatedCallback;
        String userName;
        for(GroupMember m:members){
            userName = users().get(m.getUid()).getName().get();
            String[] userNameSplit = userName.split("\\s+");
            String initials = "";
            for (int i = 0; i < userNameSplit.length; i++) {
                initials+=userNameSplit[i].charAt(0);
            }
            searchMap.put(initials.toLowerCase(),m);
            searchMap.put(userName.toLowerCase(),m);

            searchMap.put(TextUtils.transliterate(initials.toLowerCase()),m);
            searchMap.put(TextUtils.transliterate(userName.toLowerCase()), m);
        }
    }



    public void updateUid(Collection<GroupMember> members) {
{'fraction_non_alphanumeric': 0.1160912578235413, 'fraction_numerical': 0.004037956793862305, 'mean_word_length': 3.700189753320683, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7064063', 'n_tokens_mistral': 1458, 'n_tokens_neox': 1420, 'n_words': 260}