package com.gh.common.util;

import com.contrarywind.adapter.WheelAdapter;

/**
 * 注意：选择后的数据其实是dates的position，需要在回调时对返回的date数据进行转换
 * <p>
 * 例子请见：
 * {@link com.gh.gamecenter.servers.add.AddKaiFuActivity}
 */
public class HaloWheelViewAdapter implements WheelAdapter {
    private int[] dates;


    public HaloWheelViewAdapter(int[] dates) {
        this.dates = dates;
    }

    @Override
    public Object getItem(int index) {
        return dates[index];
    }

    @Override
    public int getItemsCount() {
        return dates.length;
    }

    @Override
    public int indexOf(Object o) {
        try {
            return (int) o;
        } catch (Exception e) {
            return -1;
        }
    }
}
