|
@@ -1,19 +1,31 @@
|
|
package com.ynstkz.shitu.android.activity;
|
|
package com.ynstkz.shitu.android.activity;
|
|
|
|
|
|
|
|
+import android.app.AlertDialog;
|
|
|
|
+import android.content.DialogInterface;
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
import android.support.annotation.Nullable;
|
|
import android.support.annotation.Nullable;
|
|
|
|
+import android.text.TextUtils;
|
|
import android.view.LayoutInflater;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
|
+import android.widget.Button;
|
|
import android.widget.EditText;
|
|
import android.widget.EditText;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
+import com.common.library.okhttp.callback.Callback;
|
|
|
|
+import com.google.gson.Gson;
|
|
import com.ynstkz.shitu.android.R;
|
|
import com.ynstkz.shitu.android.R;
|
|
import com.ynstkz.shitu.android.base.TitleBarActivity;
|
|
import com.ynstkz.shitu.android.base.TitleBarActivity;
|
|
|
|
+import com.ynstkz.shitu.android.bean.LocalCityBean;
|
|
|
|
+import com.ynstkz.shitu.android.data.RequestGroup;
|
|
import com.ynstkz.shitu.android.view.ScrollViewWithGridView;
|
|
import com.ynstkz.shitu.android.view.ScrollViewWithGridView;
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
import butterknife.Bind;
|
|
import butterknife.Bind;
|
|
|
|
+import okhttp3.Call;
|
|
|
|
+import okhttp3.Response;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 作者:fuchangle on 2018/2/11 15:38
|
|
* 作者:fuchangle on 2018/2/11 15:38
|
|
@@ -63,6 +75,26 @@ public class StudentInfoActivity extends TitleBarActivity {
|
|
LinearLayout llMemberFamily;
|
|
LinearLayout llMemberFamily;
|
|
@Bind(R.id.gv_images)
|
|
@Bind(R.id.gv_images)
|
|
ScrollViewWithGridView gvImages;
|
|
ScrollViewWithGridView gvImages;
|
|
|
|
+ @Bind(R.id.btn_save)
|
|
|
|
+ Button btnSave;
|
|
|
|
+ @Bind(R.id.tv_residenceCityId)
|
|
|
|
+ TextView tvResidenceCityId;
|
|
|
|
+ @Bind(R.id.tv_residenceRegionId)
|
|
|
|
+ TextView tvResidenceRegionId;
|
|
|
|
+ @Bind(R.id.tv_livingProvinceId)
|
|
|
|
+ TextView tvLivingProvinceId;
|
|
|
|
+ @Bind(R.id.tv_livingCityId)
|
|
|
|
+ TextView tvLivingCityId;
|
|
|
|
+ @Bind(R.id.tv_livingRegionId)
|
|
|
|
+ TextView tvLivingRegionId;
|
|
|
|
+
|
|
|
|
+ private String residenceProvinceId = "30";
|
|
|
|
+ private String residenceCityId;
|
|
|
|
+ private String residenceRegionId;
|
|
|
|
+
|
|
|
|
+ private String livingProvinceId;
|
|
|
|
+ private String livingCityId;
|
|
|
|
+ private String livingRegionId;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
@@ -90,5 +122,124 @@ public class StudentInfoActivity extends TitleBarActivity {
|
|
|
|
|
|
private void setListener() {
|
|
private void setListener() {
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 选择市
|
|
|
|
+ */
|
|
|
|
+ tvResidenceCityId.setOnClickListener(new View.OnClickListener() {
|
|
|
|
+ @Override
|
|
|
|
+ public void onClick(View view) {
|
|
|
|
+ getLocalCityList("02", residenceProvinceId);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 选择地区
|
|
|
|
+ */
|
|
|
|
+ tvResidenceRegionId.setOnClickListener(new View.OnClickListener() {
|
|
|
|
+ @Override
|
|
|
|
+ public void onClick(View view) {
|
|
|
|
+ if (!TextUtils.isEmpty(residenceCityId)) {
|
|
|
|
+ getLocalCityList("03", residenceCityId);
|
|
|
|
+ } else {
|
|
|
|
+ showToast("先选择省市");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 现居住 省
|
|
|
|
+ */
|
|
|
|
+ tvLivingProvinceId.setOnClickListener(new View.OnClickListener() {
|
|
|
|
+ @Override
|
|
|
|
+ public void onClick(View view) {
|
|
|
|
+ getLocalCityList("11", "");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 现居住 市
|
|
|
|
+ */
|
|
|
|
+ tvLivingCityId.setOnClickListener(new View.OnClickListener() {
|
|
|
|
+ @Override
|
|
|
|
+ public void onClick(View view) {
|
|
|
|
+ getLocalCityList("12", livingProvinceId);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 现居住 区
|
|
|
|
+ */
|
|
|
|
+ tvLivingRegionId.setOnClickListener(new View.OnClickListener() {
|
|
|
|
+ @Override
|
|
|
|
+ public void onClick(View view) {
|
|
|
|
+ getLocalCityList("13", livingCityId);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * type 户口 01 02 03
|
|
|
|
+ * 居住地 11 12 13
|
|
|
|
+ * <p>
|
|
|
|
+ * 获取定位列表
|
|
|
|
+ */
|
|
|
|
+ private void getLocalCityList(final String type, String parentId) {
|
|
|
|
+
|
|
|
|
+ RequestGroup.getLocalCity(parentId, new Callback() {
|
|
|
|
+ @Override
|
|
|
|
+ public Object parseNetworkResponse(Response response, int id) throws Exception {
|
|
|
|
+ return new Gson().fromJson(response.body().string(), LocalCityBean.class);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onError(Call call, Exception e, int id) {
|
|
|
|
+ showToast(getString(R.string.error_msg));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onResponse(Object response, int id) {
|
|
|
|
+ LocalCityBean localCityBean = (LocalCityBean) response;
|
|
|
|
+ if (localCityBean != null) {
|
|
|
|
+ if ("200".equals(localCityBean.getCode())) {
|
|
|
|
+ if (localCityBean.getData() != null) {
|
|
|
|
+ final List<LocalCityBean.DataBean> dataBean = localCityBean.getData();
|
|
|
|
+ if (dataBean != null && dataBean.size() > 0) {
|
|
|
|
+ String[] cityNames = new String[dataBean.size()];
|
|
|
|
+ for (int i = 0; i < dataBean.size(); i++) {
|
|
|
|
+ String regionName = dataBean.get(i).getRegionName();
|
|
|
|
+ cityNames[i] = regionName;
|
|
|
|
+ }
|
|
|
|
+ AlertDialog.Builder listDialog = new AlertDialog.Builder(StudentInfoActivity.this);
|
|
|
|
+ listDialog.setTitle("选择城市");
|
|
|
|
+ listDialog.setItems(cityNames, new DialogInterface.OnClickListener() {
|
|
|
|
+ @Override
|
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
|
+ if ("02".equals(type)) {
|
|
|
|
+ residenceCityId = dataBean.get(i).getRegionId() + "";
|
|
|
|
+ tvResidenceCityId.setText(dataBean.get(i).getRegionName());
|
|
|
|
+ } else if ("03".equals(type)) {
|
|
|
|
+ residenceRegionId = dataBean.get(i).getRegionId() + "";
|
|
|
|
+ tvResidenceRegionId.setText(dataBean.get(i).getRegionName());
|
|
|
|
+ } else if ("11".equals(type)){
|
|
|
|
+ livingProvinceId = dataBean.get(i).getRegionId() + "";
|
|
|
|
+ tvLivingProvinceId.setText(dataBean.get(i).getRegionName());
|
|
|
|
+ } else if ("12".equals(type)){
|
|
|
|
+ livingCityId = dataBean.get(i).getRegionId() + "";
|
|
|
|
+ tvLivingCityId.setText(dataBean.get(i).getRegionName());
|
|
|
|
+ } else if ("13".equals(type)){
|
|
|
|
+ livingRegionId = dataBean.get(i).getRegionId() + "";
|
|
|
|
+ tvLivingRegionId.setText(dataBean.get(i).getRegionName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ listDialog.show();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ showToast(localCityBean.getMsg());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}
|
|
}
|