房屋页面优化

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",
"filters": [],
"versionCode": 50,
"versionName": "1.5.0",
"versionCode": 51,
"versionName": "1.5.1",
"outputFile": "app-release.apk"
}
]

View File

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

View File

@ -137,6 +137,10 @@ public class NewHouseAddActivity extends BaseActivity {
RecyclerView mRlvLivePerson;
@BindView(R.id.ll_live_person)
LinearLayout mLlLivePerson;
@BindView(R.id.btn_add_house_owner)
Button mBtnAddHouseOwner;
@BindView(R.id.btn_add_house_trustee)
Button mBtnAddHouseTrustee;
private Unbinder mBind;
private OptionsPickerView<StreetBean> mArea4Picker;
@ -175,6 +179,7 @@ public class NewHouseAddActivity extends BaseActivity {
private DicBean mSelManage;
private HouseLiveAddPersonAdapter mLiveAddPersonAdapter;
private List<PersonBaseListBean.RowsBean> mSelLivePerson;
private PersonBaseListBean.RowsBean mSelHouseOwner;
@Override
protected int setLayoutId() {
@ -298,6 +303,16 @@ public class NewHouseAddActivity extends BaseActivity {
mBtnAddPerson.setOnClickListener(v -> {
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());
}
@ -305,6 +320,7 @@ public class NewHouseAddActivity extends BaseActivity {
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == 12345) {
//同住人
mSelLivePerson = (List<PersonBaseListBean.RowsBean>) data.getSerializableExtra("beans");
mLiveAddPersonAdapter.setData(mSelLivePerson);
if (mSelLivePerson != null && mSelLivePerson.size() > 0) {
@ -312,6 +328,18 @@ public class NewHouseAddActivity extends BaseActivity {
} else {
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);

View File

@ -447,13 +447,36 @@
</LinearLayout>
<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" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<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" />
<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
android:layout_width="match_parent"
@ -542,13 +565,36 @@
</LinearLayout>
<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" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<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" />
<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
android:layout_width="match_parent"

View File

@ -8,7 +8,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_marginBottom="60dp"
android:orientation="vertical">
@ -129,48 +129,54 @@
<LinearLayout
android:id="@+id/ll_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
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
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<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" />
<include
layout="@layout/layout_search_common"
android:visibility="visible" />
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<include
layout="@layout/layout_search_common"
android:visibility="visible" />
android:layout_height="match_parent"
android:minHeight="200dp">
<com.jcodecraeer.xrecyclerview.XRecyclerView
android:id="@+id/xrlv_content"
android:layout_width="match_parent"
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>

View File

@ -20,7 +20,7 @@ public class BaseUrlApi {
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://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 = "http://192.168.0.109:8083/servicecity/";/*测试网格系统*/
public static final String BASE_POPULATION_IP = BASE_IP_P + "population/";/*人口系统*/