| | |
| | | package com.bsk.zhangbo.demoforbsk.ui.fragment;
|
| | |
|
| | | import android.app.Activity;
|
| | | import android.content.Intent;
|
| | | import android.graphics.Bitmap;
|
| | | 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 com.bsk.zhangbo.demoforbsk.base.BaseFragment;
|
| | | import com.bsk.zhangbo.demoforbsk.service.DictionaryMng;
|
| | | import com.bsk.zhangbo.demoforbsk.service.PersonMng;
|
| | | import com.bsk.zhangbo.demoforbsk.service.RegisterMng;
|
| | | import com.bsk.zhangbo.demoforbsk.service.VisitorTypeMng;
|
| | | import com.bsk.zhangbo.demoforbsk.listeners.OkButtonClickedListener;
|
| | | import com.bsk.zhangbo.demoforbsk.ui.activity.MainActivity;
|
| | | 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 java.util.Calendar;
|
| | | import java.io.IOException;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | |
|
| | | import cn.com.basic.face.discern.entity.Person;
|
| | |
| | | //@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;
|
| | |
| | | @ViewInject(R.id.register_remark)
|
| | | private View mViewRemark;
|
| | |
|
| | | public static RegisterFragment newInstance() {
|
| | | return new RegisterFragment();
|
| | | private String[] countryWordData;
|
| | | private List<String> countryWordList;
|
| | | private HashMap<String, List<String>> countryData;
|
| | |
|
| | | private static RegisterFragment instance = new RegisterFragment();
|
| | |
|
| | | public static RegisterFragment getInstance() {
|
| | | return instance;
|
| | | }
|
| | | @Override
|
| | | protected int getLayoutId() {
|
| | |
| | | params.addBodyParameter(VisitPersonType.FieldNames.visitorTypeId, VisitorTypeMng.getInstance().getId(isitorvTypeTv.getText().toString()));
|
| | | params.addBodyParameter(VisitPersonType.FieldNames.registerCompanyId, "0");
|
| | |
|
| | | PersonMng.getInstance().add(params);
|
| | | RegisterMng.getInstance().add(params);
|
| | | }
|
| | |
|
| | | @Override
|
| | | protected void initData() {
|
| | | mVisitorTypeList = VisitorTypeMng.mVisitorTypeList;
|
| | | mSexList = DictionaryMng.mSexList;
|
| | | mCredentialsList = DictionaryMng.mCredentialsList;
|
| | | // 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 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) {
|
| | | CountrySelectionPopup countrySelectionPopup = new CountrySelectionPopup(getActivity());
|
| | | CountrySelectionPopup countrySelectionPopup = new CountrySelectionPopup(getActivity(),
|
| | | countryWordData,countryWordList,countryData);
|
| | | countrySelectionPopup.showAtLocation(mBaseLayout, Gravity.CENTER,0,0);
|
| | | countrySelectionPopup.addOkButtonClickedListener(new OkButtonClickedListener() {
|
| | | @Override
|
| | |
| | | */
|
| | | @OnClick(R.id.register_update__photo)
|
| | | public void clickUploadPhoto(View view) {
|
| | | Toast.makeText(getActivity(), "点击上传图片", Toast.LENGTH_SHORT).show();
|
| | | 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;
|
| | |
|
| | | @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);
|
| | | // ImageView imageView = (ImageView) findViewById(R.id.imageView);
|
| | | // imageView.setImageBitmap(bitmap);
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | 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) {}
|
| | |
|