| | |
| | | import android.widget.EditText;
|
| | | import android.widget.LinearLayout;
|
| | | import android.widget.TextView;
|
| | | import android.widget.Toast;
|
| | |
|
| | | import com.bsk.zhangbo.demoforbsk.R;
|
| | | import com.bsk.zhangbo.demoforbsk.base.BaseFragment;
|
| | | import com.bsk.zhangbo.demoforbsk.com.bsk.zhangbo.demoforbsk.service.DictionaryMng;
|
| | | import com.bsk.zhangbo.demoforbsk.com.bsk.zhangbo.demoforbsk.service.VisitorTypeMng;
|
| | | import com.bsk.zhangbo.demoforbsk.listeners.OkButtonClickedListener;
|
| | | import com.bsk.zhangbo.demoforbsk.widget.BirthdayPickerDialog;
|
| | | import com.bsk.zhangbo.demoforbsk.widget.CountrySelectionPopup;
|
| | | import com.bsk.zhangbo.demoforbsk.widget.SingleSelectionPopup;
|
| | |
|
| | | import org.xutils.http.RequestParams;
|
| | | import org.xutils.x;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import cn.com.basic.face.discern.common.BaseCommonCallBack;
|
| | | import cn.com.basic.face.discern.query.item.VistorTypeQueryItem;
|
| | | import cn.com.basic.face.discern.entity.Person;
|
| | |
|
| | | /**
|
| | | * Created by Administrator on 2017/2/20 0020.
|
| | |
| | | public class RegisterFragment extends BaseFragment implements View.OnClickListener{
|
| | |
|
| | | private View mViewName,mViewSex,mViewNation,mViewBirthday,mViewVisitorClass,mViewPhone,mViewIdClass,mViewIdNumber,mViewCompayName,mViewRemark;
|
| | | private TextView mViewNameTitle,mViewSexTitle,mViewNationTitle,mViewBirthdyTitle,mViewIdClassContent,mViewSexContent,mViewNationContent,mViewBirthdyContent,mViewVisitorClassContent,mViewVisitorClassTitle,mViewPhoneTitle,mViewIdClassTitle,mViewIdNumberTitle,mViewCompanyNameTitle,mViewRemarkTitle;
|
| | | private EditText mViewNameContent,mViewPhoneContent,mViewIdNumberContent,mViewCompanyNameContent,mViewRemarkContent;
|
| | | private List<String> mSexList;
|
| | | private List<String> mVisitorTypeList;
|
| | | private List<String> mCredentialsList;
|
| | | private TextView mViewNameTitle,mViewSexTitle,mViewNationTitle,mViewBirthdyTitle, mViewIdentityTypeContent, mViewGenderContent, mViewCountryContent,mViewBirthdyContent,mViewVisitorClassContent,mViewVisitorClassTitle,mViewPhoneTitle,mViewIdClassTitle,mViewIdNumberTitle,mViewCompanyNameTitle,mViewRemarkTitle;
|
| | | private EditText mViewNameContent,mViewPhoneContent, mViewIdentityContent,mViewCompanyNameContent,mViewRemarkContent;
|
| | | private List mSexList;
|
| | | private List mVisitorTypeList;
|
| | | private List mCredentialsList;
|
| | | private List mNationList;
|
| | | private LinearLayout mBaseLayout;
|
| | | private int mNowYear;
|
| | | private int mNowMonth;
|
| | |
| | | mViewIdNumberTitle = (TextView) mViewIdNumber.findViewById(R.id.register_et_title);
|
| | | mViewCompanyNameTitle = (TextView) mViewCompayName.findViewById(R.id.register_et_title);
|
| | | mViewRemarkTitle = (TextView) mViewRemark.findViewById(R.id.register_et_title);
|
| | | mViewSexContent = (TextView) mViewSex.findViewById(R.id.register_tv_content);
|
| | | mViewNationContent = (TextView) mViewNation.findViewById(R.id.register_tv_content);
|
| | | mViewGenderContent = (TextView) mViewSex.findViewById(R.id.register_tv_content);
|
| | | mViewCountryContent = (TextView) mViewNation.findViewById(R.id.register_tv_content);
|
| | | mViewBirthdyContent= (TextView) mViewBirthday.findViewById(R.id.register_tv_content);
|
| | | mViewVisitorClassContent = (TextView) mViewVisitorClass.findViewById(R.id.register_tv_content);
|
| | | mViewIdClassContent= (TextView) mViewIdClass.findViewById(R.id.register_tv_content);
|
| | | mViewIdentityTypeContent = (TextView) mViewIdClass.findViewById(R.id.register_tv_content);
|
| | |
|
| | |
|
| | | mViewNameContent = (EditText) mViewName.findViewById(R.id.register_et_content);
|
| | | mViewPhoneContent = (EditText) mViewPhone.findViewById(R.id.register_et_content);
|
| | | mViewIdNumberContent = (EditText) mViewIdNumber.findViewById(R.id.register_et_content);
|
| | | mViewIdentityContent = (EditText) mViewIdNumber.findViewById(R.id.register_et_content);
|
| | | mViewCompanyNameContent = (EditText) mViewCompayName.findViewById(R.id.register_et_content);
|
| | | mViewRemarkContent = (EditText) mViewRemark.findViewById(R.id.register_et_content);
|
| | |
|
| | |
| | | mNowDay = calendar.get(Calendar.DAY_OF_MONTH);
|
| | | }
|
| | |
|
| | | public void save() {
|
| | | Person person = new Person();
|
| | | // person.setBirthday(mViewBirthdyContent.getText());
|
| | | person.setName(mViewNameContent.getText().toString());
|
| | | person.setPhone(mViewPhoneContent.getText().toString());
|
| | | person.setGender(DictionaryMng.getInstance().getId(mViewGenderContent.getText().toString()));
|
| | | person.setIdentityType(DictionaryMng.getInstance().getId(mViewIdentityTypeContent.getText().toString()));
|
| | | person.setCountry(DictionaryMng.getInstance().getId(mViewCountryContent.getText().toString()));
|
| | | person.setIdentify(mViewIdentityContent.getText().toString());
|
| | | person.setBirthday(mViewBirthdyContent.getText().toString());
|
| | | //person.setCompanyId();
|
| | | }
|
| | |
|
| | | @Override
|
| | | protected void initToolbar(Bundle savedInstanceState) {
|
| | |
|
| | |
| | |
|
| | | @Override
|
| | | protected void initData() {
|
| | | RequestParams params = new RequestParams("http://192.168.1.51:8080/ssm/VisitorType/v_list.do");
|
| | | x.http().get(params, new BaseCommonCallBack() {
|
| | | public void success() {
|
| | | List<VistorTypeQueryItem> items = getList(VistorTypeQueryItem.class);
|
| | | mVisitorTypeList = new ArrayList<String>();
|
| | | mViewVisitorClassContent.setText(items.get(0).getLabel());
|
| | | for (VistorTypeQueryItem item : items) {
|
| | | mVisitorTypeList.add(item.getLabel());
|
| | | }
|
| | | }
|
| | |
|
| | | });
|
| | |
|
| | |
|
| | |
|
| | | mSexList = new ArrayList<>();
|
| | | mSexList.add("男");
|
| | | mSexList.add("女");
|
| | |
|
| | | mCredentialsList = new ArrayList<>();
|
| | | mCredentialsList.add("名片");
|
| | | mCredentialsList.add("身份证");
|
| | |
|
| | | mViewIdClassContent.setText(mCredentialsList.get(0));
|
| | | mVisitorTypeList = VisitorTypeMng.mVisitorTypeList;
|
| | | mSexList = DictionaryMng.mSexList;
|
| | | mCredentialsList = DictionaryMng.mCredentialsList;
|
| | | mNationList = DictionaryMng.nationList;
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | case R.id.register_sex:
|
| | | SingleSelectionPopup popup = new SingleSelectionPopup(getActivity(),mSexList,"性别");
|
| | | popup.showAtLocation(mBaseLayout, Gravity.CENTER,0,0);
|
| | | popup.addOkButtonClickedListener(new OkButtonClickedListener() {
|
| | | @Override
|
| | | public void onItemSelected(int position, Object o, String item) {
|
| | | mViewGenderContent.setText(item);
|
| | | }
|
| | | });
|
| | | break;
|
| | | case R.id.register_nation:
|
| | | // Toast.makeText(getActivity(),"中国",Toast.LENGTH_SHORT).show();
|
| | | CountrySelectionPopup countrySelectionPopup = new CountrySelectionPopup(getActivity());
|
| | | countrySelectionPopup.showAtLocation(mBaseLayout, Gravity.CENTER,0,0);
|
| | | countrySelectionPopup.addOkButtonClickedListener(new OkButtonClickedListener() {
|
| | | @Override
|
| | | public void onItemSelected(int position, Object o, String item) {
|
| | | mViewCountryContent.setText(item);
|
| | | }
|
| | | });
|
| | | break;
|
| | | case R.id.register_birthday:
|
| | | // Toast.makeText(getActivity(),"1990-1-1",Toast.LENGTH_SHORT).show();
|
| | | // datePickerDialog.show();
|
| | | showDatePicker();
|
| | | break;
|
| | | case R.id.register_visitor_class:
|
| | |
| | | popup2.addOkButtonClickedListener(new OkButtonClickedListener() {
|
| | | @Override
|
| | | public void onItemSelected(int position, Object o, String item) {
|
| | | mViewIdClassContent.setText(item);
|
| | | mViewIdentityTypeContent.setText(item);
|
| | | }
|
| | | });
|
| | | break;
|
| | |
| | | @Override
|
| | | public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
|
| | | int month=monthOfYear+1;
|
| | | Toast.makeText(
|
| | | getActivity(),
|
| | | year + "-" + month + "-" + dayOfMonth,
|
| | | Toast.LENGTH_SHORT).show();
|
| | | mViewBirthdyContent.setText(year+"-"+month+"-"+dayOfMonth);
|
| | | }
|
| | | },date);
|
| | | myDatePickerDialog.myShow();
|