|
|
@@ -31,6 +31,7 @@ import android.widget.PopupWindow;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.andreabaccega.widget.FormEditText;
|
|
|
+import com.baidu.mapapi.search.core.PoiInfo;
|
|
|
import com.common.LogUtil;
|
|
|
import com.common.data.StringUtil;
|
|
|
import com.common.system.DisplayUtil;
|
|
|
@@ -45,15 +46,15 @@ import com.core.net.http.ViewUtil;
|
|
|
import com.core.utils.CommonUtil;
|
|
|
import com.core.utils.IntentUtils;
|
|
|
import com.core.utils.ToastUtil;
|
|
|
+import com.core.widget.view.Activity.SearchLocationActivity;
|
|
|
+import com.core.widget.view.model.SearchPoiParam;
|
|
|
import com.me.network.app.http.HttpClient;
|
|
|
import com.me.network.app.http.Method;
|
|
|
import com.me.network.app.http.rx.ResultListener;
|
|
|
import com.me.network.app.http.rx.ResultSubscriber;
|
|
|
import com.modular.login.R;
|
|
|
-import com.modular.login.model.ProfessionBean;
|
|
|
import com.nostra13.universalimageloader.core.ImageLoader;
|
|
|
|
|
|
-import org.json.JSONArray;
|
|
|
import org.json.JSONException;
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
@@ -62,11 +63,8 @@ import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.FileNotFoundException;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
-import java.util.Iterator;
|
|
|
import java.util.LinkedHashMap;
|
|
|
-import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
@@ -75,13 +73,16 @@ import java.util.Map;
|
|
|
|
|
|
public class EnterpriseRegisterActivity extends BaseActivity implements View.OnClickListener {
|
|
|
private final int ENTERPRISE_REGISTER = 0x11;
|
|
|
+ private final int INDUSTRY_CHOOSE = 0x12;
|
|
|
+ private final int SELECT_ADDRESS_REQUEST = 0x13;
|
|
|
+ private final int SELECT_ADDRESS_RESULT = 0x14;
|
|
|
|
|
|
private Button mNextStepButton;
|
|
|
private FormEditText mEnterpriseCompanyEt;
|
|
|
private FormEditText mEnterpriseLicenseEt;
|
|
|
private FormEditText mEnterpriseRepresentEt;
|
|
|
private FormEditText mEnterpriseAddressEt;
|
|
|
- private FormEditText mEnterpriseIndustryEt;
|
|
|
+ private TextView mEnterpriseIndustryEt;
|
|
|
private FormEditText mEnterpriseBusinessEt;
|
|
|
private ImageView mEnterpriseLicenseIv;
|
|
|
private ImageView mTakePicImageView;
|
|
|
@@ -94,7 +95,6 @@ public class EnterpriseRegisterActivity extends BaseActivity implements View.OnC
|
|
|
private static final int REQUEST_CODE_CROP_PHOTO = 3;//裁剪
|
|
|
private String path = null;
|
|
|
private File mLicenseFile;
|
|
|
- private List<ProfessionBean> mProfessionList;
|
|
|
|
|
|
private Handler mHandler = new Handler() {
|
|
|
@Override
|
|
|
@@ -115,6 +115,12 @@ public class EnterpriseRegisterActivity extends BaseActivity implements View.OnC
|
|
|
}
|
|
|
Intent intent = new Intent();
|
|
|
intent.setClass(EnterpriseRegisterActivity.this, AdminRegisterActivity.class);
|
|
|
+ intent.putExtra("companyName", mEnterpriseCompanyEt.getText().toString());
|
|
|
+ intent.putExtra("industry", mEnterpriseIndustryEt.getText().toString());
|
|
|
+ intent.putExtra("address", mEnterpriseAddressEt.getText().toString());
|
|
|
+ intent.putExtra("latitude", mLatitude + "");
|
|
|
+ intent.putExtra("longitude", mLongitude + "");
|
|
|
+
|
|
|
startActivity(intent);
|
|
|
} else {
|
|
|
String errMsg = resultObject.optString("errMsg");
|
|
|
@@ -134,6 +140,8 @@ public class EnterpriseRegisterActivity extends BaseActivity implements View.OnC
|
|
|
}
|
|
|
};
|
|
|
private HttpClient mHttpClient;
|
|
|
+ private double mLatitude;
|
|
|
+ private double mLongitude;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
@@ -158,6 +166,7 @@ public class EnterpriseRegisterActivity extends BaseActivity implements View.OnC
|
|
|
}
|
|
|
});
|
|
|
mEnterpriseIndustryEt.setOnClickListener(this);
|
|
|
+ mEnterpriseAddressEt.setOnClickListener(this);
|
|
|
}
|
|
|
|
|
|
private void initViews() {
|
|
|
@@ -167,7 +176,7 @@ public class EnterpriseRegisterActivity extends BaseActivity implements View.OnC
|
|
|
mEnterpriseLicenseEt = (FormEditText) findViewById(R.id.enterprise_register_license_et);
|
|
|
mEnterpriseRepresentEt = (FormEditText) findViewById(R.id.enterprise_register_represent_et);
|
|
|
mEnterpriseAddressEt = (FormEditText) findViewById(R.id.enterprise_register_address_et);
|
|
|
- mEnterpriseIndustryEt = (FormEditText) findViewById(R.id.enterprise_register_industry_et);
|
|
|
+ mEnterpriseIndustryEt = (TextView) findViewById(R.id.enterprise_register_industry_et);
|
|
|
mEnterpriseBusinessEt = (FormEditText) findViewById(R.id.enterprise_register_business_et);
|
|
|
mEnterpriseLicenseIv = (ImageView) findViewById(R.id.enterprise_register_license_iv);
|
|
|
mTakePicImageView = (ImageView) findViewById(R.id.enterprise_register_picture_iv);
|
|
|
@@ -176,7 +185,6 @@ public class EnterpriseRegisterActivity extends BaseActivity implements View.OnC
|
|
|
mEnterpriseClauseTv.setMovementMethod(LinkMovementMethod.getInstance());
|
|
|
|
|
|
mClauseCheckBox = (CheckBox) findViewById(R.id.enterprise_register_clause_cb);
|
|
|
- mProfessionList = new ArrayList<>();
|
|
|
mHttpClient = new
|
|
|
// HttpClient.Builder("https://account.ubtob.com/sso")
|
|
|
HttpClient.Builder("http://192.168.253.66:8082")
|
|
|
@@ -184,67 +192,6 @@ public class EnterpriseRegisterActivity extends BaseActivity implements View.OnC
|
|
|
.build();
|
|
|
}
|
|
|
|
|
|
- private void initProfession() {
|
|
|
- mProfessionList = new ArrayList<>();
|
|
|
- String profession = CommonUtil.getAssetsJson(this, "profession.json");
|
|
|
- try {
|
|
|
- JSONObject professionObject = new JSONObject(profession);
|
|
|
- Iterator<String> iterator = professionObject.keys();
|
|
|
- while (iterator.hasNext()) {
|
|
|
- ProfessionBean professionBean = new ProfessionBean();
|
|
|
- String professionFirstTitle = iterator.next().toString();
|
|
|
- professionBean.setProfessionFirstTitle(professionFirstTitle);
|
|
|
-
|
|
|
- List<ProfessionBean.ProfessionSecondBean> professionSecondList = new ArrayList<>();
|
|
|
-
|
|
|
- Object second = professionObject.opt(professionFirstTitle);
|
|
|
- if (second instanceof JSONArray) {
|
|
|
- JSONArray secondArray = (JSONArray) second;
|
|
|
- if (secondArray != null) {
|
|
|
- for (int i = 0; i < secondArray.length(); i++) {
|
|
|
- ProfessionBean.ProfessionSecondBean professionSecond = new ProfessionBean.ProfessionSecondBean();
|
|
|
- String secondTitle = secondArray.optString(i);
|
|
|
- professionSecond.setProfessionSecondTitle(secondTitle);
|
|
|
-
|
|
|
- professionSecondList.add(professionSecond);
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (second instanceof JSONObject) {
|
|
|
- JSONObject secondObject = (JSONObject) second;
|
|
|
- Iterator<String> secondKeys = secondObject.keys();
|
|
|
- while (secondKeys.hasNext()) {
|
|
|
- ProfessionBean.ProfessionSecondBean professionSecond = new ProfessionBean.ProfessionSecondBean();
|
|
|
- String secondTitle = secondKeys.next().toString();
|
|
|
- professionSecond.setProfessionSecondTitle(secondTitle);
|
|
|
-
|
|
|
- List<String> thirdTitles = new ArrayList<>();
|
|
|
- Object third = secondObject.opt(secondTitle);
|
|
|
- if (third instanceof String) {
|
|
|
- thirdTitles.add((String) third);
|
|
|
- } else if (third instanceof JSONArray) {
|
|
|
- JSONArray thirdArray = (JSONArray) third;
|
|
|
- for (int i = 0; i < thirdArray.length(); i++) {
|
|
|
- String thirdTitle = thirdArray.optString(i);
|
|
|
- thirdTitles.add(thirdTitle);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- professionSecond.setProfessionThirdTitles(thirdTitles);
|
|
|
-
|
|
|
- professionSecondList.add(professionSecond);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- professionBean.setProfessionSecondTitles(professionSecondList);
|
|
|
-
|
|
|
- mProfessionList.add(professionBean);
|
|
|
- }
|
|
|
- Log.d("professionList", mProfessionList.toString());
|
|
|
- } catch (JSONException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
int i = v.getId();
|
|
|
@@ -287,6 +234,20 @@ public class EnterpriseRegisterActivity extends BaseActivity implements View.OnC
|
|
|
CommonUtil.closeKeybord(mEnterpriseCompanyEt, this);
|
|
|
showPicturePopup();
|
|
|
} else if (i == R.id.enterprise_register_industry_et) {
|
|
|
+ Intent intent = new Intent();
|
|
|
+ intent.setClass(this, IndustryChooseActivity.class);
|
|
|
+ startActivityForResult(intent, INDUSTRY_CHOOSE);
|
|
|
+ } else if (i == R.id.enterprise_register_address_et) {
|
|
|
+ Intent intent = new Intent(ct, SearchLocationActivity.class);
|
|
|
+ SearchPoiParam poiParam = new SearchPoiParam();
|
|
|
+ poiParam.setType(2);
|
|
|
+ poiParam.setTitle("地图搜索");
|
|
|
+ poiParam.setRadius(1000);
|
|
|
+ //poiParam.setContrastLatLng(new LatLng(companyLocation.getLocation().mLongitude, companyLocation.getLocation().mLatitude));
|
|
|
+ poiParam.setResultCode(SELECT_ADDRESS_RESULT);
|
|
|
+ poiParam.setDistanceTag(MyApplication.getInstance().getResources().getString(R.string.rice));
|
|
|
+ intent.putExtra("data", poiParam);
|
|
|
+ startActivityForResult(intent, SELECT_ADDRESS_REQUEST);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
@@ -309,10 +270,6 @@ public class EnterpriseRegisterActivity extends BaseActivity implements View.OnC
|
|
|
CommonUtil.setSharedPreferences(ct, "sessionId", sessionId);
|
|
|
CommonUtil.setSharedPreferences(ct, "pageToken", pageToken);
|
|
|
|
|
|
-// Intent intent = new Intent();
|
|
|
-// intent.setClass(EnterpriseRegisterActivity.this, AdminRegisterActivity.class);
|
|
|
-// startActivity(intent);
|
|
|
-
|
|
|
enterpriseRegister(pageToken, sessionId);
|
|
|
} else {
|
|
|
progressDialog.dismiss();
|
|
|
@@ -358,15 +315,6 @@ public class EnterpriseRegisterActivity extends BaseActivity implements View.OnC
|
|
|
LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
headers.put("Cookie", "JSESSIONID=" + sessionId);
|
|
|
ViewUtil.httpSendRequest(this, url, params, mHandler, headers, ENTERPRISE_REGISTER, null, null, "post");
|
|
|
-
|
|
|
-// String fileBytes = getFileBytes(mLicenseFile);
|
|
|
-//
|
|
|
-// String url = "http://192.168.253.192:8080/account/api/file";
|
|
|
-// Map<String, Object> params = new HashMap<>();
|
|
|
-// params.put("data", fileBytes);
|
|
|
-// LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
-// headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
-// ViewUtil.httpSendRequest(this, url, params, mHandler, headers, 111, null, null, "post");
|
|
|
}
|
|
|
|
|
|
private String getFileBytes(File licenseFile) {
|
|
|
@@ -545,6 +493,22 @@ public class EnterpriseRegisterActivity extends BaseActivity implements View.OnC
|
|
|
ToastUtil.showToast(this, R.string.c_photo_album_failed);
|
|
|
}
|
|
|
}
|
|
|
+ } else if (requestCode == INDUSTRY_CHOOSE) {
|
|
|
+ if (resultCode == Activity.RESULT_OK) {
|
|
|
+ String industry = data.getStringExtra("industry");
|
|
|
+ mEnterpriseIndustryEt.setText(industry);
|
|
|
+ }
|
|
|
+ } else if (requestCode == SELECT_ADDRESS_REQUEST) {
|
|
|
+ if (data != null && resultCode == SELECT_ADDRESS_RESULT) {
|
|
|
+ PoiInfo poi = data.getParcelableExtra("resultKey");
|
|
|
+ if (poi == null) return;
|
|
|
+ if (poi.address.contains(poi.city))
|
|
|
+ mEnterpriseAddressEt.setText(poi.address);
|
|
|
+ else
|
|
|
+ mEnterpriseAddressEt.setText(poi.city + poi.address);
|
|
|
+ mLatitude = poi.location.latitude;
|
|
|
+ mLongitude = poi.location.longitude;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|