| | |
| | | import android.net.Uri;
|
| | | import android.os.Bundle;
|
| | | import android.provider.MediaStore;
|
| | | import android.view.Gravity;
|
| | | import android.view.View;
|
| | | import android.widget.DatePicker;
|
| | | import android.widget.EditText;
|
| | | import android.widget.ImageView;
|
| | | import android.widget.LinearLayout;
|
| | | import android.widget.TextView;
|
| | | import android.widget.Toast;
|
| | |
|
| | | import com.bsk.zhangbo.demoforbsk.R;
|
| | | import cn.com.basic.face.base.BaseFragment;
|
| | | import cn.com.basic.face.discern.query.item.CheckInQueryItem;
|
| | | import cn.com.basic.face.service.DictionaryMng;
|
| | | import cn.com.basic.face.service.RegisterMng;
|
| | | import cn.com.basic.face.service.VisitorTypeMng;
|
| | | import cn.com.basic.face.listeners.OkButtonClickedListener;
|
| | | import cn.com.basic.face.util.Constant;
|
| | | import cn.com.basic.face.util.OkClickedListener;
|
| | |
|
| | | import cn.com.basic.face.widget.BirthdayPickerDialog;
|
| | | import cn.com.basic.face.widget.CountrySelectionDialog;
|
| | | import cn.com.basic.face.widget.SingleSelectionDialog;
|
| | | import cn.com.basic.face.util.AppApi;
|
| | | import cn.com.basic.face.dialog.DateSelectDialog;
|
| | | import cn.com.basic.face.dialog.CountryDialog;
|
| | | import cn.com.basic.face.widget.register.RegisterRightFieldLabelView;
|
| | | import cn.com.basic.face.widget.register.RegisterRightFieldTextView;
|
| | | import cn.com.basic.face.dialog.SelectDialog;
|
| | |
|
| | | import com.facebook.drawee.view.SimpleDraweeView;
|
| | | import com.lidroid.xutils.ViewUtils;
|
| | | import com.lidroid.xutils.view.annotation.ViewInject;
|
| | | import com.lidroid.xutils.view.annotation.event.OnClick;
|
| | |
| | |
|
| | | import java.io.IOException;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | |
|
| | | import cn.com.basic.face.base.MainActivity;
|
| | | import cn.com.basic.face.discern.entity.Person;
|
| | | import cn.com.basic.face.discern.entity.VisitPersonType;
|
| | |
|
| | | /**
|
| | | * Created by Administrator on 2017/2/20 0020.
|
| | | */
|
| | | //@ContentView(value = R.layout.fragment_register)
|
| | | public class RegisterFragment extends BaseFragment implements View.OnClickListener{
|
| | |
|
| | | private static final int PICK_IMAGE_REQUEST = 1;
|
| | | @ViewInject(value = R.id.register_tv_content, parentId = R.id.register_id_class)
|
| | | private TextView identityTypeTv;
|
| | | private TextView genderTv;
|
| | | private TextView countryTv;
|
| | | private TextView birthdayTv;
|
| | | private TextView isitorvTypeTv;
|
| | | private TextView mViewVisitorClassTitle;
|
| | |
|
| | | private EditText nameEt, phoneEt, identifyEt, companyEt,mViewRemarkContent;
|
| | | private List mSexList;
|
| | | private List mVisitorTypeList;
|
| | | private List mCredentialsList;
|
| | | private LinearLayout mBaseLayout;
|
| | |
|
| | | @ViewInject(R.id.register_name)
|
| | | private View mViewName;
|
| | | private RegisterRightFieldTextView register_name;
|
| | | @ViewInject(R.id.register_gender)
|
| | | private View mViewSex;
|
| | | private RegisterRightFieldLabelView register_gender;
|
| | | @ViewInject(R.id.register_country)
|
| | | private View mViewNation;
|
| | | private RegisterRightFieldLabelView register_country;
|
| | | @ViewInject(R.id.register_birthday)
|
| | | private View mViewBirthday;
|
| | | private RegisterRightFieldLabelView register_birthday;
|
| | | @ViewInject(R.id.register_visitor_class)
|
| | | private View mViewVisitorClass;
|
| | | private RegisterRightFieldLabelView register_visitor_class;
|
| | | @ViewInject(R.id.register_phone)
|
| | | private View mViewPhone;
|
| | | private RegisterRightFieldLabelView register_phone;
|
| | | @ViewInject(R.id.register_id_class)
|
| | | private View mViewIdClass;
|
| | | private RegisterRightFieldLabelView register_id_class;
|
| | | @ViewInject(R.id.register_id_num)
|
| | | private View mViewIdNumber;
|
| | | private RegisterRightFieldLabelView register_id_num;
|
| | | @ViewInject(R.id.register_company)
|
| | | private View mViewCompayName;
|
| | | private RegisterRightFieldLabelView register_company;
|
| | | @ViewInject(R.id.register_remark)
|
| | | private View mViewRemark;
|
| | | private RegisterRightFieldLabelView register_remark;
|
| | | @ViewInject(R.id.fragment_register_choose_photo)
|
| | | private SimpleDraweeView fragment_register_choose_photo;
|
| | | @ViewInject(R.id.fragment_register_update__photo)
|
| | | private ImageView fragment_register_update__photo;
|
| | |
|
| | | private String[] countryWordData;
|
| | | private List<String> countryWordList;
|
| | | private HashMap<String, List<String>> countryData;
|
| | | private static final int PICK_IMAGE_REQUEST = 1;
|
| | | private LinearLayout fragment_register_linear_layout;
|
| | |
|
| | | private static RegisterFragment instance = new RegisterFragment();
|
| | |
|
| | |
| | |
|
| | | @Override
|
| | | protected void initViews(View view, Bundle savedInstanceState) {
|
| | | mBaseLayout = (LinearLayout) view.findViewById(R.id.register_base);
|
| | | ViewUtils.inject(this, mBaseLayout);
|
| | |
|
| | | genderTv = (TextView) mViewSex.findViewById(R.id.register_tv_content);
|
| | | countryTv = (TextView) mViewNation.findViewById(R.id.register_tv_content);
|
| | | birthdayTv= (TextView) mViewBirthday.findViewById(R.id.register_tv_content);
|
| | | isitorvTypeTv = (TextView) mViewVisitorClass.findViewById(R.id.register_tv_content);
|
| | | // mViewIdentityTypeContent = (TextView) mViewIdClass.findViewById(R.id.register_tv_content);
|
| | | nameEt = (EditText) mViewName.findViewById(R.id.register_et_content);
|
| | | phoneEt = (EditText) mViewPhone.findViewById(R.id.register_et_content);
|
| | | identifyEt = (EditText) mViewIdNumber.findViewById(R.id.register_et_content);
|
| | | companyEt = (EditText) mViewCompayName.findViewById(R.id.register_et_content);
|
| | | mViewRemarkContent = (EditText) mViewRemark.findViewById(R.id.register_et_content);
|
| | |
|
| | | ((TextView) mViewName.findViewById(R.id.register_et_title)).setText(R.string.title_name);
|
| | | ((TextView) mViewSex.findViewById(R.id.register_tv_title)).setText(R.string.title_sex);
|
| | | ((TextView) mViewNation.findViewById(R.id.register_tv_title)).setText(R.string.title_nation);
|
| | | ((TextView) mViewBirthday.findViewById(R.id.register_tv_title)).setText(R.string.title_birthday);
|
| | | ((TextView) mViewVisitorClass.findViewById(R.id.register_tv_title)).setText(R.string.title_visitorClass);
|
| | | ((TextView) mViewPhone.findViewById(R.id.register_et_title)).setText(R.string.title_phone);
|
| | | ((TextView) mViewIdClass.findViewById(R.id.register_tv_title)).setText(R.string.title_idClass);
|
| | | ((TextView) mViewIdNumber.findViewById(R.id.register_et_title)).setText(R.string.title_idNumber);
|
| | | ((TextView) mViewCompayName.findViewById(R.id.register_et_title)).setText(R.string.title_companyName);
|
| | | ((TextView) mViewRemark.findViewById(R.id.register_et_title)).setText(R.string.title_remark);
|
| | | fragment_register_linear_layout = (LinearLayout) view.findViewById(R.id.fragment_register_linear_layout);
|
| | | ViewUtils.inject(this, fragment_register_linear_layout);
|
| | | }
|
| | |
|
| | | @OnClick(R.id.register_save)
|
| | | public void registerEdit(View view) {
|
| | | @OnClick(R.id.fragment_register_save)
|
| | | public void fragment_register_save_click(View view) { }
|
| | |
|
| | | }
|
| | |
|
| | | @OnClick(R.id.register_add)
|
| | | public void registerAdd(View v) {
|
| | | @OnClick(R.id.fragment_register_add)
|
| | | public void fragment_register_add_click(View v) {
|
| | | RequestParams params = new RequestParams();
|
| | |
|
| | | params.addBodyParameter(Person.FieldNames.name, nameEt.getText().toString());
|
| | | params.addBodyParameter(Person.FieldNames.phone, phoneEt.getText().toString());
|
| | | params.addBodyParameter(Person.FieldNames.gender, DictionaryMng.getInstance().getId(genderTv.getText().toString()));
|
| | | params.addBodyParameter(Person.FieldNames.identityType, DictionaryMng.getInstance().getId(identityTypeTv.getText().toString()));
|
| | | params.addBodyParameter(Person.FieldNames.country, DictionaryMng.getInstance().getId(countryTv.getText().toString()));
|
| | | params.addBodyParameter(Person.FieldNames.identify, identifyEt.getText().toString());
|
| | | params.addBodyParameter(Person.FieldNames.birthday, birthdayTv.getText().toString());
|
| | | params.addBodyParameter("companyName", companyEt.getText().toString());
|
| | | params.addBodyParameter(Person.FieldNames.name, register_name.getValue());
|
| | | params.addBodyParameter(Person.FieldNames.phone, register_phone.getValue());
|
| | | params.addBodyParameter(Person.FieldNames.gender, DictionaryMng.getInstance().getId(register_gender.getValue()));
|
| | | params.addBodyParameter(Person.FieldNames.identityType, DictionaryMng.getInstance().getId(register_id_class.getValue()));
|
| | | params.addBodyParameter(Person.FieldNames.country, DictionaryMng.getInstance().getId(register_country.getValue()));
|
| | | params.addBodyParameter(Person.FieldNames.identify, register_id_num.getValue());
|
| | | params.addBodyParameter(Person.FieldNames.birthday, register_birthday.getValue());
|
| | | params.addBodyParameter("companyName", register_company.getValue());
|
| | |
|
| | | //visitor_type
|
| | | params.addBodyParameter(VisitPersonType.FieldNames.visitorTypeId, VisitorTypeMng.getInstance().getId(isitorvTypeTv.getText().toString()));
|
| | | //params.addBodyParameter(VisitPersonType.FieldNames.visitorTypeId, VisitorTypeMng.getInstance().getId(isitorvTypeTv.getText().toString()));
|
| | | params.addBodyParameter(VisitPersonType.FieldNames.registerCompanyId, "0");
|
| | |
|
| | | RegisterMng.getInstance().add(params);
|
| | | }
|
| | |
|
| | | @Override
|
| | | protected void initData() {
|
| | | // mVisitorTypeList = VisitorTypeMng.mVisitorTypeList;
|
| | | // mSexList = DictionaryMng.mSexList;
|
| | | // mCredentialsList = DictionaryMng.mCredentialsList;
|
| | | }
|
| | |
|
| | | public void setVisitorTypeList(List visitorTypeList) {
|
| | | this.mVisitorTypeList = visitorTypeList;
|
| | | }
|
| | |
|
| | | public void setSexList(List sexList) {
|
| | | this.mSexList = sexList;
|
| | | }
|
| | |
|
| | | public void setCredentialsList(List credentialsList) {
|
| | | this.mCredentialsList = credentialsList;
|
| | | }
|
| | |
|
| | | @OnClick(R.id.register_gender)
|
| | | public void selectGender(View view) {
|
| | | SingleSelectionDialog popup = new SingleSelectionDialog(getActivity(),mSexList,"性别");
|
| | | popup.showAtLocation(mBaseLayout, Gravity.CENTER,0,0);
|
| | | popup.addOkButtonClickedListener(new OkButtonClickedListener() {
|
| | | @Override
|
| | | public void onItemSelected(int position, Object o, String item) {
|
| | | genderTv.setText(item);
|
| | | @OnClick(R.id.register_country)
|
| | | public void register_country_click(View view) {
|
| | | new CountryDialog(fragment_register_linear_layout, new OkClickedListener() {
|
| | | public void onSelected(String value) {
|
| | | register_country.setValue(value);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | public void setCountryData(String[] countryWordData, List<String> countryWordList, HashMap<String, List<String>> countryData) {
|
| | | this.countryData = countryData;
|
| | | this.countryWordList = countryWordList;
|
| | | this.countryData = countryData;
|
| | | }
|
| | |
|
| | | @OnClick(R.id.register_country)
|
| | | public void selectCountry(View view) {
|
| | | CountrySelectionDialog countrySelectionPopup = new CountrySelectionDialog(getActivity(),
|
| | | countryWordData,countryWordList,countryData);
|
| | | countrySelectionPopup.showAtLocation(mBaseLayout, Gravity.CENTER,0,0);
|
| | | countrySelectionPopup.addOkButtonClickedListener(new OkButtonClickedListener() {
|
| | | @Override
|
| | | public void onItemSelected(int position, Object o, String item) {
|
| | | countryTv.setText(item);
|
| | | @OnClick(R.id.register_gender)
|
| | | public void register_gender_click(View view) {
|
| | | new SelectDialog(fragment_register_linear_layout, Constant.DialogSelectType.GENDER, new OkClickedListener() {
|
| | | public void onSelected(String value) {
|
| | | register_gender.setValue(value);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | @OnClick(R.id.register_birthday)
|
| | | public void selectBirthday(View view) {
|
| | | Date date = new Date();
|
| | | BirthdayPickerDialog myDatePickerDialog=new BirthdayPickerDialog(getActivity(),android.R.style.Theme_Holo_Light_Dialog_NoActionBar,
|
| | | new BirthdayPickerDialog.OnDateSetListener(){
|
| | |
|
| | | @Override
|
| | | public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
|
| | | int month=monthOfYear+1;
|
| | | birthdayTv.setText(year+"-"+month+"-"+dayOfMonth);
|
| | | public void register_birthday_click(View view) {
|
| | | new DateSelectDialog(
|
| | | new OkClickedListener(){
|
| | | public void onSelected(String value) {
|
| | | register_birthday.setValue(value);
|
| | | }
|
| | | },date);
|
| | | myDatePickerDialog.myShow();
|
| | | },new Date());
|
| | | }
|
| | |
|
| | | @OnClick(R.id.register_visitor_class)
|
| | | public void selectVisitorType(View view) {
|
| | | SingleSelectionDialog popup1 = new SingleSelectionDialog(getActivity(),mVisitorTypeList,"访客类型");
|
| | | popup1.showAtLocation(mBaseLayout, Gravity.CENTER,0,0);
|
| | | popup1.addOkButtonClickedListener(new OkButtonClickedListener() {
|
| | | @Override
|
| | | public void onItemSelected(int position, Object o, String item) {
|
| | | isitorvTypeTv.setText(item);
|
| | | public void register_visitor_class_click(View view) {
|
| | | new SelectDialog(fragment_register_linear_layout, Constant.DialogSelectType.VISITOR_TYPE, new OkClickedListener() {
|
| | | public void onSelected(String value) {
|
| | | register_visitor_class.setValue(value); |
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | @OnClick(R.id.register_id_class)
|
| | | public void selectIdentityType(View view) {
|
| | | SingleSelectionDialog popup2 = new SingleSelectionDialog(getActivity(),mCredentialsList,"证件类型");
|
| | | popup2.showAtLocation(mBaseLayout, Gravity.CENTER,0,0);
|
| | | popup2.addOkButtonClickedListener(new OkButtonClickedListener() {
|
| | | @Override
|
| | | public void onItemSelected(int position, Object o, String item) {
|
| | | identityTypeTv.setText(item);
|
| | | public void register_id_class_click(View view) {
|
| | | new SelectDialog(fragment_register_linear_layout, Constant.DialogSelectType.ID_TYPE, new OkClickedListener() {
|
| | | public void onSelected(String value) {
|
| | | register_id_class.setValue(value);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | /**
|
| | | * 选择人物快照
|
| | | * @param view
|
| | | */
|
| | | @OnClick(R.id.register_choose_photo)
|
| | | public void selectPersonPhoto(View view) {
|
| | | @OnClick(R.id.fragment_register_choose_photo)
|
| | | public void fragment_register_choose_photo_click(View view) {
|
| | | Toast.makeText(getActivity(), "选择人物快照", Toast.LENGTH_SHORT).show();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 点击上传图片
|
| | | * @param view
|
| | | */
|
| | | @OnClick(R.id.register_update__photo)
|
| | | public void clickUploadPhoto(View view) {
|
| | | @OnClick(R.id.fragment_register_update__photo)
|
| | | public void fragment_register_update__photo_click(View view) {
|
| | | Intent intent = new Intent();
|
| | | intent.setType("image/*");
|
| | | intent.setAction(Intent.ACTION_GET_CONTENT);
|
| | | startActivityForResult(Intent.createChooser(intent, "选择图片"), PICK_IMAGE_REQUEST);
|
| | | }
|
| | |
|
| | | @ViewInject(R.id.register_update__photo)
|
| | | private ImageView ploadPhotoIv;
|
| | | @OnClick(R.id.fragment_register_back)
|
| | | public void back(View view) {
|
| | | MainActivity.selectPage(0);
|
| | | }
|
| | |
|
| | | @OnClick(R.id.fragment_register_idcard_photo)
|
| | | public void identityPhoto(View view) {
|
| | | Toast.makeText(getActivity(), "证件快照", Toast.LENGTH_SHORT).show();
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
| | | super.onActivityResult(requestCode, resultCode, data);
|
| | |
|
| | | if (requestCode == PICK_IMAGE_REQUEST && resultCode == Activity.RESULT_OK && data != null && data.getData() != null) {
|
| | |
|
| | | Uri uri = data.getData();
|
| | |
|
| | | try {
|
| | | Bitmap bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), uri);
|
| | | // Log.d(TAG, String.valueOf(bitmap));u
|
| | | ploadPhotoIv.setImageBitmap(bitmap);
|
| | | fragment_register_update__photo.setImageBitmap(bitmap);
|
| | | // ImageView imageView = (ImageView) findViewById(R.id.imageView);
|
| | | // imageView.setImageBitmap(bitmap);
|
| | | } catch (IOException e) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 证件快照
|
| | | * @param view
|
| | | */
|
| | | @OnClick(R.id.register_idcard_photo)
|
| | | public void identityPhoto(View view) {
|
| | | Toast.makeText(getActivity(), "证件快照", Toast.LENGTH_SHORT).show();
|
| | | }
|
| | |
|
| | | @OnClick(R.id.register_back)
|
| | | public void back(View view) {
|
| | | MainActivity.selectPage(0);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void onClick(View v) {}
|
| | |
|
| | | public void setRegisterInfo(CheckInQueryItem item) {
|
| | | fragment_register_choose_photo.setImageURI(Uri.parse(AppApi.IMAGEURL_BASE + item.getImagePath()));
|
| | | }
|
| | |
|
| | | }
|