package cn.dankal.yunlaboratory.ui.dialog;

import android.content.Context;
import android.view.Gravity;
import android.view.View;

import cn.dankal.basiclib.widget.dialog.BaseDialog;
import cn.dankal.basiclib.widget.dialog.CustomDialog;
import cn.dankal.basiclib.widget.wheelview.WheelView;
import cn.dankal.basiclib.widget.wheelview.adapters.ArrayWheelAdapter;
import cn.dankal.yunlaboratory.R;

public class ChooseItemDialog extends BaseDialog {
    private WheelView wheelView;

    public ChooseItemDialog(Context context) {
        super(context);
    }

    @Override
    public void initDialog() {
        dialog = new CustomDialog.Builder(context).widthpx(-1).heightdp(300).gravity(Gravity.BOTTOM).view(R.layout.choose_item_wheel).build();

        wheelView = (WheelView) dialog.getView(R.id.wheel_view);

        dialog.addViewOnclick(R.id.tv_negative, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });


    }

    public void setData(String[] title) {
        wheelView.setViewAdapter(new ArrayWheelAdapter<String>(context, title));
    }

    public int getCurrentItem() {
        return wheelView.getCurrentItem();
    }
}
