package ru.atott.combiq.android.view.adapters;

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

import ru.atott.combiq.android.R;

public class LevelListAdapter extends ArrayAdapter<LevelListAdapter.ItemHolder> {

    private static ItemHolder[] ITEMS = {
            new ItemHolder("D1", "D1 - Junior"),
            new ItemHolder("D2", "D2 - Middle"),
            new ItemHolder("D3", "D3 - Senior")
    };

    public LevelListAdapter(Context context) {
        super(context, R.layout.item_level_list, ITEMS);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = super.getView(position, convertView, parent);

        ItemHolder item = this.getItem(position);

        ((TextView) view.findViewById(R.id.label)).setText(item.getDescription());

        return view;
    }

    public static class ItemHolder {

        private String level;

        private String description;

        public ItemHolder(String level, String description) {
            this.level = level;
            this.description = description;
        }

        public String getLevel() {
            return level;
        }

        public void setLevel(String level) {
            this.level = level;
        }

        public String getDescription() {
            return description;
        }

        public void setDescription(String description) {
            this.description = description;
        }
    }
}
