房屋页面优化

This commit is contained in:
itgaojian 2023-12-08 17:58:52 +08:00
parent 26af505fd4
commit e6da9c4972
6 changed files with 208 additions and 82 deletions

View File

@ -10,8 +10,8 @@
{ {
"type": "SINGLE", "type": "SINGLE",
"filters": [], "filters": [],
"versionCode": 50, "versionCode": 51,
"versionName": "1.5.0", "versionName": "1.5.1",
"outputFile": "app-release.apk" "outputFile": "app-release.apk"
} }
] ]

View File

@ -22,6 +22,7 @@ import com.jcodecraeer.xrecyclerview.ProgressStyle;
import com.jcodecraeer.xrecyclerview.XRecyclerView; import com.jcodecraeer.xrecyclerview.XRecyclerView;
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager; import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity; import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
import com.sucstepsoft.cm_utils.core.widget.views.CustomStateView;
import com.sucstepsoft.cm_utils.utils.ToastUtils; import com.sucstepsoft.cm_utils.utils.ToastUtils;
import com.sucstepsoft.cm_utils.utils.UIUtil; import com.sucstepsoft.cm_utils.utils.UIUtil;
import com.sucstepsoft.cm_utils.utils.UserLgUtils; import com.sucstepsoft.cm_utils.utils.UserLgUtils;
@ -76,8 +77,6 @@ public class HouseLivePersonBindActivity extends BaseActivity {
XRecyclerView mXrlvContent; XRecyclerView mXrlvContent;
@BindView(R.id.btn_confirm) @BindView(R.id.btn_confirm)
Button mBtnConfirm; Button mBtnConfirm;
@BindView(R.id.ll_content)
LinearLayout mLlContent;
@BindView(R.id.rlv_select) @BindView(R.id.rlv_select)
RecyclerView mRlvSelect; RecyclerView mRlvSelect;
@BindView(R.id.ll_person) @BindView(R.id.ll_person)
@ -86,6 +85,8 @@ public class HouseLivePersonBindActivity extends BaseActivity {
LinearLayout mLlSingle; LinearLayout mLlSingle;
@BindView(R.id.tv_hint) @BindView(R.id.tv_hint)
TextView mTvHint; TextView mTvHint;
@BindView(R.id.csv_state)
CustomStateView mCsvState;
private Unbinder mBind; private Unbinder mBind;
private String mId;//房屋ID private String mId;//房屋ID
private String mKeywords = ""; private String mKeywords = "";
@ -95,6 +96,7 @@ public class HouseLivePersonBindActivity extends BaseActivity {
private PersonBaseListBean.RowsBean mSelBean; private PersonBaseListBean.RowsBean mSelBean;
private ArrayList<PersonBaseListBean.RowsBean> mSelBeans; private ArrayList<PersonBaseListBean.RowsBean> mSelBeans;
private SelectedHousePersonAdapter mSelAdapter; private SelectedHousePersonAdapter mSelAdapter;
private String mType;
@Override @Override
protected int setLayoutId() { protected int setLayoutId() {
@ -107,12 +109,19 @@ public class HouseLivePersonBindActivity extends BaseActivity {
mTvBaseTitle.setText("人员入住"); mTvBaseTitle.setText("人员入住");
refreshView(STATE_LOAD_SUCCESS); refreshView(STATE_LOAD_SUCCESS);
mId = getIntent().getStringExtra("id"); mId = getIntent().getStringExtra("id");
if (TextUtils.isEmpty(mId)) { mType = getIntent().getStringExtra("type");
mLlSingle.setVisibility(View.GONE); if (!TextUtils.isEmpty(mType)) {
mLlPerson.setVisibility(View.VISIBLE); //房主
} else {
mLlSingle.setVisibility(View.VISIBLE); mLlSingle.setVisibility(View.VISIBLE);
mLlPerson.setVisibility(View.GONE); mLlPerson.setVisibility(View.GONE);
} else {
if (TextUtils.isEmpty(mId)) {
mLlSingle.setVisibility(View.GONE);
mLlPerson.setVisibility(View.VISIBLE);
} else {
mLlSingle.setVisibility(View.VISIBLE);
mLlPerson.setVisibility(View.GONE);
}
} }
initPersonList(); initPersonList();
} }
@ -161,22 +170,7 @@ public class HouseLivePersonBindActivity extends BaseActivity {
mXrlvContent.setLayoutManager(layoutManager); mXrlvContent.setLayoutManager(layoutManager);
mXrlvContent.setAdapter(mAdapter); mXrlvContent.setAdapter(mAdapter);
mAdapter.addOnitemCheckChange((bean, isCheck, pos) -> { mAdapter.addOnitemCheckChange((bean, isCheck, pos) -> {
if (TextUtils.isEmpty(mId)) { if (!TextUtils.isEmpty(mType)) {
if (isCheck) {
mSelBeans.add(bean);
} else {
mSelBeans.remove(bean);
}
mSelAdapter.setData(mSelBeans);
bean.setCheck(isCheck);
mAdapter.notifyDataSetChanged();
if (mSelBeans.size() == 0) {
mTvHint.setVisibility(View.VISIBLE);
} else {
mTvHint.setVisibility(View.GONE);
}
} else {
//单选
mSelBean = bean; mSelBean = bean;
mEtName.setText(bean.getName()); mEtName.setText(bean.getName());
mEtIdCard.setText(bean.getIdcard()); mEtIdCard.setText(bean.getIdcard());
@ -190,6 +184,37 @@ public class HouseLivePersonBindActivity extends BaseActivity {
} }
} }
mAdapter.setData(mDatas); mAdapter.setData(mDatas);
} else {
if (TextUtils.isEmpty(mId)) {
if (isCheck) {
mSelBeans.add(bean);
} else {
mSelBeans.remove(bean);
}
mSelAdapter.setData(mSelBeans);
bean.setCheck(isCheck);
mAdapter.notifyDataSetChanged();
if (mSelBeans.size() == 0) {
mTvHint.setVisibility(View.VISIBLE);
} else {
mTvHint.setVisibility(View.GONE);
}
} else {
//单选
mSelBean = bean;
mEtName.setText(bean.getName());
mEtIdCard.setText(bean.getIdcard());
mEtPhone.setText(bean.getPhone());
for (int i = 0; i < mDatas.size(); i++) {
if (mDatas.get(i).getPopulationInfoId().equals(bean.getPopulationInfoId())) {
mDatas.get(i).setCheck(true);
} else {
mDatas.get(i).setCheck(false);
}
}
mAdapter.setData(mDatas);
}
} }
}); });
mXrlvContent.setRefreshProgressStyle(ProgressStyle.BallGridBeat); mXrlvContent.setRefreshProgressStyle(ProgressStyle.BallGridBeat);
@ -208,31 +233,40 @@ public class HouseLivePersonBindActivity extends BaseActivity {
} }
}); });
mBtnConfirm.setOnClickListener(v -> doConfirm()); mBtnConfirm.setOnClickListener(v -> doConfirm());
getPersonList(mCurPage); // getPersonList(mCurPage);
refreshData();
} }
/** /**
* 提交 * 提交
*/ */
private void doConfirm() { private void doConfirm() {
if (!TextUtils.isEmpty(mId)) { if (!TextUtils.isEmpty(mType)) {
if (mSelBean == null) { if (mSelBean == null) {
ToastUtils.showShort("请选择人员"); ToastUtils.showShort("请选择人员");
} else { } else {
getPersonInfo(mSelBean.getPopulationInfoId()); getPersonInfo(mSelBean.getPopulationInfoId());
} }
} else { } else {
if (mSelBeans == null || mSelBeans.size() <= 0) { if (!TextUtils.isEmpty(mId)) {
ToastUtils.showShort("请选择人员"); if (mSelBean == null) {
ToastUtils.showShort("请选择人员");
} else {
getPersonInfo(mSelBean.getPopulationInfoId());
}
} else { } else {
String ids = ""; if (mSelBeans == null || mSelBeans.size() <= 0) {
for (int i = 0; i < mSelBeans.size(); i++) { ToastUtils.showShort("请选择人员");
ids += mSelBeans.get(i).getPopulationInfoId() + "_"; } else {
String ids = "";
for (int i = 0; i < mSelBeans.size(); i++) {
ids += mSelBeans.get(i).getPopulationInfoId() + "_";
}
if (ids.endsWith("_")) {
ids = ids.substring(0, ids.length() - 1);
}
getPersonInfo(ids);
} }
if (ids.endsWith("_")) {
ids = ids.substring(0, ids.length() - 1);
}
getPersonInfo(ids);
} }
} }
} }
@ -258,17 +292,23 @@ public class HouseLivePersonBindActivity extends BaseActivity {
public void onNext(List<PersonBaseListBean.RowsBean> rowsBeans) { public void onNext(List<PersonBaseListBean.RowsBean> rowsBeans) {
dialog.dismiss(); dialog.dismiss();
if (rowsBeans != null && rowsBeans.size() > 0) { if (rowsBeans != null && rowsBeans.size() > 0) {
if (!TextUtils.isEmpty(mId)) { if (!TextUtils.isEmpty(mType)) {
mSelBean = rowsBeans.get(0);
doSubmit();
} else {
mSelBeans = new ArrayList<>(rowsBeans);
Intent intent = new Intent(); Intent intent = new Intent();
intent.putExtra("beans", mSelBeans); intent.putExtra("bean", rowsBeans.get(0));
setResult(RESULT_OK, intent); setResult(RESULT_OK, intent);
finish(); finish();
} else {
if (!TextUtils.isEmpty(mId)) {
mSelBean = rowsBeans.get(0);
doSubmit();
} else {
mSelBeans = new ArrayList<>(rowsBeans);
Intent intent = new Intent();
intent.putExtra("beans", mSelBeans);
setResult(RESULT_OK, intent);
finish();
}
} }
} else { } else {
ToastUtils.showShort("未查询到人员信息"); ToastUtils.showShort("未查询到人员信息");
} }
@ -334,6 +374,9 @@ public class HouseLivePersonBindActivity extends BaseActivity {
} }
private void refreshData() { private void refreshData() {
mDatas.clear();
mAdapter.setData(mDatas);
mCsvState.setState(CustomStateView.STATE_LOAD);
getPersonList(1); getPersonList(1);
} }
@ -346,7 +389,7 @@ public class HouseLivePersonBindActivity extends BaseActivity {
hideSoftKeyboard(); hideSoftKeyboard();
mKeywords = searchContent; mKeywords = searchContent;
mCurPage = 1; mCurPage = 1;
getPersonList(mCurPage); refreshData();
} else { } else {
ToastUtils.showShort("请输入要查询的内容"); ToastUtils.showShort("请输入要查询的内容");
} }
@ -370,6 +413,7 @@ public class HouseLivePersonBindActivity extends BaseActivity {
@Override @Override
public void onNext(PersonBaseListBean leaveListBean) { public void onNext(PersonBaseListBean leaveListBean) {
if (leaveListBean != null && leaveListBean.getRows() != null && leaveListBean.getRows().size() > 0) { if (leaveListBean != null && leaveListBean.getRows() != null && leaveListBean.getRows().size() > 0) {
mCsvState.setState(CustomStateView.STATE_SUCCESS);
++mCurPage; ++mCurPage;
if (TextUtils.isEmpty(mId)) { if (TextUtils.isEmpty(mId)) {
for (int i = 0; i < mSelBeans.size(); i++) { for (int i = 0; i < mSelBeans.size(); i++) {
@ -406,6 +450,7 @@ public class HouseLivePersonBindActivity extends BaseActivity {
mXrlvContent.setNoMore(false); mXrlvContent.setNoMore(false);
} }
} else { } else {
mCsvState.setState(CustomStateView.STATE_EMPTY);
if (page > 1) { if (page > 1) {
mXrlvContent.loadMoreComplete(); mXrlvContent.loadMoreComplete();
mXrlvContent.setNoMore(true); mXrlvContent.setNoMore(true);
@ -423,6 +468,7 @@ public class HouseLivePersonBindActivity extends BaseActivity {
@Override @Override
public void onError(Throwable e) { public void onError(Throwable e) {
ToastUtils.showShort("数据加载失,请稍后重试"); ToastUtils.showShort("数据加载失,请稍后重试");
mCsvState.setState(CustomStateView.STATE_ERROR);
} }
@Override @Override

View File

@ -137,6 +137,10 @@ public class NewHouseAddActivity extends BaseActivity {
RecyclerView mRlvLivePerson; RecyclerView mRlvLivePerson;
@BindView(R.id.ll_live_person) @BindView(R.id.ll_live_person)
LinearLayout mLlLivePerson; LinearLayout mLlLivePerson;
@BindView(R.id.btn_add_house_owner)
Button mBtnAddHouseOwner;
@BindView(R.id.btn_add_house_trustee)
Button mBtnAddHouseTrustee;
private Unbinder mBind; private Unbinder mBind;
private OptionsPickerView<StreetBean> mArea4Picker; private OptionsPickerView<StreetBean> mArea4Picker;
@ -175,6 +179,7 @@ public class NewHouseAddActivity extends BaseActivity {
private DicBean mSelManage; private DicBean mSelManage;
private HouseLiveAddPersonAdapter mLiveAddPersonAdapter; private HouseLiveAddPersonAdapter mLiveAddPersonAdapter;
private List<PersonBaseListBean.RowsBean> mSelLivePerson; private List<PersonBaseListBean.RowsBean> mSelLivePerson;
private PersonBaseListBean.RowsBean mSelHouseOwner;
@Override @Override
protected int setLayoutId() { protected int setLayoutId() {
@ -298,6 +303,16 @@ public class NewHouseAddActivity extends BaseActivity {
mBtnAddPerson.setOnClickListener(v -> { mBtnAddPerson.setOnClickListener(v -> {
startActivityForResult(new Intent(mActivity, HouseLivePersonBindActivity.class), 12345); startActivityForResult(new Intent(mActivity, HouseLivePersonBindActivity.class), 12345);
}); });
mBtnAddHouseOwner.setOnClickListener(v -> {
Intent intent = new Intent(mActivity, HouseLivePersonBindActivity.class);
intent.putExtra("type", "owner");
startActivityForResult(intent, 12346);
});
mBtnAddHouseTrustee.setOnClickListener(v -> {
Intent intent = new Intent(mActivity, HouseLivePersonBindActivity.class);
intent.putExtra("type", "trustee");
startActivityForResult(intent, 12347);
});
mBtnConfirm.setOnClickListener(v -> doSubmit()); mBtnConfirm.setOnClickListener(v -> doSubmit());
} }
@ -305,6 +320,7 @@ public class NewHouseAddActivity extends BaseActivity {
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
if (resultCode == RESULT_OK) { if (resultCode == RESULT_OK) {
if (requestCode == 12345) { if (requestCode == 12345) {
//同住人
mSelLivePerson = (List<PersonBaseListBean.RowsBean>) data.getSerializableExtra("beans"); mSelLivePerson = (List<PersonBaseListBean.RowsBean>) data.getSerializableExtra("beans");
mLiveAddPersonAdapter.setData(mSelLivePerson); mLiveAddPersonAdapter.setData(mSelLivePerson);
if (mSelLivePerson != null && mSelLivePerson.size() > 0) { if (mSelLivePerson != null && mSelLivePerson.size() > 0) {
@ -312,6 +328,18 @@ public class NewHouseAddActivity extends BaseActivity {
} else { } else {
mTvHint.setVisibility(View.VISIBLE); mTvHint.setVisibility(View.VISIBLE);
} }
} else if (requestCode == 12346) {
//收搜返回的房主
mSelHouseOwner = (PersonBaseListBean.RowsBean) data.getSerializableExtra("bean");
mEtOwnerName.setText(mSelHouseOwner.getName());
mEtOwnerPhone.setText(mSelHouseOwner.getPhone());
mEtOwnerIdCard.setText(mSelHouseOwner.getIdcard());
} else if (requestCode == 12347) {
PersonBaseListBean.RowsBean b = (PersonBaseListBean.RowsBean) data.getSerializableExtra("bean");
mEtManageName.setText(b.getName());
mEtManageIdCard.setText(b.getIdcard());
mEtManagePhone.setText(b.getPhone());
} }
} }
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);

View File

@ -447,13 +447,36 @@
</LinearLayout> </LinearLayout>
<TextView <RelativeLayout
style="@style/issue_report_title" android:layout_width="match_parent"
android:drawableLeft="@drawable/ic_item_title_icon_rec" android:layout_height="wrap_content">
android:drawablePadding="5dp"
android:padding="8dp" <TextView
android:text="房主" style="@style/issue_report_title"
android:textStyle="bold" /> android:drawableLeft="@drawable/ic_item_title_icon_rec"
android:drawablePadding="5dp"
android:padding="8dp"
android:text="房主"
android:textStyle="bold" />
<Button
android:id="@+id/btn_add_house_owner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:background="@drawable/sel_btn_blue_gray"
android:minWidth="0dp"
android:minHeight="0dp"
android:paddingLeft="5dp"
android:paddingTop="2dp"
android:paddingRight="5dp"
android:paddingBottom="2dp"
android:text="搜索"
android:textColor="@color/col_white_black"
android:textSize="14dp" />
</RelativeLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -542,13 +565,36 @@
</LinearLayout> </LinearLayout>
<TextView <RelativeLayout
style="@style/issue_report_title" android:layout_width="match_parent"
android:drawableLeft="@drawable/ic_item_title_icon_rec" android:layout_height="wrap_content">
android:drawablePadding="5dp"
android:padding="8dp" <TextView
android:text="托管人" style="@style/issue_report_title"
android:textStyle="bold" /> android:drawableLeft="@drawable/ic_item_title_icon_rec"
android:drawablePadding="5dp"
android:padding="8dp"
android:text="托管人"
android:textStyle="bold" />
<Button
android:id="@+id/btn_add_house_trustee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:background="@drawable/sel_btn_blue_gray"
android:minWidth="0dp"
android:minHeight="0dp"
android:paddingLeft="5dp"
android:paddingTop="2dp"
android:paddingRight="5dp"
android:paddingBottom="2dp"
android:text="搜索"
android:textColor="@color/col_white_black"
android:textSize="14dp" />
</RelativeLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -8,7 +8,7 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_marginBottom="60dp" android:layout_marginBottom="60dp"
android:orientation="vertical"> android:orientation="vertical">
@ -129,48 +129,54 @@
<LinearLayout <LinearLayout
android:id="@+id/ll_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"> android:orientation="vertical">
<TextView
style="@style/issue_report_title"
android:drawableLeft="@drawable/ic_item_title_icon_rec"
android:drawablePadding="5dp"
android:padding="8dp"
android:text="人员列表"
android:textStyle="bold" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:orientation="vertical"> android:background="@color/white"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<TextView <include
style="@style/issue_report_title" layout="@layout/layout_search_common"
android:drawableLeft="@drawable/ic_item_title_icon_rec" android:visibility="visible" />
android:drawablePadding="5dp"
android:padding="8dp"
android:text="人员列表"
android:textStyle="bold" />
<RelativeLayout
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:background="@color/white" android:minHeight="200dp">
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<include
layout="@layout/layout_search_common"
android:visibility="visible" />
<com.jcodecraeer.xrecyclerview.XRecyclerView <com.jcodecraeer.xrecyclerview.XRecyclerView
android:id="@+id/xrlv_content" android:id="@+id/xrlv_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
</LinearLayout> <com.sucstepsoft.cm_utils.core.widget.views.CustomStateView
android:id="@+id/csv_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</RelativeLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -20,7 +20,7 @@ public class BaseUrlApi {
public static final int CAMERA_REQUEST = 123; public static final int CAMERA_REQUEST = 123;
public static final String BASE_IP_P = "http://219.147.99.164:8082/"; /*正式IP*/ public static final String BASE_IP_P = "http://219.147.99.164:8082/"; /*正式IP*/
// public static final String BASE_IP_P = "http://175.24.42.217"; /*演示IP*/ // public static final String BASE_IP_P = "http://175.24.42.217"; /*演示IP*/
// public static final String BASE_IP_P = "http://192.168.0.15:7023/"; /*测试IP*/ // public static final String BASE_IP_P = "http://192.168.0.115:7023/"; /*测试IP*/
public static final String BASE_IP = BASE_IP_P + "servicecity/";/*网格系统*/ public static final String BASE_IP = BASE_IP_P + "servicecity/";/*网格系统*/
// public static final String BASE_IP = "http://192.168.0.109:8083/servicecity/";/*测试网格系统*/ // public static final String BASE_IP = "http://192.168.0.109:8083/servicecity/";/*测试网格系统*/
public static final String BASE_POPULATION_IP = BASE_IP_P + "population/";/*人口系统*/ public static final String BASE_POPULATION_IP = BASE_IP_P + "population/";/*人口系统*/