| | |
| | | package cn.com.basic.face.service;
|
| | |
|
| | | import cn.com.basic.face.dialog.SelectDialog;
|
| | | import cn.com.basic.face.fragment.RegisterFragment;
|
| | | import cn.com.basic.face.util.AppApi;
|
| | | import cn.com.basic.face.util.MultipartUtility;
|
| | |
| | | return instance;
|
| | | }
|
| | |
|
| | | public static List<String> mVisitorTypeList = new ArrayList<String>();
|
| | |
|
| | | public void loadAll() {
|
| | | 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) {
|
| | | List<String> mVisitorTypeList = new ArrayList<String>();
|
| | | for (VistorTypeQueryItem item : getList(VistorTypeQueryItem.class)) {
|
| | | mVisitorTypeList.add(item.getLabel());
|
| | | idMap.put(item.getLabel(), item.getId()+"");
|
| | | }
|
| | | RegisterFragment.getInstance().setVisitorTypeList(mVisitorTypeList);
|
| | | SelectDialog.setVisitorTypeList(mVisitorTypeList);
|
| | | }
|
| | |
|
| | | });
|
| | | }
|
| | |
|
| | | private void uploadMedia() {
|
| | | try {
|
| | |
|
| | | String charset = "UTF-8";
|
| | | File uploadFile1 = new File("/sdcard/myvideo.mp4");
|
| | | String requestURL = AppApi.BASEURL+AppApi.REGISTER_ADD;
|
| | |
|
| | | 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();
|
| | | }
|
| | |
|
| | | }
|
| | | }
|