47 lines
1.4 KiB
Java
47 lines
1.4 KiB
Java
package com.arpa.hndahesudintocctmsdriver.util;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.view.View;
|
|
|
|
import com.arpa.hndahesudintocctmsdriver.R;
|
|
import com.github.gzuliyujiang.wheelpicker.OptionPicker;
|
|
import com.github.gzuliyujiang.wheelpicker.contract.OnOptionPickedListener;
|
|
import com.github.gzuliyujiang.wheelpicker.widget.OptionWheelLayout;
|
|
import com.github.gzuliyujiang.wheelview.contract.TextProvider;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
/**
|
|
* @ClassName PickerUtils
|
|
* @Author 用户
|
|
* @Date 2022/4/22 16:29
|
|
* @Description TODO
|
|
*/
|
|
public class PickerUtils<T extends TextProvider> {
|
|
|
|
private static class SingletonHolder {
|
|
private static final PickerUtils INSTANCE = new PickerUtils();
|
|
}
|
|
|
|
private PickerUtils() {
|
|
}
|
|
|
|
public static final PickerUtils getInstance() {
|
|
return SingletonHolder.INSTANCE;
|
|
}
|
|
|
|
public void pickSingle(Activity activity, String title, ArrayList<T> data, OnOptionPickedListener listener){
|
|
OptionPicker picker = new OptionPicker(activity);
|
|
picker.setTitle(title);
|
|
// picker.setBodyWidth(140);
|
|
picker.setData(data);
|
|
// picker.setDefaultPosition(2);
|
|
picker.setOnOptionPickedListener(listener);
|
|
// OptionWheelLayout wheelLayout = picker.getWheelLayout();
|
|
|
|
// picker.getWheelView().setStyle(R.style.WheelStyleDemo);
|
|
picker.show();
|
|
}
|
|
}
|