package kz.arta.synergy.workflow.mobile.android.users.adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import java.util.List;

import kz.arta.synergy.workflow.mobile.android.R;
import kz.arta.synergy.workflow.mobile.android.common.utils.Fonts;

/**
 * Created by neox on 18.04.14.
 * Адаптер списка выбранных пользователей (теги)
 */
public class AdapterSelectedUsers extends ArrayAdapter<String> {

    private List<String> users;
    private Context context;

    public AdapterSelectedUsers(Context context, List<String> users) {
        super(context, R.layout.user_chooser_activity, users);
        this.context = context;
        this.users = users;
    }

    @Override
    public View getView(int position, View someView, ViewGroup arg2) {
        LayoutInflater inflater = LayoutInflater.from(context);
        if (someView == null) {
            someView = inflater.inflate(R.layout.item_selected_users, arg2, false);
        }
        TextView userPosition = (TextView) someView.findViewById(R.id.name_selected_users);
        userPosition.setText(users.get(position));
        userPosition.setTypeface(Fonts.getMedium(context));
        return someView;
    }
}