|
@@ -6,6 +6,7 @@ import android.content.DialogInterface;
|
|
|
import android.os.Bundle;
|
|
|
import android.support.annotation.Nullable;
|
|
|
import android.text.TextUtils;
|
|
|
+import android.text.format.DateFormat;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.widget.Button;
|
|
@@ -27,7 +28,6 @@ import com.ynstkz.shitu.android.data.RequestGroup;
|
|
|
import com.ynstkz.shitu.android.data.SharedPreferencesUtils;
|
|
|
import com.ynstkz.shitu.android.view.ScrollViewWithGridView;
|
|
|
|
|
|
-import java.text.DateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.List;
|
|
@@ -43,6 +43,8 @@ import okhttp3.Response;
|
|
|
public class StudentInfoActivity extends TitleBarActivity {
|
|
|
|
|
|
|
|
|
+ @Bind(R.id.iv_back)
|
|
|
+ ImageView ivBack;
|
|
|
@Bind(R.id.tv_title)
|
|
|
TextView tvTitle;
|
|
|
@Bind(R.id.view_title)
|
|
@@ -55,42 +57,10 @@ public class StudentInfoActivity extends TitleBarActivity {
|
|
|
TextView tvSex;
|
|
|
@Bind(R.id.edit_nation)
|
|
|
EditText editNation;
|
|
|
- @Bind(R.id.edit_native_place)
|
|
|
- EditText editNativePlace;
|
|
|
@Bind(R.id.tv_residenceCityId)
|
|
|
TextView tvResidenceCityId;
|
|
|
@Bind(R.id.tv_residenceRegionId)
|
|
|
TextView tvResidenceRegionId;
|
|
|
- @Bind(R.id.edit_residenceType)
|
|
|
- EditText editResidenceType;
|
|
|
- @Bind(R.id.edit_height)
|
|
|
- EditText editHeight;
|
|
|
- @Bind(R.id.edit_weight)
|
|
|
- EditText editWeight;
|
|
|
- @Bind(R.id.edit_bloodType)
|
|
|
- EditText editBloodType;
|
|
|
- @Bind(R.id.edit_physicalExamination)
|
|
|
- EditText editPhysicalExamination;
|
|
|
- @Bind(R.id.edit_idcode)
|
|
|
- EditText editIdcode;
|
|
|
- @Bind(R.id.tv_livingProvinceId)
|
|
|
- TextView tvLivingProvinceId;
|
|
|
- @Bind(R.id.tv_livingCityId)
|
|
|
- TextView tvLivingCityId;
|
|
|
- @Bind(R.id.tv_livingRegionId)
|
|
|
- TextView tvLivingRegionId;
|
|
|
- @Bind(R.id.edit_livingAddress)
|
|
|
- EditText editLivingAddress;
|
|
|
- @Bind(R.id.textView)
|
|
|
- TextView textView;
|
|
|
- @Bind(R.id.edit_contactAddress)
|
|
|
- EditText editContactAddress;
|
|
|
- @Bind(R.id.edit_zipCode)
|
|
|
- EditText editZipCode;
|
|
|
- @Bind(R.id.edit_preSchoolEducation)
|
|
|
- EditText editPreSchoolEducation;
|
|
|
- @Bind(R.id.edit_hobby)
|
|
|
- EditText editHobby;
|
|
|
@Bind(R.id.ll_member_family)
|
|
|
LinearLayout llMemberFamily;
|
|
|
@Bind(R.id.gv_images)
|
|
@@ -105,10 +75,6 @@ public class StudentInfoActivity extends TitleBarActivity {
|
|
|
private String residenceCityId;
|
|
|
private String residenceRegionId;
|
|
|
|
|
|
- private String livingProvinceId;
|
|
|
- private String livingCityId;
|
|
|
- private String livingRegionId;
|
|
|
-
|
|
|
//家庭成员信息
|
|
|
private List<StudentFamilyInfoBean> listStudentFamilyInfo;
|
|
|
|
|
@@ -147,10 +113,10 @@ public class StudentInfoActivity extends TitleBarActivity {
|
|
|
@Override
|
|
|
public void onDateSet(DatePicker datePicker, int year, int monthOfYear, int dayOfMonth) {
|
|
|
calendar.set(year, monthOfYear, dayOfMonth);
|
|
|
- birthday = android.text.format.DateFormat.format("yyyy-MM-dd", calendar).toString();
|
|
|
+ birthday = DateFormat.format("yyyy-MM-dd", calendar).toString();
|
|
|
tvBirthday.setText(birthday);
|
|
|
}
|
|
|
- },calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
|
|
|
+ }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
|
|
|
dialog.show();
|
|
|
}
|
|
|
});
|
|
@@ -199,35 +165,6 @@ public class StudentInfoActivity extends TitleBarActivity {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- /**
|
|
|
- * 现居住 省
|
|
|
- */
|
|
|
- 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);
|
|
|
- }
|
|
|
- });
|
|
|
|
|
|
/**
|
|
|
* 保存
|
|
@@ -235,74 +172,21 @@ public class StudentInfoActivity extends TitleBarActivity {
|
|
|
btnSave.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
- saveApplyFamilyInfo();
|
|
|
String studentName = editUsername.getText().toString().trim();
|
|
|
- if(TextUtils.isEmpty(studentName)){
|
|
|
+ if (TextUtils.isEmpty(studentName)) {
|
|
|
showToast("用户名不能为空");
|
|
|
return;
|
|
|
}
|
|
|
- if(TextUtils.isEmpty(birthday)){
|
|
|
+ if (TextUtils.isEmpty(birthday)) {
|
|
|
showToast("出生日期不能为空");
|
|
|
return;
|
|
|
}
|
|
|
String ethnic = editNation.getText().toString().trim();
|
|
|
- if(TextUtils.isEmpty(ethnic)){
|
|
|
+ if (TextUtils.isEmpty(ethnic)) {
|
|
|
showToast("民族不能为空");
|
|
|
return;
|
|
|
}
|
|
|
- String nativePlace = editNativePlace.getText().toString().trim();
|
|
|
- if(TextUtils.isEmpty(nativePlace)){
|
|
|
- showToast("籍贯不能为空");
|
|
|
- return;
|
|
|
- }
|
|
|
- String height = editHeight.getText().toString().trim();
|
|
|
- if(TextUtils.isEmpty(height)){
|
|
|
- showToast("升高不能为空");
|
|
|
- return;
|
|
|
- }
|
|
|
- String weight = editWeight.getText().toString().trim();
|
|
|
- if(TextUtils.isEmpty(weight)){
|
|
|
- showToast("体重不能为空");
|
|
|
- return;
|
|
|
- }
|
|
|
- String bloodType = editBloodType.getText().toString().trim();
|
|
|
- if(TextUtils.isEmpty(bloodType)){
|
|
|
- showToast("血型不能为空");
|
|
|
- return;
|
|
|
- }
|
|
|
- String physicalExamination = editPhysicalExamination.getText().toString().trim();
|
|
|
- if(TextUtils.isEmpty(physicalExamination)){
|
|
|
- showToast("体检不能为空");
|
|
|
- return;
|
|
|
- }
|
|
|
- String idCardNum = editIdcode.getText().toString().trim();
|
|
|
- if(TextUtils.isEmpty(idCardNum)){
|
|
|
- showToast("体检不能为空");
|
|
|
- return;
|
|
|
- }
|
|
|
- String contactAddress = editContactAddress.getText().toString().trim();
|
|
|
- if(TextUtils.isEmpty(contactAddress)){
|
|
|
- showToast("居住地详细地址不能为空");
|
|
|
- return;
|
|
|
- }
|
|
|
- String zipCode = editZipCode.getText().toString().trim();
|
|
|
- if(TextUtils.isEmpty(zipCode)){
|
|
|
- showToast("邮政编码不能为空");
|
|
|
- return;
|
|
|
- }
|
|
|
- String preSchoolEducation = editPreSchoolEducation.getText().toString();
|
|
|
- if(TextUtils.isEmpty(preSchoolEducation)){
|
|
|
- showToast("学前教育不能为空");
|
|
|
- return;
|
|
|
- }
|
|
|
- String hobby = editHobby.getText().toString().trim();
|
|
|
- if(TextUtils.isEmpty(hobby)){
|
|
|
- showToast("兴趣爱好不能为空");
|
|
|
- return;
|
|
|
- }
|
|
|
- saveApplyStudentInfo(studentName, birthday, "", ethnic, nativePlace, residenceProvinceId, residenceCityId, residenceRegionId, "",
|
|
|
- height, weight, bloodType, physicalExamination, idCardNum, livingProvinceId, livingCityId, livingRegionId, contactAddress, zipCode,
|
|
|
- preSchoolEducation, hobby);
|
|
|
+ saveApplyStudentInfo(studentName, birthday, sex+"", ethnic, residenceProvinceId, residenceCityId, residenceRegionId);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -350,15 +234,6 @@ public class StudentInfoActivity extends TitleBarActivity {
|
|
|
} 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());
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -376,14 +251,10 @@ public class StudentInfoActivity extends TitleBarActivity {
|
|
|
/**
|
|
|
* 保存学生信息
|
|
|
*/
|
|
|
- private void saveApplyStudentInfo(String studentName, String birthday, String sex, String ethnic, String nativePlace, String residenceProvinceId,
|
|
|
- String residenceCityId, String residenceRegionId, String residenceType, String height, String weight,
|
|
|
- String bloodType, String physicalExamination, String idCardNum, String livingProvinceId, String livingCityId,
|
|
|
- String livingRegionId, String contactAddress,String zipCode, String preSchoolEducation, String hobby){
|
|
|
-
|
|
|
- RequestGroup.saveApplyStudentInfo(studentName, birthday, sex, ethnic, nativePlace, residenceProvinceId, residenceCityId, residenceRegionId, residenceType,
|
|
|
- height, weight, bloodType, physicalExamination, idCardNum, livingProvinceId, livingCityId, livingRegionId, contactAddress, zipCode, preSchoolEducation,
|
|
|
- hobby, new Callback() {
|
|
|
+ private void saveApplyStudentInfo(String studentName, String birthday, String sex, String ethnic, String residenceProvinceId,
|
|
|
+ String residenceCityId, String residenceRegionId) {
|
|
|
+
|
|
|
+ RequestGroup.saveApplyStudentInfo(studentName, birthday, sex, ethnic, residenceProvinceId, residenceCityId, residenceRegionId, new Callback() {
|
|
|
@Override
|
|
|
public Object parseNetworkResponse(Response response, int id) throws Exception {
|
|
|
return new Gson().fromJson(response.body().string(), StudentInfoAddBean.class);
|
|
@@ -396,10 +267,10 @@ public class StudentInfoActivity extends TitleBarActivity {
|
|
|
|
|
|
@Override
|
|
|
public void onResponse(Object response, int id) {
|
|
|
- StudentInfoAddBean studentInfoAddBean = (StudentInfoAddBean)response;
|
|
|
- if(studentInfoAddBean != null) {
|
|
|
- if("200".equals(studentInfoAddBean.getCode())){
|
|
|
- saveApplyFamilyInfo();
|
|
|
+ StudentInfoAddBean studentInfoAddBean = (StudentInfoAddBean) response;
|
|
|
+ if (studentInfoAddBean != null) {
|
|
|
+ if ("200".equals(studentInfoAddBean.getCode())) {
|
|
|
+ saveApplyFamilyInfo(studentInfoAddBean.getData()+"");
|
|
|
} else {
|
|
|
showToast(studentInfoAddBean.getMsg());
|
|
|
}
|
|
@@ -412,23 +283,24 @@ public class StudentInfoActivity extends TitleBarActivity {
|
|
|
/**
|
|
|
* 保存家庭成员信息
|
|
|
*/
|
|
|
- private void saveApplyFamilyInfo(){
|
|
|
- if(llMemberFamily.getChildCount() > 0) {
|
|
|
- for (int i=0; i<llMemberFamily.getChildCount(); i++) {
|
|
|
+ private void saveApplyFamilyInfo(String studentId) {
|
|
|
+ if (llMemberFamily.getChildCount() > 0) {
|
|
|
+ for (int i = 0; i < llMemberFamily.getChildCount(); i++) {
|
|
|
LinearLayout viewMemberFamilyItem = (LinearLayout) llMemberFamily.getChildAt(i);
|
|
|
|
|
|
- String tv_familyName = ((EditText)viewMemberFamilyItem.findViewById(R.id.tv_familyName)).getText().toString().trim();
|
|
|
- String familyPhone = ((EditText)viewMemberFamilyItem.findViewById(R.id.edit_familyPhone)).getText().toString().trim();
|
|
|
- String job = ((EditText)viewMemberFamilyItem.findViewById(R.id.edit_job)).getText().toString().trim();
|
|
|
- String remark = ((EditText)viewMemberFamilyItem.findViewById(R.id.edit_remark)).getText().toString().trim();
|
|
|
+ String relationShip = ((EditText) viewMemberFamilyItem.findViewById(R.id.edit_relation)).getText().toString().trim();
|
|
|
+ String tv_familyName = ((EditText) viewMemberFamilyItem.findViewById(R.id.tv_familyName)).getText().toString().trim();
|
|
|
+ String familyPhone = ((EditText) viewMemberFamilyItem.findViewById(R.id.edit_familyPhone)).getText().toString().trim();
|
|
|
+ String job = ((EditText) viewMemberFamilyItem.findViewById(R.id.edit_job)).getText().toString().trim();
|
|
|
+ String remark = ((EditText) viewMemberFamilyItem.findViewById(R.id.edit_remark)).getText().toString().trim();
|
|
|
|
|
|
StudentFamilyInfoBean studentFamilyInfoBean = new StudentFamilyInfoBean();
|
|
|
+ studentFamilyInfoBean.setRelationShip(relationShip);
|
|
|
studentFamilyInfoBean.setFamilyName(tv_familyName);
|
|
|
- studentFamilyInfoBean.setFamilyId("");
|
|
|
studentFamilyInfoBean.setFamilyPhone(familyPhone);
|
|
|
studentFamilyInfoBean.setJob(job);
|
|
|
studentFamilyInfoBean.setRemark(remark);
|
|
|
- studentFamilyInfoBean.setStudentInfoId("");
|
|
|
+ studentFamilyInfoBean.setStudentInfoId(studentId);
|
|
|
studentFamilyInfoBean.setUserId(SharedPreferencesUtils.getUserId());
|
|
|
listStudentFamilyInfo.add(studentFamilyInfoBean);
|
|
|
}
|
|
@@ -447,13 +319,12 @@ public class StudentInfoActivity extends TitleBarActivity {
|
|
|
|
|
|
@Override
|
|
|
public void onResponse(Object response, int id) {
|
|
|
- StudentInfoAddBean studentInfoAddBean = (StudentInfoAddBean)response;
|
|
|
- if(studentInfoAddBean != null) {
|
|
|
- if("200".equals(studentInfoAddBean.getCode())){ //提交家庭信息成功
|
|
|
-
|
|
|
- } else {
|
|
|
- showToast(studentInfoAddBean.getMsg());
|
|
|
+ StudentInfoAddBean studentInfoAddBean = (StudentInfoAddBean) response;
|
|
|
+ if (studentInfoAddBean != null) {
|
|
|
+ if ("200".equals(studentInfoAddBean.getCode())) { //提交家庭信息成功
|
|
|
+ finish();
|
|
|
}
|
|
|
+ showToast(studentInfoAddBean.getMsg());
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -462,24 +333,42 @@ public class StudentInfoActivity extends TitleBarActivity {
|
|
|
/**
|
|
|
* 初始化家庭成员信息
|
|
|
*/
|
|
|
- private void initFamilyInfo(){
|
|
|
+ private void initFamilyInfo() {
|
|
|
llMemberFamily.removeAllViews();
|
|
|
View familyView = LayoutInflater.from(this).inflate(R.layout.item_student_family, null);
|
|
|
TextView tvFamilyLab = familyView.findViewById(R.id.tv_family_lab);
|
|
|
tvFamilyLab.setText("家庭成员1");
|
|
|
ImageView ivFamilyAdd = familyView.findViewById(R.id.iv_family_add);
|
|
|
- ivFamilyAdd.setVisibility(View.VISIBLE);
|
|
|
//添加成员
|
|
|
ivFamilyAdd.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
- View familyView = LayoutInflater.from(StudentInfoActivity.this).inflate(R.layout.item_student_family, null);
|
|
|
+ final View familyView = LayoutInflater.from(StudentInfoActivity.this).inflate(R.layout.item_student_family, null);
|
|
|
TextView tvFamilyLab = familyView.findViewById(R.id.tv_family_lab);
|
|
|
+ ImageView ivFamilyAdd = familyView.findViewById(R.id.iv_family_add);
|
|
|
+ ivFamilyAdd.setImageResource(R.drawable.family_info_remove_icon);
|
|
|
llMemberFamily.addView(familyView);
|
|
|
+ ivFamilyAdd.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ llMemberFamily.removeView(familyView);
|
|
|
+ refreshFamilyLab();
|
|
|
+ }
|
|
|
+ });
|
|
|
tvFamilyLab.setText("家庭成员" + llMemberFamily.getChildCount());
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
llMemberFamily.addView(familyView);
|
|
|
}
|
|
|
|
|
|
+ private void refreshFamilyLab(){
|
|
|
+ if (llMemberFamily.getChildCount() > 0) {
|
|
|
+ for (int i = 0; i < llMemberFamily.getChildCount(); i++) {
|
|
|
+ LinearLayout viewMemberFamilyItem = (LinearLayout) llMemberFamily.getChildAt(i);
|
|
|
+ TextView tvFamilyLab = viewMemberFamilyItem.findViewById(R.id.tv_family_lab);
|
|
|
+ tvFamilyLab.setText("家庭成员" + (i+1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|