| | |
| | |
|
| | | import com.bsk.zhangbo.demoforbsk.R;
|
| | | import cn.com.basic.face.base.MainActivity;
|
| | | import cn.com.basic.face.discern.common.CommonVariables;
|
| | | import cn.com.basic.face.fragment.CheckInFragment;
|
| | | import cn.com.basic.face.service.DictionaryMng;
|
| | | import cn.com.basic.face.util.Constant;
|
| | | import cn.com.basic.face.util.OkClickedListener;
|
| | |
|
| | |
| | | private List list = new ArrayList();
|
| | |
|
| | | public static List visitorTypeList = new ArrayList();
|
| | | public static List attenderTypeList = new ArrayList();
|
| | | public static List genderList = new ArrayList();
|
| | | public static List idTypeList = new ArrayList();
|
| | | public static List visitReasonList = new ArrayList();
|
| | | private static List<String> resolutionList = new ArrayList();
|
| | | private static List<String> protocolList = new ArrayList();
|
| | | private static List<String> cameraBrandList = new ArrayList();
|
| | | private static List<String> departmentDictionaryList = new ArrayList();
|
| | | private static List<String> postDictionaryList = new ArrayList();
|
| | | private int type;
|
| | |
|
| | | public static void setVisitorTypeList(List visitorTypeList) {
|
| | | SelectDialog.visitorTypeList = visitorTypeList;
|
| | | }
|
| | |
|
| | | public static void setAttenderTypeList(List attenderTypeList) {
|
| | | SelectDialog.attenderTypeList = attenderTypeList;
|
| | | }
|
| | |
|
| | | public static void setGenderList(List genderList) {
|
| | |
| | | SelectDialog.idTypeList = idTypeList;
|
| | | }
|
| | |
|
| | | public SelectDialog(View parentView, int type, OkClickedListener okButtonClickedListener) {
|
| | | public SelectDialog(View parentView, int type, OkClickedListener okButtonClickedListener, String defaultValue) {
|
| | | this.type = type;
|
| | | this.parentView = parentView;
|
| | | View view = LayoutInflater.from(MainActivity.getInstance()).inflate(R.layout.dialog_select,null);
|
| | | ViewUtils.inject(this, view);
|
| | |
| | | style.textSize = 16;
|
| | | style.holoBorderColor = Color.parseColor("#11c3e3");
|
| | |
|
| | | if(type == Constant.DialogSelectType.VISIT_REASON) {
|
| | | if(type == Constant.DialogSelectType.VISIT_REASON
|
| | | || type == Constant.DialogSelectType.PROTOCOL
|
| | | || type == Constant.DialogSelectType.RESOLUTION
|
| | | || type == Constant.DialogSelectType.CAMERA_BRAND
|
| | | ) {
|
| | | dialog_select_add_separator.setVisibility(View.VISIBLE);
|
| | | dialog_select_add.setVisibility(View.VISIBLE);
|
| | | }
|
| | |
| | | dialog_select_list_view.setSkin(WheelView.Skin.Holo);
|
| | | if (list != null && list.size() > 0) {
|
| | | dialog_select_list_view.setWheelData(list);
|
| | | Object itemObj = list.get(0);
|
| | | if (itemObj instanceof String && defaultValue != null && !"".equals(defaultValue)) {
|
| | | int selected = 0;
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | if (defaultValue.equals(list.get(i))) {
|
| | | selected = i;
|
| | | break;
|
| | | }
|
| | | }
|
| | | dialog_select_list_view.setSelection(selected);
|
| | | }
|
| | | }
|
| | | dialog_select_list_view.setWheelSize(5);
|
| | | dialog_select_list_view.setBackgroundResource(R.color.colorBackground);
|
| | |
| | | tile = "请选择访问事由";
|
| | | list = visitReasonList;
|
| | | break;
|
| | | case Constant.DialogSelectType.RESOLUTION:
|
| | | tile = "请选择分辨率";
|
| | | list = resolutionList;
|
| | | break;
|
| | | case Constant.DialogSelectType.PROTOCOL:
|
| | | tile = "请选择通讯";
|
| | | list = protocolList;
|
| | | break;
|
| | | case Constant.DialogSelectType.CAMERA_BRAND:
|
| | | tile = "请选择摄像机品牌";
|
| | | list = cameraBrandList;
|
| | | break;
|
| | | case Constant.DialogSelectType.DEPARTMENT:
|
| | | tile = "请选择部门/班级";
|
| | | list = departmentDictionaryList;
|
| | | break;
|
| | | case Constant.DialogSelectType.POST:
|
| | | tile = "请选择职务";
|
| | | list = postDictionaryList;
|
| | | break;
|
| | | }
|
| | | dialog_select_title.setText(tile);
|
| | | }
|
| | |
| | | public void dialog_select_add_click(View view) {
|
| | | dismiss();
|
| | | Toast.makeText(MainActivity.getInstance(), "添加", Toast.LENGTH_SHORT);
|
| | | new AddDialog(parentView, Constant.DialogSelectType.VISIT_REASON_ADD, new OkClickedListener() {
|
| | | new AddDialog(parentView, type, new OkClickedListener() {
|
| | | public void onSelected(String value) {
|
| | | CheckInFragment.getInstance().setVisitReasonText(value);
|
| | | switch (type) {
|
| | | case Constant.DialogSelectType.VISIT_REASON:
|
| | | CheckInFragment.getInstance().setVisitReasonText(value);
|
| | | break;
|
| | | case Constant.DialogSelectType.RESOLUTION:
|
| | | DictionaryMng.getInstance().addDictionary(Constant.DialogSelectType.RESOLUTION, CommonVariables.DictionaryType.RESOLUTION, value);
|
| | | break;
|
| | | case Constant.DialogSelectType.PROTOCOL:
|
| | | DictionaryMng.getInstance().addDictionary(Constant.DialogSelectType.PROTOCOL, CommonVariables.DictionaryType.PROTOCOL, value);
|
| | | break;
|
| | | case Constant.DialogSelectType.CAMERA_BRAND:
|
| | | DictionaryMng.getInstance().addDictionary(Constant.DialogSelectType.CAMERA_BRAND, CommonVariables.DictionaryType.CAMERA_BRAND, value);
|
| | | break;
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | SelectDialog.visitReasonList = visitReasonList;
|
| | | }
|
| | |
|
| | | public static void setResolutionList(List<String> resolutionList) {
|
| | | SelectDialog.resolutionList = resolutionList;
|
| | | }
|
| | |
|
| | | public static void setProtocolList(List<String> protocolList) {
|
| | | SelectDialog.protocolList = protocolList;
|
| | | }
|
| | |
|
| | | public static void setCameraBrandList(List<String> cameraBrandList) {
|
| | | SelectDialog.cameraBrandList = cameraBrandList;
|
| | | }
|
| | |
|
| | | public static void setDepartmentDictionaryList(List<String> departmentDictionaryList) {
|
| | | SelectDialog.departmentDictionaryList = departmentDictionaryList;
|
| | | }
|
| | |
|
| | | public static void setPostDictionaryList(List<String> postDictionaryList) {
|
| | | SelectDialog.postDictionaryList = postDictionaryList;
|
| | | }
|
| | |
|
| | |
|
| | | public static class WheelAdapter extends BaseWheelAdapter<String> {
|
| | | private Context mContext;
|