From a2c9e7a60d4b28b461ab8c9f0922474809d7e9a9 Mon Sep 17 00:00:00 2001 From: haomingming Date: Tue, 3 Nov 2026 15:38:24 +0800 Subject: [PATCH] 2 --- .../activity/LoginSetInfoActivity.java | 227 ++++++++++-------- .../layout/activity_setting_information.xml | 46 +++- 2 files changed, 165 insertions(+), 108 deletions(-) diff --git a/app/src/main/java/cn/shangyu/gdxzExpert/activity/LoginSetInfoActivity.java b/app/src/main/java/cn/shangyu/gdxzExpert/activity/LoginSetInfoActivity.java index bc2a457..e557600 100644 --- a/app/src/main/java/cn/shangyu/gdxzExpert/activity/LoginSetInfoActivity.java +++ b/app/src/main/java/cn/shangyu/gdxzExpert/activity/LoginSetInfoActivity.java @@ -21,8 +21,9 @@ import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.BaseAdapter; -import android.widget.Button; -import android.widget.CheckBox; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.EditText; import android.widget.GridView; import android.widget.ImageView; import android.widget.LinearLayout; @@ -124,13 +125,13 @@ public class LoginSetInfoActivity extends BaseActivity implements private String cityId = ""; private String disctictId = ""; private boolean choosehos =false; - private TextView my_hospital; - private TextView my_office_phone; - private TextView my_professional; - private TextView my_zgzs_number; - private TextView my_disease; - private TextView my_name; - private TextView my_sex; + private TextView my_hospital; + private EditText my_office_phone; + private TextView my_professional; + private EditText my_zgzs_number; + private TextView my_disease; + private EditText my_name; + private TextView my_sex; private TextView my_office_name; private int checkNum = 0; // 记录选中的条目数量 private ECAlertDialog buildAlert; @@ -173,30 +174,30 @@ public class LoginSetInfoActivity extends BaseActivity implements my_photo = view.findViewById(R.id.my_photo);// 头像 - ll_my_name = (LinearLayout) view.findViewById(R.id.ll_my_name);// 姓名 - my_name = (TextView) view.findViewById(R.id.my_name);// 姓名 - - ll_my_sex = (LinearLayout) view.findViewById(R.id.ll_my_sex);// sex - my_sex = (TextView) view.findViewById(R.id.my_sex);// sex - - ll_my_hospital = (LinearLayout) view.findViewById(R.id.ll_my_hospital);// 医院 - my_hospital = (TextView) view.findViewById(R.id.my_hospital);// 医院名称 - ll_my_photo=(LinearLayout) view.findViewById(R.id.ll_my_photo); - ll_my_office_name = (LinearLayout) view - .findViewById(R.id.ll_my_office_name);// 工作室 - my_office_name = (TextView) view.findViewById(R.id.my_office_name);// 工作室名称 - - ll_my_office_phone = (LinearLayout) view - .findViewById(R.id.ll_my_office_phone);// 工作室电话 - my_office_phone = (TextView) view.findViewById(R.id.my_office_phone);// 工作室 - - ll_my_professional = (LinearLayout) view - .findViewById(R.id.ll_my_professional);// 职业职称 - my_professional = (TextView) view.findViewById(R.id.my_professional);// 职业职称 - - ll_my_zgzs_number = (LinearLayout) view - .findViewById(R.id.ll_my_zgzs_number);// 医师资格证号码 - my_zgzs_number = (TextView) view.findViewById(R.id.my_zgzs_number);// 医师资格证号码 + ll_my_name = (LinearLayout) view.findViewById(R.id.ll_my_name);// 姓名 + my_name = (EditText) view.findViewById(R.id.my_name);// 姓名 + + ll_my_sex = (LinearLayout) view.findViewById(R.id.ll_my_sex);// sex + my_sex = (TextView) view.findViewById(R.id.my_sex);// sex + + ll_my_hospital = (LinearLayout) view.findViewById(R.id.ll_my_hospital);// 医院 + my_hospital = (TextView) view.findViewById(R.id.my_hospital);// 医院名称 + ll_my_photo=(LinearLayout) view.findViewById(R.id.ll_my_photo); + ll_my_office_name = (LinearLayout) view + .findViewById(R.id.ll_my_office_name);// 工作室 + my_office_name = (TextView) view.findViewById(R.id.my_office_name);// 工作室名称 + + ll_my_office_phone = (LinearLayout) view + .findViewById(R.id.ll_my_office_phone);// 工作室电话 + my_office_phone = (EditText) view.findViewById(R.id.my_office_phone);// 工作室 + + ll_my_professional = (LinearLayout) view + .findViewById(R.id.ll_my_professional);// 职业职称 + my_professional = (TextView) view.findViewById(R.id.my_professional);// 职业职称 + + ll_my_zgzs_number = (LinearLayout) view + .findViewById(R.id.ll_my_zgzs_number);// 医师资格证号码 + my_zgzs_number = (EditText) view.findViewById(R.id.my_zgzs_number);// 医师资格证号码 ll_upload_certificateImg = (LinearLayout) view .findViewById(R.id.ll_upload_certificateImg);// 医师资格证图片 @@ -489,17 +490,47 @@ public class LoginSetInfoActivity extends BaseActivity implements /** * 设置资料各项点击事件 */ - private void setInfoClick(boolean b) { - ll_my_photo.setEnabled(b); - ll_my_name.setEnabled(b); - ll_my_sex.setEnabled(b); - ll_my_hospital.setEnabled(b); - ll_my_office_name.setEnabled(b); - ll_my_office_phone.setEnabled(b); - ll_my_professional.setEnabled(b); - ll_my_zgzs_number.setEnabled(b); - ll_upload_certificateImg.setEnabled(b); - ll_my_disease.setEnabled(b); + private void setInfoClick(boolean b) { + ll_my_photo.setEnabled(b); + ll_my_name.setEnabled(b); + if (my_name != null) { + my_name.setEnabled(b); + my_name.setFocusable(b); + my_name.setFocusableInTouchMode(b); + } + ll_my_sex.setEnabled(b); + ll_my_hospital.setEnabled(b); + ll_my_office_name.setEnabled(b); + ll_my_office_phone.setEnabled(b); + if (my_office_phone != null) { + my_office_phone.setEnabled(b); + my_office_phone.setFocusable(b); + my_office_phone.setFocusableInTouchMode(b); + } + ll_my_professional.setEnabled(b); + ll_my_zgzs_number.setEnabled(b); + if (my_zgzs_number != null) { + my_zgzs_number.setEnabled(b); + my_zgzs_number.setFocusable(b); + my_zgzs_number.setFocusableInTouchMode(b); + } + ll_upload_certificateImg.setEnabled(b); + ll_my_disease.setEnabled(b); + } + + private void focusInlineEdit(EditText editText) { + if (editText == null || !editText.isEnabled()) { + return; + } + editText.requestFocus(); + CharSequence text = editText.getText(); + if (text != null) { + editText.setSelection(text.length()); + } + InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); + if (imm != null) { + imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); + } } // 弹出对话框 @@ -556,50 +587,56 @@ public class LoginSetInfoActivity extends BaseActivity implements // 为了验证是不是上一个用户 String mobile = SharePrefUtil.getString(ct, Constant.SP_IS_FIRST_NAME, Constant.mobile, "");// 手机号 - switch (v.getId()) { - case R.id.ll_my_name:// 姓名 - showEditPopuWindows(my_name, 1); - break; - case R.id.ll_my_sex:// 性别 - pwSexOptions.showAtLocation(my_sex, Gravity.BOTTOM, 0, 0); - break; - case R.id.ll_my_hospital:// 医院 - // 设置适配器 - // listView.setAdapter(new MyListAdapter(my_hospital, - // hospitalList)); - // // 弹出popuwindow框 - // setPopupWindow(my_hospital); - // 先选择者城市再选择医院 - startActivityForResult(new Intent(LoginSetInfoActivity.this,ChoosehospitalActivity.class),333); -// pwCityOptions.showAtLocation(my_hospital, Gravity.BOTTOM, 0, 0); - // showPwOptions("请选择医院", hospitalListItems, hospitalListUuidItems, - // my_hospital, 1); - break; - case R.id.ll_my_office_name:// 科室 - showPwOptions("请选择科室", officeListItems, officeListUuidItems, - my_office_name, 2); - break; - case R.id.ll_my_office_phone:// 科室电话 - showEditPopuWindows(my_office_phone, 2); - break; - case R.id.ll_my_professional:// 职称 - showPwOptions("请选择职称", professionalListItems, - professionalUuidListItems, my_professional, 3); - break; - case R.id.ll_my_zgzs_number:// 资格证号 - showEditPopuWindows(my_zgzs_number, 3); - break; - case R.id.ll_upload_certificateImg:// 资格证图片 - save(mobile); - Intent intent = new Intent(ct, SelectedPhotoActivity.class); - intent.putExtra("isConstraint", true);// 是否等比例裁剪 - startActivityForResult(intent, TO_SELECT_PHOTO); - // 进入退出动画 - overridePendingTransition(R.anim.timepicker_anim_enter_bottom, - R.anim.timepicker_anim_exit_bottom); - break; - case R.id.ll_my_disease:// 专长 - showDiseasePop(my_disease); + switch (v.getId()) { + case R.id.ll_my_name:// 姓名 + focusInlineEdit(my_name); + break; + case R.id.ll_my_sex:// 性别 + hideSoftKeyboard(); + pwSexOptions.showAtLocation(my_sex, Gravity.BOTTOM, 0, 0); + break; + case R.id.ll_my_hospital:// 医院 + hideSoftKeyboard(); + // 设置适配器 + // listView.setAdapter(new MyListAdapter(my_hospital, + // hospitalList)); + // // 弹出popuwindow框 + // setPopupWindow(my_hospital); + // 先选择者城市再选择医院 + startActivityForResult(new Intent(LoginSetInfoActivity.this,ChoosehospitalActivity.class),333); +// pwCityOptions.showAtLocation(my_hospital, Gravity.BOTTOM, 0, 0); + // showPwOptions("请选择医院", hospitalListItems, hospitalListUuidItems, + // my_hospital, 1); + break; + case R.id.ll_my_office_name:// 科室 + hideSoftKeyboard(); + showPwOptions("请选择科室", officeListItems, officeListUuidItems, + my_office_name, 2); + break; + case R.id.ll_my_office_phone:// 科室电话 + focusInlineEdit(my_office_phone); + break; + case R.id.ll_my_professional:// 职称 + hideSoftKeyboard(); + showPwOptions("请选择职称", professionalListItems, + professionalUuidListItems, my_professional, 3); + break; + case R.id.ll_my_zgzs_number:// 资格证号 + focusInlineEdit(my_zgzs_number); + break; + case R.id.ll_upload_certificateImg:// 资格证图片 + hideSoftKeyboard(); + save(mobile); + Intent intent = new Intent(ct, SelectedPhotoActivity.class); + intent.putExtra("isConstraint", true);// 是否等比例裁剪 + startActivityForResult(intent, TO_SELECT_PHOTO); + // 进入退出动画 + overridePendingTransition(R.anim.timepicker_anim_enter_bottom, + R.anim.timepicker_anim_exit_bottom); + break; + case R.id.ll_my_disease:// 专长 + hideSoftKeyboard(); + showDiseasePop(my_disease); break; case R.id.btn_skip_info:// 跳过 handleSkipOrBack(mobile); @@ -1037,13 +1074,13 @@ public class LoginSetInfoActivity extends BaseActivity implements ToastUtil.showToast("科室不为空"); return; } - if (TextUtils.isEmpty(officePhone)) { - ToastUtil.showToast("科室电话不为空"); - return; - } - if (officePhone.equals("请输入科室电话")) { - ToastUtil.showToast("请输入正确的科室电话"); - return; + if (TextUtils.isEmpty(officePhone)) { + ToastUtil.showToast("科室电话不为空"); + return; + } + if (officePhone.equals("请输入科室电话") || officePhone.length() < 10) { + ToastUtil.showToast("请输入正确的科室电话"); + return; } if (TextUtils.isEmpty(etProfessionalName)) { ToastUtil.showToast("职称不为空"); diff --git a/app/src/main/res/layout/activity_setting_information.xml b/app/src/main/res/layout/activity_setting_information.xml index b9cfb15..9052be1 100644 --- a/app/src/main/res/layout/activity_setting_information.xml +++ b/app/src/main/res/layout/activity_setting_information.xml @@ -60,10 +60,17 @@ style="@style/InfoLeftStyle" android:text="姓名" /> - + - + - +