From 98231240ca053a494fc339b0dab78f93de8ecf0e Mon Sep 17 00:00:00 2001
From: xuxiuxi <xuxiuxi@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期三, 22 三月 2017 18:43:01 +0800
Subject: [PATCH] 

---
 /dev/null                                                                                           |   51 -----
 VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/ui/fragment/RegisterFragment.java |  151 ++++++++--------
 VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/service/BaseMng.java              |    2 
 VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/service/CompanyMng.java           |    2 
 VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/base/BaseActivity.java            |    1 
 VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/base/BaseFragment.java            |    7 
 VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/widget/CountrySelectionPopup.java |    2 
 VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/util/MultipartUtility.java        |  158 +++++++++++++++++
 VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/base/BaseApplication.java         |    4 
 VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/service/VisitorTypeMng.java       |  101 +++++++++++
 VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/util/AppApi.java                  |    2 
 VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/service/DictionaryMng.java        |    2 
 12 files changed, 352 insertions(+), 131 deletions(-)

diff --git a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/base/BaseActivity.java b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/base/BaseActivity.java
index 25678dc..fdee83b 100644
--- a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/base/BaseActivity.java
+++ b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/base/BaseActivity.java
@@ -15,6 +15,7 @@
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+        x.view().inject(this);
         //璁剧疆甯冨眬鍐呭
         setContentView(getLayoutId());
         //鍒濆鍖栨帶浠�
diff --git a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/base/BaseApplication.java b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/base/BaseApplication.java
index 981724f..1fe649b 100644
--- a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/base/BaseApplication.java
+++ b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/base/BaseApplication.java
@@ -2,8 +2,8 @@
 
 import android.app.Application;
 
-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.service.DictionaryMng;
+import com.bsk.zhangbo.demoforbsk.service.VisitorTypeMng;
 import com.facebook.drawee.backends.pipeline.Fresco;
 import com.lzy.okhttputils.OkHttpUtils;
 import com.lzy.okhttputils.model.HttpHeaders;
diff --git a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/base/BaseFragment.java b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/base/BaseFragment.java
index db663de..bdde1c5 100644
--- a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/base/BaseFragment.java
+++ b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/base/BaseFragment.java
@@ -9,12 +9,15 @@
 import android.view.View;
 import android.view.ViewGroup;
 
+import org.xutils.x;
+
 /**
  * Created by zhangbo on 2017/2/15.
  */
 
 public abstract class BaseFragment extends Fragment{
     private View view;
+
     @Nullable
     @Override
     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@@ -58,9 +61,9 @@
 
     protected abstract void initViews(View view, Bundle savedInstanceState);
 
-    protected abstract void initToolbar(Bundle savedInstanceState);
+    protected void initToolbar(Bundle savedInstanceState){};
 
-    protected abstract void initListeners();
+    protected void initListeners() {};
 
     protected abstract void initData();
 }
diff --git a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/com/bsk/zhangbo/demoforbsk/service/VisitorTypeMng.java b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/com/bsk/zhangbo/demoforbsk/service/VisitorTypeMng.java
deleted file mode 100644
index 5fc9dc0..0000000
--- a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/com/bsk/zhangbo/demoforbsk/service/VisitorTypeMng.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.bsk.zhangbo.demoforbsk.com.bsk.zhangbo.demoforbsk.service;
-
-import com.bsk.zhangbo.demoforbsk.util.AppApi;
-
-import org.xutils.http.RequestParams;
-import org.xutils.x;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import cn.com.basic.face.discern.common.BaseCommonCallBack;
-import cn.com.basic.face.discern.entity.VisitorType;
-import cn.com.basic.face.discern.query.item.VistorTypeQueryItem;
-
-/**
- * Created by xiuxi on 2017/3/22.
- */
-
-public class VisitorTypeMng extends BaseMng {
-
-    public static VisitorTypeMng instance = new VisitorTypeMng();
-
-    public static VisitorTypeMng getInstance() {
-        return instance;
-    }
-
-    public static List<String> mVisitorTypeList;
-    public static Map<String, String> idMap = new HashMap<String, String>();
-
-    public void loadAll() {
-        loadVisitorTypeList();
-    }
-
-    private void loadVisitorTypeList() {
-        RequestParams params = new RequestParams(AppApi.BASEURL+AppApi.VISITOR_TYPE_LIST);
-        x.http().get(params, new BaseCommonCallBack() {
-            public void success() {
-                List<VistorTypeQueryItem> items = getList(VistorTypeQueryItem.class);
-                mVisitorTypeList = new ArrayList<String>();
-                for (VistorTypeQueryItem item : items) {
-                    mVisitorTypeList.add(item.getLabel());
-                    idMap.put(item.getLabel(), item.getId()+"");
-                }
-            }
-
-        });
-    }
-
-}
diff --git a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/com/bsk/zhangbo/demoforbsk/service/BaseMng.java b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/service/BaseMng.java
similarity index 95%
rename from VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/com/bsk/zhangbo/demoforbsk/service/BaseMng.java
rename to VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/service/BaseMng.java
index 1d4e600..a2fe793 100644
--- a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/com/bsk/zhangbo/demoforbsk/service/BaseMng.java
+++ b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/service/BaseMng.java
@@ -1,4 +1,4 @@
-package com.bsk.zhangbo.demoforbsk.com.bsk.zhangbo.demoforbsk.service;
+package com.bsk.zhangbo.demoforbsk.service;
 
 import com.alibaba.fastjson.JSON;
 import com.bsk.zhangbo.demoforbsk.util.AppApi;
diff --git a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/com/bsk/zhangbo/demoforbsk/service/CompanyMng.java b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/service/CompanyMng.java
similarity index 93%
rename from VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/com/bsk/zhangbo/demoforbsk/service/CompanyMng.java
rename to VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/service/CompanyMng.java
index 35de9c6..8edb284 100644
--- a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/com/bsk/zhangbo/demoforbsk/service/CompanyMng.java
+++ b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/service/CompanyMng.java
@@ -1,4 +1,4 @@
-package com.bsk.zhangbo.demoforbsk.com.bsk.zhangbo.demoforbsk.service;
+package com.bsk.zhangbo.demoforbsk.service;
 
 import java.util.ArrayList;
 import java.util.List;
diff --git a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/com/bsk/zhangbo/demoforbsk/service/DictionaryMng.java b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/service/DictionaryMng.java
similarity index 97%
rename from VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/com/bsk/zhangbo/demoforbsk/service/DictionaryMng.java
rename to VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/service/DictionaryMng.java
index d9d13bf..8169fd3 100644
--- a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/com/bsk/zhangbo/demoforbsk/service/DictionaryMng.java
+++ b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/service/DictionaryMng.java
@@ -1,4 +1,4 @@
-package com.bsk.zhangbo.demoforbsk.com.bsk.zhangbo.demoforbsk.service;
+package com.bsk.zhangbo.demoforbsk.service;
 
 import com.bsk.zhangbo.demoforbsk.util.AppApi;
 
diff --git a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/service/VisitorTypeMng.java b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/service/VisitorTypeMng.java
new file mode 100644
index 0000000..6591cd3
--- /dev/null
+++ b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/service/VisitorTypeMng.java
@@ -0,0 +1,101 @@
+package com.bsk.zhangbo.demoforbsk.service;
+
+import android.widget.Toast;
+
+import com.bsk.zhangbo.demoforbsk.base.BaseApplication;
+import com.bsk.zhangbo.demoforbsk.util.AppApi;
+import com.bsk.zhangbo.demoforbsk.util.MultipartUtility;
+
+import org.xutils.http.RequestParams;
+import org.xutils.x;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import cn.com.basic.face.discern.common.BaseCommonCallBack;
+import cn.com.basic.face.discern.entity.Person;
+import cn.com.basic.face.discern.entity.VisitPersonType;
+import cn.com.basic.face.discern.query.item.VistorTypeQueryItem;
+
+/**
+ * Created by xiuxi on 2017/3/22.
+ */
+
+public class VisitorTypeMng extends BaseMng {
+
+    public static VisitorTypeMng instance = new VisitorTypeMng();
+
+    public static VisitorTypeMng getInstance() {
+        return instance;
+    }
+
+    public static List<String> mVisitorTypeList;
+    public static Map<String, String> idMap = new HashMap<String, String>();
+
+    public void loadAll() {
+        loadVisitorTypeList();
+    }
+
+    private void loadVisitorTypeList() {
+        RequestParams params = new RequestParams(AppApi.BASEURL+AppApi.VISITOR_TYPE_LIST);
+        x.http().get(params, new BaseCommonCallBack() {
+            public void success() {
+                List<VistorTypeQueryItem> items = getList(VistorTypeQueryItem.class);
+                mVisitorTypeList = new ArrayList<String>();
+                for (VistorTypeQueryItem item : items) {
+                    mVisitorTypeList.add(item.getLabel());
+                    idMap.put(item.getLabel(), item.getId()+"");
+                }
+            }
+
+        });
+    }
+
+    public void add(Person person, VisitPersonType visitPersonType) {
+        RequestParams params = new RequestParams(AppApi.BASEURL+AppApi.PERSON_REGISTER);
+        params.addParameter("file1", new File("/storage/emulated/0/send_contact.vcf"));
+        params.addParameter("file1", new File("/storage/emulated/0/text_thl.png"));
+        x.http().post(params, new BaseCommonCallBack() {
+            @Override
+            public void success() {
+                Toast.makeText(BaseApplication.getApplication(),"", Toast.LENGTH_SHORT).show();
+            }
+        });
+//        params.a
+//        x.http().post()
+
+    }
+    private void uploadMedia() {
+        try {
+
+            String charset = "UTF-8";
+            File uploadFile1 = new File("/sdcard/myvideo.mp4");
+            String requestURL = AppApi.BASEURL+AppApi.PERSON_REGISTER;
+
+            MultipartUtility multipart = new MultipartUtility(requestURL, charset);
+
+//            multipart.addHeaderField("User-Agent", "CodeJava");
+//            multipart.addHeaderField("Test-Header", "Header-Value");
+
+            multipart.addFormField("friend_id", "Cool Pictures");
+            multipart.addFormField("userid", "Java,upload,Spring");
+
+            multipart.addFilePart("uploadedfile", uploadFile1);
+
+            List<String> response = multipart.finish();
+
+            //Log.v("rht", "SERVER REPLIED:");
+
+            for (String line : response) {
+                //Log.v("rht", "Line : "+line);
+
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+}
diff --git a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/ui/fragment/RegisterFragment.java b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/ui/fragment/RegisterFragment.java
index 535202d..bef3c88 100644
--- a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/ui/fragment/RegisterFragment.java
+++ b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/ui/fragment/RegisterFragment.java
@@ -5,28 +5,38 @@
 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.BaseApplication;
 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.service.DictionaryMng;
+import 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 com.lidroid.xutils.ViewUtils;
+import com.lidroid.xutils.view.annotation.ViewInject;
+import com.lidroid.xutils.view.annotation.event.OnClick;
+
+import org.xutils.view.annotation.ContentView;
+import org.xutils.x;
 
 import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
 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 View mViewName,mViewSex,mViewNation,mViewBirthday,mViewVisitorClass,mViewPhone,mViewIdClass,mViewIdNumber,mViewCompayName,mViewRemark;
@@ -35,11 +45,7 @@
     private List mSexList;
     private List mVisitorTypeList;
     private List mCredentialsList;
-    private List mNationList;
     private LinearLayout mBaseLayout;
-    private int mNowYear;
-    private int mNowMonth;
-    private int mNowDay;
 
     public static RegisterFragment newInstance() {
         return new RegisterFragment();
@@ -52,6 +58,7 @@
     @Override
     protected void initViews(View view, Bundle savedInstanceState) {
         mBaseLayout = (LinearLayout) view.findViewById(R.id.register_base);
+        ViewUtils.inject(this, mBaseLayout);
         mViewName = view.findViewById(R.id.register_name);
         mViewSex = view.findViewById(R.id.register_sex);
         mViewNation = view.findViewById(R.id.register_nation);
@@ -86,7 +93,6 @@
         mViewCompanyNameContent = (EditText) mViewCompayName.findViewById(R.id.register_et_content);
         mViewRemarkContent = (EditText) mViewRemark.findViewById(R.id.register_et_content);
 
-
         mViewNameTitle.setText(R.string.title_name);
         mViewSexTitle.setText(R.string.title_sex);
         mViewNationTitle.setText(R.string.title_nation);
@@ -98,12 +104,15 @@
         mViewCompanyNameTitle.setText(R.string.title_companyName);
         mViewRemarkTitle.setText(R.string.title_remark);
         Calendar calendar = Calendar.getInstance();
-        mNowYear = calendar.get(Calendar.YEAR);
-        mNowMonth = calendar.get(Calendar.MONTH);
-        mNowDay = calendar.get(Calendar.DAY_OF_MONTH);
     }
 
-    public void save() {
+    @OnClick(R.id.register_save)
+    public void registerEdit() {
+
+    }
+
+    @OnClick(R.id.register_add)
+    public void registerAdd(View v) {
         Person person = new Person();
 //        person.setBirthday(mViewBirthdyContent.getText());
         person.setName(mViewNameContent.getText().toString());
@@ -114,20 +123,12 @@
         person.setIdentify(mViewIdentityContent.getText().toString());
         person.setBirthday(mViewBirthdyContent.getText().toString());
         //person.setCompanyId();
-    }
 
-    @Override
-    protected void initToolbar(Bundle savedInstanceState) {
+        VisitPersonType visitPersonType = new VisitPersonType();
+//        visitPersonType.setRegisterCompanyId();
+        visitPersonType.setVisitorTypeId(VisitorTypeMng.getInstance().getId(mViewVisitorClassTitle.getText().toString()));
+        VisitorTypeMng.getInstance().add(person, visitPersonType);
 
-    }
-
-    @Override
-    protected void initListeners() {
-        mViewSex.setOnClickListener(this);
-        mViewNation.setOnClickListener(this);
-        mViewBirthday.setOnClickListener(this);
-        mViewVisitorClass.setOnClickListener(this);
-        mViewIdClass.setOnClickListener(this);
     }
 
     @Override
@@ -135,57 +136,63 @@
         mVisitorTypeList = VisitorTypeMng.mVisitorTypeList;
         mSexList = DictionaryMng.mSexList;
         mCredentialsList = DictionaryMng.mCredentialsList;
-        mNationList = DictionaryMng.nationList;
+    }
+
+    @OnClick(R.id.register_sex)
+    public void selectGender(View view) {
+        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);
+            }
+        });
+    }
+
+    @OnClick(R.id.register_nation)
+    public void selectCountry(View view) {
+        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);
+            }
+        });
+    }
+
+    @OnClick(R.id.register_birthday)
+    public void selectBirthday(View view) {
+        showDatePicker();
+    }
+
+    @OnClick(R.id.register_visitor_class)
+    public void selectVisitorType(View view) {
+        SingleSelectionPopup popup1 = new SingleSelectionPopup(getActivity(),mVisitorTypeList,"璁垮绫诲瀷");
+        popup1.showAtLocation(mBaseLayout, Gravity.CENTER,0,0);
+        popup1.addOkButtonClickedListener(new OkButtonClickedListener() {
+            @Override
+            public void onItemSelected(int position, Object o, String item) {
+                mViewVisitorClassContent.setText(item);
+            }
+        });
+    }
+
+    @OnClick(R.id.register_id_class)
+    public void selectIdentityType(View view) {
+        SingleSelectionPopup popup2 = new SingleSelectionPopup(getActivity(),mCredentialsList,"璇佷欢绫诲瀷");
+        popup2.showAtLocation(mBaseLayout, Gravity.CENTER,0,0);
+        popup2.addOkButtonClickedListener(new OkButtonClickedListener() {
+            @Override
+            public void onItemSelected(int position, Object o, String item) {
+                mViewIdentityTypeContent.setText(item);
+            }
+        });
     }
 
     @Override
-    public void onClick(View v) {
-        switch (v.getId()){
-            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:
-                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:
-                showDatePicker();
-                break;
-            case R.id.register_visitor_class:
-                SingleSelectionPopup popup1 = new SingleSelectionPopup(getActivity(),mVisitorTypeList,"璁垮绫诲瀷");
-                popup1.showAtLocation(mBaseLayout, Gravity.CENTER,0,0);
-                popup1.addOkButtonClickedListener(new OkButtonClickedListener() {
-                    @Override
-                    public void onItemSelected(int position, Object o, String item) {
-                        mViewVisitorClassContent.setText(item);
-                    }
-                });
-                break;
-            case R.id.register_id_class:
-                SingleSelectionPopup popup2 = new SingleSelectionPopup(getActivity(),mCredentialsList,"璇佷欢绫诲瀷");
-                popup2.showAtLocation(mBaseLayout, Gravity.CENTER,0,0);
-                popup2.addOkButtonClickedListener(new OkButtonClickedListener() {
-                    @Override
-                    public void onItemSelected(int position, Object o, String item) {
-                        mViewIdentityTypeContent.setText(item);
-                    }
-                });
-                break;
-        }
-    }
+    public void onClick(View v) {}
 
     public void showDatePicker(){
         Date date = new Date();
diff --git a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/util/AppApi.java b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/util/AppApi.java
index 274bd3a..a4b0219 100644
--- a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/util/AppApi.java
+++ b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/util/AppApi.java
@@ -9,4 +9,6 @@
 
 	public final static String DICTIONARY_TYPE_LIST = "Dictionary/v_list.do";
 
+	public static final String PERSON_REGISTER = "Person/o_add.do";
+	
 }
diff --git a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/util/MultipartUtility.java b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/util/MultipartUtility.java
new file mode 100644
index 0000000..1e08f05
--- /dev/null
+++ b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/util/MultipartUtility.java
@@ -0,0 +1,158 @@
+package com.bsk.zhangbo.demoforbsk.util;
+
+import java.util.List;
+
+import java.io.BufferedReader;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This utility class provides an abstraction layer for sending multipart HTTP
+ * POST requests to a web server.
+ *
+ * @author www.codejava.net
+ */
+public class MultipartUtility {
+    private final String boundary;
+    private static final String LINE_FEED = "\r\n";
+    private HttpURLConnection httpConn;
+    private String charset;
+    private OutputStream outputStream;
+    private PrintWriter writer;
+
+    /**
+     * This constructor initializes a new HTTP POST request with content type
+     * is set to multipart/form-data
+     *
+     * @param requestURL
+     * @param charset
+     * @throws IOException
+     */
+    public MultipartUtility(String requestURL, String charset)
+            throws IOException {
+        this.charset = charset;
+
+        // creates a unique boundary based on time stamp
+        boundary = "===" + System.currentTimeMillis() + "===";
+
+        URL url = new URL(requestURL);
+        httpConn = (HttpURLConnection) url.openConnection();
+        httpConn.setUseCaches(false);
+        httpConn.setDoOutput(true); // indicates POST method
+        httpConn.setDoInput(true);
+        httpConn.setRequestProperty("Content-Type",
+                "multipart/form-data; boundary=" + boundary);
+        httpConn.setRequestProperty("User-Agent", "CodeJava Agent");
+        httpConn.setRequestProperty("Test", "Bonjour");
+        outputStream = httpConn.getOutputStream();
+        writer = new PrintWriter(new OutputStreamWriter(outputStream, charset),
+                true);
+    }
+
+    /**
+     * Adds a form field to the request
+     *
+     * @param name  field name
+     * @param value field value
+     */
+    public void addFormField(String name, String value) {
+        writer.append("--" + boundary).append(LINE_FEED);
+        writer.append("Content-Disposition: form-data; name=\"" + name + "\"")
+                .append(LINE_FEED);
+        writer.append("Content-Type: text/plain; charset=" + charset).append(
+                LINE_FEED);
+        writer.append(LINE_FEED);
+        writer.append(value).append(LINE_FEED);
+        writer.flush();
+    }
+
+    /**
+     * Adds a upload file section to the request
+     *
+     * @param fieldName  name attribute in <input type="file" name="..." />
+     * @param uploadFile a File to be uploaded
+     * @throws IOException
+     */
+    public void addFilePart(String fieldName, File uploadFile)
+            throws IOException {
+        String fileName = uploadFile.getName();
+        writer.append("--" + boundary).append(LINE_FEED);
+        writer.append(
+                "Content-Disposition: form-data; name=\"" + fieldName
+                        + "\"; filename=\"" + fileName + "\"")
+                .append(LINE_FEED);
+        writer.append(
+                "Content-Type: "
+                        + URLConnection.guessContentTypeFromName(fileName))
+                .append(LINE_FEED);
+        writer.append("Content-Transfer-Encoding: binary").append(LINE_FEED);
+        writer.append(LINE_FEED);
+        writer.flush();
+
+        FileInputStream inputStream = new FileInputStream(uploadFile);
+        byte[] buffer = new byte[4096];
+        int bytesRead = -1;
+        while ((bytesRead = inputStream.read(buffer)) != -1) {
+            outputStream.write(buffer, 0, bytesRead);
+        }
+        outputStream.flush();
+        inputStream.close();
+
+        writer.append(LINE_FEED);
+        writer.flush();
+    }
+
+    /**
+     * Adds a header field to the request.
+     *
+     * @param name  - name of the header field
+     * @param value - value of the header field
+     */
+    public void addHeaderField(String name, String value) {
+        writer.append(name + ": " + value).append(LINE_FEED);
+        writer.flush();
+    }
+
+    /**
+     * Completes the request and receives response from the server.
+     *
+     * @return a list of Strings as response in case the server returned
+     * status OK, otherwise an exception is thrown.
+     * @throws IOException
+     */
+    public List<String> finish() throws IOException {
+        List<String> response = new ArrayList<String>();
+
+        writer.append(LINE_FEED).flush();
+        writer.append("--" + boundary + "--").append(LINE_FEED);
+        writer.close();
+
+        // checks server's status code first
+        int status = httpConn.getResponseCode();
+        if (status == HttpURLConnection.HTTP_OK) {
+            BufferedReader reader = new BufferedReader(new InputStreamReader(
+                    httpConn.getInputStream()));
+            String line = null;
+            while ((line = reader.readLine()) != null) {
+                response.add(line);
+            }
+            reader.close();
+            httpConn.disconnect();
+        } else {
+            throw new IOException("Server returned non-OK status: " + status);
+        }
+
+        return response;
+    }
+}
\ No newline at end of file
diff --git a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/widget/CountrySelectionPopup.java b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/widget/CountrySelectionPopup.java
index 9b22f5e..08bed90 100644
--- a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/widget/CountrySelectionPopup.java
+++ b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/widget/CountrySelectionPopup.java
@@ -13,7 +13,7 @@
 
 import com.bsk.zhangbo.demoforbsk.R;
 import com.bsk.zhangbo.demoforbsk.adapter.MyWheelAdapter;
-import com.bsk.zhangbo.demoforbsk.com.bsk.zhangbo.demoforbsk.service.DictionaryMng;
+import com.bsk.zhangbo.demoforbsk.service.DictionaryMng;
 import com.bsk.zhangbo.demoforbsk.listeners.OkButtonClickedListener;
 import com.bsk.zhangbo.demoforbsk.util.CountryPresenter;
 

--
Gitblit v1.8.0