以人找房、以房找人
This commit is contained in:
parent
d6ca8fd33f
commit
848124963e
@ -273,6 +273,18 @@
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden"
|
||||
tools:ignore="LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".activitys.census.house.NewSearchHouseByPersonActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden"
|
||||
tools:ignore="LockedOrientationActivity" />
|
||||
|
||||
<activity
|
||||
android:name=".activitys.census.house.NewSearchPersonByHouseActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden"
|
||||
tools:ignore="LockedOrientationActivity" />
|
||||
|
||||
<activity
|
||||
android:name=".activitys.census.house.SearchHouseByPersonActivity"
|
||||
android:screenOrientation="portrait"
|
||||
|
@ -53,7 +53,8 @@ import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.ScreenManager;
|
||||
import com.sucstepsoft.realtimelocation.activitys.addresslist.AddressListMainActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.census.hire.CensusHireListActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.census.house.NewSearchHouseByPersonActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.census.house.NewSearchPersonByHouseActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.census.house.SearchPersonByHouseActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.census.newhouse.activitys.BuildingViewPageActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.census.newhouse.activitys.NewGroupHouseAddActivity;
|
||||
@ -488,7 +489,8 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public void loginOut() {
|
||||
|
||||
startActivity(new Intent(mActivity, NewGroupHouseAddActivity.class));
|
||||
build.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -500,18 +502,15 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public void searchPerson() {
|
||||
//不规则房屋录入
|
||||
startActivity(new Intent(mActivity, NewGroupHouseAddActivity.class));
|
||||
//以人找房
|
||||
startActivity(new Intent(mActivity, NewSearchHouseByPersonActivity.class));
|
||||
build.dismiss();
|
||||
// startActivity(new Intent(mActivity, SearchHouseByPersonActivity.class));
|
||||
// build.dismiss();
|
||||
}
|
||||
|
||||
//以房找人
|
||||
@Override
|
||||
public void searchHouse() {
|
||||
LogUtils.e("以房找人");
|
||||
startActivity(new Intent(mActivity, SearchPersonByHouseActivity.class));
|
||||
startActivity(new Intent(mActivity, NewSearchPersonByHouseActivity.class));
|
||||
build.dismiss();
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,306 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.census.house;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.text.TextUtils;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
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.LogUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.RegexUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.activitys.census.newhouse.activitys.NewHouseDetailActivity;
|
||||
import com.sucstepsoft.realtimelocation.adapters.NewSearchHouseAdapter;
|
||||
import com.sucstepsoft.realtimelocation.beans.HousePersonBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
import com.sucstepsoft.realtimelocation.utils.ExceptionHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* 以人找房
|
||||
*/
|
||||
public class NewSearchHouseByPersonActivity extends BaseActivity {
|
||||
@BindView(R.id.iv_clear)
|
||||
ImageView mIvClear;
|
||||
@BindView(R.id.et_search_centent)
|
||||
EditText mEtSearchContent;
|
||||
@BindView(R.id.btn_search)
|
||||
Button mBtnSearch;
|
||||
@BindView(R.id.xlv_content)
|
||||
XRecyclerView mXlvItems;
|
||||
@BindView(R.id.csv_state)
|
||||
CustomStateView mCsvState;
|
||||
private Unbinder mBind;
|
||||
|
||||
private List<HousePersonBean.RowsBean> mDatas;
|
||||
private NewSearchHouseAdapter mAdapter;
|
||||
|
||||
private int mCurPage = 1;
|
||||
|
||||
private String mKeywords;
|
||||
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_new_search_house_by_person;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mTvBaseTitle.setText("以人找房");
|
||||
buildData();
|
||||
setStateView(12);
|
||||
}
|
||||
|
||||
private void buildData() {
|
||||
mBtnSearch.setOnClickListener(v -> doSearch());
|
||||
mIvClear.setOnClickListener(v -> {
|
||||
mKeywords = "";
|
||||
mEtSearchContent.setText("");
|
||||
mDatas.clear();
|
||||
mAdapter.notifyDataSetChanged();
|
||||
setStateView(12);
|
||||
});
|
||||
mDatas = new ArrayList<>();
|
||||
mAdapter = new NewSearchHouseAdapter(mActivity, mDatas, 1);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(mActivity);
|
||||
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
mXlvItems.setLoadingMoreEnabled(true);
|
||||
mXlvItems.setPullRefreshEnabled(true);
|
||||
mXlvItems.setLayoutManager(layoutManager);
|
||||
mXlvItems.setAdapter(mAdapter);
|
||||
mAdapter.addOnItemClickListener(this::showDetail);
|
||||
mXlvItems.setRefreshProgressStyle(ProgressStyle.BallGridBeat);
|
||||
mXlvItems.setLoadingMoreProgressStyle(ProgressStyle.Pacman);
|
||||
mXlvItems.setLoadingListener(new XRecyclerView.LoadingListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
refreshData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore() {
|
||||
loadMore();
|
||||
}
|
||||
});
|
||||
mEtSearchContent.setOnEditorActionListener((v, actionId, event) -> {
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
||||
hideSoftKeyboard();
|
||||
setStateView(13);
|
||||
mKeywords = v.getText().toString().trim();
|
||||
mCurPage = 1;
|
||||
doSearchHouseByPerson(mCurPage);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 房屋详情
|
||||
*
|
||||
* @param rowsBean
|
||||
*/
|
||||
private void showDetail(HousePersonBean.RowsBean rowsBean) {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("id", rowsBean.getHouseDTO().getHouseId());
|
||||
intent.setClass(mActivity, NewHouseDetailActivity.class);
|
||||
startActivityForResult(intent, 1234);
|
||||
}
|
||||
|
||||
// 加载更多
|
||||
private void loadMore() {
|
||||
doSearchHouseByPerson(mCurPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新数据
|
||||
*/
|
||||
private void refreshData() {
|
||||
mCurPage = 1;
|
||||
doSearchHouseByPerson(mCurPage);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void doSearch() {
|
||||
|
||||
String searchContent = mEtSearchContent.getText().toString().trim();
|
||||
if (!TextUtils.isEmpty(searchContent)) {
|
||||
startSearch(searchContent);
|
||||
//判断是手机号还是身份证号码
|
||||
// if (isHasChinese(searchContent)) {
|
||||
// LogUtils.e("包含中文");
|
||||
// startSearch(searchContent);
|
||||
// } else {
|
||||
// if (searchContent.length() == 11) {
|
||||
// LogUtils.e("手机号");
|
||||
// startSearch(searchContent);
|
||||
// } else {
|
||||
// LogUtils.e("身份证号码");
|
||||
// //判断身份证号码是否正确
|
||||
// if (!RegexUtils.isIDNumber(searchContent)) {
|
||||
// ToastUtils.showShort("请输入正确的身份证号码");
|
||||
// } else {
|
||||
// startSearch(searchContent);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
} else {
|
||||
ToastUtils.showShort("请输入查询内容");
|
||||
}
|
||||
}
|
||||
|
||||
private void startSearch(String searchContent) {
|
||||
hideSoftKeyboard();
|
||||
setStateView(13);
|
||||
mKeywords = searchContent;
|
||||
mCurPage = 1;
|
||||
doSearchHouseByPerson(mCurPage);
|
||||
}
|
||||
|
||||
private boolean isHasChinese(String conetnt) {
|
||||
String regEx = "[\u4e00-\u9fa5]";
|
||||
Pattern compile = Pattern.compile(regEx);
|
||||
Matcher matcher = compile.matcher(conetnt);
|
||||
while (matcher.find()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 进行搜索
|
||||
*/
|
||||
private void doSearchHouseByPerson(int page) {
|
||||
mCurPage = page;
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.doSearchHouseByPersonV3(mKeywords, page + "", UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<HousePersonBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(HousePersonBean leaveListBean) {
|
||||
if (leaveListBean != null && leaveListBean.getRows().size() > 0) {
|
||||
++mCurPage;
|
||||
if (page == 1) {
|
||||
mDatas.clear();
|
||||
mDatas.addAll(leaveListBean.getRows());
|
||||
} else {
|
||||
mDatas.addAll(leaveListBean.getRows());
|
||||
}
|
||||
setStateView(14);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
mXlvItems.refreshComplete();
|
||||
if (mDatas.size() >= leaveListBean.getTotal()) {
|
||||
mXlvItems.loadMoreComplete();
|
||||
mXlvItems.setNoMore(true);
|
||||
} else {
|
||||
mXlvItems.loadMoreComplete();
|
||||
mXlvItems.setNoMore(false);
|
||||
}
|
||||
} else {
|
||||
if (page > 1) {
|
||||
mXlvItems.loadMoreComplete();
|
||||
mXlvItems.setNoMore(true);
|
||||
setStateView(14);
|
||||
} else {
|
||||
if (TextUtils.isEmpty(mKeywords)) {
|
||||
//无数据
|
||||
setStateView(15);
|
||||
} else {
|
||||
setStateView(15);
|
||||
ToastUtils.showShort("未查询到相关内容");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
setStateView(16);
|
||||
mXlvItems.refreshComplete();
|
||||
mXlvItems.loadMoreComplete();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据状态显示
|
||||
* 12 默认
|
||||
* 13 搜索中
|
||||
* 14 搜索完成有数据
|
||||
* 15 搜索完成没有数据
|
||||
* 16 搜索失败
|
||||
*
|
||||
* @param state
|
||||
*/
|
||||
private void setStateView(int state) {
|
||||
switch (state) {
|
||||
case 12://默认
|
||||
mXlvItems.setVisibility(View.GONE);
|
||||
mCsvState.setState(CustomStateView.STATE_SEARCH);
|
||||
break;
|
||||
case 13://搜索中
|
||||
mXlvItems.setVisibility(View.GONE);
|
||||
mCsvState.setState(CustomStateView.STATE_LOAD);
|
||||
break;
|
||||
case 14://搜索完成有数据
|
||||
mXlvItems.setVisibility(View.VISIBLE);
|
||||
mCsvState.setState(CustomStateView.STATE_SUCCESS);
|
||||
break;
|
||||
case 15://搜索完成没有数据
|
||||
mXlvItems.setVisibility(View.GONE);
|
||||
mCsvState.setState(CustomStateView.STATE_EMPTY);
|
||||
break;
|
||||
case 16://搜索失败
|
||||
mXlvItems.setVisibility(View.GONE);
|
||||
mCsvState.setState(CustomStateView.STATE_ERROR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,750 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.census.house;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
|
||||
import com.bigkoo.pickerview.view.OptionsPickerView;
|
||||
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;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.activitys.census.newhouse.activitys.NewHouseDetailActivity;
|
||||
import com.sucstepsoft.realtimelocation.adapters.NewSearchHousePersonAdapter;
|
||||
import com.sucstepsoft.realtimelocation.beans.CommunityBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.DicBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.HousePersonBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.NewBuildingBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.NewCommunityDetailBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.StreetBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
import com.sucstepsoft.realtimelocation.utils.ExceptionHandler;
|
||||
import com.sucstepsoft.realtimelocation.widget.ExpandableLinearLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* 以房找人
|
||||
*/
|
||||
public class NewSearchPersonByHouseActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.tv_street)
|
||||
TextView mTvStreet;
|
||||
@BindView(R.id.tv_community)
|
||||
TextView mTvCommunity;
|
||||
@BindView(R.id.tv_community_area)
|
||||
TextView mTvCommunityArea;
|
||||
@BindView(R.id.tv_building)
|
||||
TextView mTvBuilding;
|
||||
@BindView(R.id.tv_unit)
|
||||
TextView mTvUnit;
|
||||
@BindView(R.id.tv_floor)
|
||||
TextView mTvFloor;
|
||||
@BindView(R.id.et_room)
|
||||
EditText mEtRoom;
|
||||
@BindView(R.id.sw_is_hire)
|
||||
Switch mSwIsHire;
|
||||
@BindView(R.id.sw_is_empty)
|
||||
Switch mSwIsEmpty;
|
||||
@BindView(R.id.btn_confirm)
|
||||
Button mBtnConfirm;
|
||||
@BindView(R.id.elv_content)
|
||||
ExpandableLinearLayout mElvContent;
|
||||
@BindView(R.id.ll_content)
|
||||
LinearLayout mLlContent;
|
||||
@BindView(R.id.rlv_items)
|
||||
XRecyclerView mRlvItems;
|
||||
@BindView(R.id.csv_state)
|
||||
CustomStateView mCsvState;
|
||||
@BindView(R.id.btn_reset)
|
||||
Button mBtnReset;
|
||||
private Unbinder mBind;
|
||||
|
||||
private List<HousePersonBean.RowsBean> mDatas;
|
||||
private NewSearchHousePersonAdapter mAdapter;
|
||||
private int mCurPage = 1;
|
||||
|
||||
private OptionsPickerView<StreetBean> mArea4Picker;
|
||||
private OptionsPickerView<CommunityBean> mArea5Picker;
|
||||
private List<StreetBean> mArea4List;
|
||||
private List<CommunityBean> mArea5List;
|
||||
private StreetBean mSelArea4;
|
||||
private CommunityBean mSelArea5;
|
||||
|
||||
private List<NewCommunityDetailBean> mCommunityList;
|
||||
private OptionsPickerView<NewCommunityDetailBean> mCommunityPicker;
|
||||
private NewCommunityDetailBean mSelCommunity;
|
||||
private NewBuildingBean.RowsBean mSelBuilding;
|
||||
private List<NewBuildingBean.RowsBean> mBuildingList;
|
||||
private OptionsPickerView<NewBuildingBean.RowsBean> mBuildingPicker;
|
||||
private List<DicBean> mUnitList;
|
||||
private List<DicBean> mFloorList;
|
||||
private DicBean mSelUnit;
|
||||
private DicBean mSelFloor;
|
||||
private OptionsPickerView<DicBean> mUnitPicker;
|
||||
private OptionsPickerView<DicBean> mFloorPicker;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_new_search_person_by_house;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mTvBaseTitle.setText("以房找人");
|
||||
buildData();
|
||||
setStateView(12);
|
||||
}
|
||||
|
||||
private void buildData() {
|
||||
mTvStreet.setOnClickListener(v -> onShowArea4());//街道
|
||||
mTvCommunity.setOnClickListener(v -> onShowArea5());//社区
|
||||
mTvCommunityArea.setOnClickListener(v -> onShowCommunity());//小区
|
||||
mTvBuilding.setOnClickListener(v -> onShowBuildNum());//楼排
|
||||
mTvUnit.setOnClickListener(v -> onShowUnit());//单元/列
|
||||
mTvFloor.setOnClickListener(v -> onShowFloor());//层
|
||||
mCsvState.setState(CustomStateView.STATE_SEARCH);
|
||||
mBtnConfirm.setOnClickListener(v -> doSearch());
|
||||
mDatas = new ArrayList<>();
|
||||
mAdapter = new NewSearchHousePersonAdapter(mActivity, mDatas, 2);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(mActivity);
|
||||
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
mRlvItems.setLoadingMoreEnabled(true);
|
||||
mRlvItems.setPullRefreshEnabled(true);
|
||||
mRlvItems.setLayoutManager(layoutManager);
|
||||
mRlvItems.setAdapter(mAdapter);
|
||||
mAdapter.addOnItemClickListener(this::showDetail);
|
||||
mRlvItems.setRefreshProgressStyle(ProgressStyle.BallGridBeat);
|
||||
mRlvItems.setLoadingMoreProgressStyle(ProgressStyle.Pacman);
|
||||
mRlvItems.setLoadingListener(new XRecyclerView.LoadingListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
refreshData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore() {
|
||||
loadMore();
|
||||
}
|
||||
});
|
||||
mBtnReset.setOnClickListener(v -> resetSearchOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示楼排选择
|
||||
*/
|
||||
private void onShowBuildNum() {
|
||||
if (mSelCommunity == null) {
|
||||
ToastUtils.showShort("请选择所在小区");
|
||||
} else {
|
||||
if (mBuildingList == null) {
|
||||
getAllUnitNum(mSelCommunity.getResidentialId());
|
||||
} else {
|
||||
mBuildingPicker = new OptionsPickerBuilder(mActivity, (options1, options2, options3, v) -> {
|
||||
mSelBuilding = mBuildingList.get(options1);
|
||||
mTvBuilding.setText(mSelBuilding.getName());
|
||||
mSelUnit = null;
|
||||
mUnitList = null;
|
||||
mTvUnit.setText("");
|
||||
|
||||
mSelFloor = null;
|
||||
mFloorList = null;
|
||||
mTvFloor.setText("");
|
||||
//构建单元 层数
|
||||
buildBuildingData(mSelBuilding);
|
||||
})
|
||||
.setTitleText("楼/排")
|
||||
.isDialog(false)
|
||||
.setCancelColor(Color.parseColor("#1189FF"))
|
||||
.setSubmitColor(Color.parseColor("#1189FF"))
|
||||
.setTitleColor(Color.parseColor("#1189FF"))
|
||||
.build();
|
||||
mBuildingPicker.setPicker(mBuildingList);
|
||||
mBuildingPicker.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onShowUnit() {
|
||||
if (mUnitList == null) {
|
||||
ToastUtils.showShort("所选楼/排未录入单元数量");
|
||||
} else {
|
||||
mUnitPicker = new OptionsPickerBuilder(mActivity, (options1, options2, options3, v) -> {
|
||||
mSelUnit = mUnitList.get(options1);
|
||||
mTvUnit.setText(mSelUnit.getDictionaryName());
|
||||
})
|
||||
.setTitleText("楼/排")
|
||||
.isDialog(false)
|
||||
.setCancelColor(Color.parseColor("#1189FF"))
|
||||
.setSubmitColor(Color.parseColor("#1189FF"))
|
||||
.setTitleColor(Color.parseColor("#1189FF"))
|
||||
.build();
|
||||
mUnitPicker.setPicker(mUnitList);
|
||||
mUnitPicker.show();
|
||||
}
|
||||
}
|
||||
|
||||
private void onShowFloor() {
|
||||
if (mFloorList == null) {
|
||||
ToastUtils.showShort("所选楼/排未录入层院数量");
|
||||
} else {
|
||||
mFloorPicker = new OptionsPickerBuilder(mActivity, (options1, options2, options3, v) -> {
|
||||
mSelFloor = mFloorList.get(options1);
|
||||
mTvFloor.setText(mSelFloor.getDictionaryName());
|
||||
})
|
||||
.setTitleText("层/院")
|
||||
.isDialog(false)
|
||||
.setCancelColor(Color.parseColor("#1189FF"))
|
||||
.setSubmitColor(Color.parseColor("#1189FF"))
|
||||
.setTitleColor(Color.parseColor("#1189FF"))
|
||||
.build();
|
||||
mFloorPicker.setPicker(mFloorList);
|
||||
mFloorPicker.show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据小区获取楼
|
||||
*
|
||||
* @param residentialId
|
||||
*/
|
||||
private void getAllUnitNum(String residentialId) {
|
||||
ProgressDialog dialog = UIUtil.initDialog(mActivity, "获取中...");
|
||||
dialog.show();
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getAllBuilding(residentialId, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<List<NewBuildingBean.RowsBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<NewBuildingBean.RowsBean> newCommunityDetailBeans) {
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
if (newCommunityDetailBeans != null && newCommunityDetailBeans.size() > 0) {
|
||||
mBuildingList = newCommunityDetailBeans;
|
||||
onShowBuildNum();
|
||||
} else {
|
||||
ToastUtils.showShort("所选小区下,暂无楼/排信息");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建单元 层
|
||||
*
|
||||
* @param selBuilding
|
||||
*/
|
||||
private void buildBuildingData(NewBuildingBean.RowsBean selBuilding) {
|
||||
String unitNum = selBuilding.getUnitNum();
|
||||
String floorNum = selBuilding.getFloorsNum();
|
||||
if (!TextUtils.isEmpty(unitNum)) {
|
||||
mUnitList = new ArrayList<>();
|
||||
try {
|
||||
int unitInt = Integer.parseInt(unitNum);
|
||||
for (int i = 0; i < unitInt; i++) {
|
||||
DicBean b = new DicBean();
|
||||
b.setDictionaryName(i + 1 + "");
|
||||
mUnitList.add(b);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (!TextUtils.isEmpty(floorNum)) {
|
||||
try {
|
||||
mFloorList = new ArrayList<>();
|
||||
int floorInt = Integer.parseInt(floorNum);
|
||||
for (int i = 0; i < floorInt; i++) {
|
||||
DicBean b = new DicBean();
|
||||
b.setDictionaryName(i + 1 + "");
|
||||
mFloorList.add(b);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void resetSearchOptions() {
|
||||
mArea4List = null;
|
||||
mTvStreet.setText("");
|
||||
mSelArea4 = null;
|
||||
mSelArea5 = null;
|
||||
mTvCommunity.setText("");
|
||||
mArea5List = null;
|
||||
mSelCommunity = null;
|
||||
mCommunityList = null;
|
||||
mTvCommunityArea.setText("");
|
||||
mSelBuilding = null;
|
||||
mBuildingList = null;
|
||||
mTvBuilding.setText("");
|
||||
mSelUnit = null;
|
||||
mTvUnit.setText("");
|
||||
mSelFloor = null;
|
||||
mTvFloor.setText("");
|
||||
mEtRoom.setText("");
|
||||
mSwIsHire.setChecked(false);
|
||||
mSwIsEmpty.setChecked(false);
|
||||
doSearch();
|
||||
}
|
||||
|
||||
/**
|
||||
* area4
|
||||
*/
|
||||
private void onShowArea4() {
|
||||
if (null == mArea4List || mArea4List.size() <= 0) {
|
||||
getStreetList();
|
||||
} else {
|
||||
mArea4Picker = new OptionsPickerBuilder(mActivity, (options1, options2, options3, v) -> {
|
||||
StreetBean bean = mArea4List.get(options1);
|
||||
mTvStreet.setText(bean.getName());
|
||||
mSelArea4 = bean;
|
||||
|
||||
mSelArea5 = null;
|
||||
mTvCommunity.setText("");
|
||||
mArea5List = null;
|
||||
|
||||
mSelCommunity = null;
|
||||
mCommunityList = null;
|
||||
mTvCommunityArea.setText("");
|
||||
|
||||
mSelBuilding = null;
|
||||
mBuildingList = null;
|
||||
mTvBuilding.setText("");
|
||||
|
||||
mSelUnit = null;
|
||||
mTvUnit.setText("");
|
||||
|
||||
mSelFloor = null;
|
||||
mTvFloor.setText("");
|
||||
|
||||
})
|
||||
.setTitleText("请选择区域")
|
||||
.isDialog(false)
|
||||
.setCancelColor(Color.parseColor("#1189FF"))
|
||||
.setSubmitColor(Color.parseColor("#1189FF"))
|
||||
.setTitleColor(Color.parseColor("#1189FF"))
|
||||
.build();
|
||||
mArea4Picker.setPicker(mArea4List);
|
||||
mArea4Picker.show();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取街道
|
||||
*/
|
||||
private void getStreetList() {
|
||||
ProgressDialog dialog = UIUtil.initDialog(mActivity, "获取中...");
|
||||
dialog.show();
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getStreetList(UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<List<StreetBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<StreetBean> streetBeans) {
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
if (streetBeans != null && streetBeans.size() > 0) {
|
||||
mArea4List = streetBeans;
|
||||
onShowArea4();
|
||||
} else {
|
||||
ToastUtils.showShort("暂无街道数据");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* area5
|
||||
*/
|
||||
private void onShowArea5() {
|
||||
if (null == mArea5List || mArea5List.size() <= 0) {
|
||||
if (mSelArea4 == null) {
|
||||
ToastUtils.showShort("请选择乡镇街道");
|
||||
} else {
|
||||
getCommunity(mSelArea4.getId());
|
||||
}
|
||||
} else {
|
||||
mArea5Picker = new OptionsPickerBuilder(mActivity, (options1, options2, options3, v) -> {
|
||||
CommunityBean bean = mArea5List.get(options1);
|
||||
mTvCommunity.setText(bean.getCommunityName());
|
||||
mSelArea5 = bean;
|
||||
|
||||
mSelCommunity = null;
|
||||
mCommunityList = null;
|
||||
mTvCommunityArea.setText("");
|
||||
|
||||
mSelBuilding = null;
|
||||
mBuildingList = null;
|
||||
mTvBuilding.setText("");
|
||||
|
||||
mSelUnit = null;
|
||||
mTvUnit.setText("");
|
||||
|
||||
mSelFloor = null;
|
||||
mTvFloor.setText("");
|
||||
})
|
||||
.setTitleText("请选择社区")
|
||||
.isDialog(false)
|
||||
.setCancelColor(Color.parseColor("#1189FF"))
|
||||
.setSubmitColor(Color.parseColor("#1189FF"))
|
||||
.setTitleColor(Color.parseColor("#1189FF"))
|
||||
.build();
|
||||
mArea5Picker.setPicker(mArea5List);
|
||||
mArea5Picker.show();
|
||||
}
|
||||
}
|
||||
|
||||
private void getCommunity(String areaId) {
|
||||
ProgressDialog dialog = UIUtil.initDialog(mActivity, "获取中...");
|
||||
dialog.show();
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getCommunityDicList(areaId, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<List<CommunityBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<CommunityBean> communityBeans) {
|
||||
dialog.dismiss();
|
||||
if (null != communityBeans && communityBeans.size() > 0) {
|
||||
mArea5List = communityBeans;
|
||||
onShowArea5();
|
||||
} else {
|
||||
ToastUtils.showShort("暂无社区数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
dialog.dismiss();
|
||||
ToastUtils.showShort("获取区域失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小区选择
|
||||
*/
|
||||
private void onShowCommunity() {
|
||||
if (mSelArea5 == null) {
|
||||
ToastUtils.showShort("请选择所在社区");
|
||||
} else {
|
||||
if (mCommunityList == null) {
|
||||
getAllCommunity(mSelArea5.getCommunityId());
|
||||
} else {
|
||||
mCommunityPicker = new OptionsPickerBuilder(mActivity, (options1, options2, options3, v) -> {
|
||||
mSelCommunity = mCommunityList.get(options1);
|
||||
mTvCommunityArea.setText(mSelCommunity.getName());
|
||||
|
||||
mSelBuilding = null;
|
||||
mBuildingList = null;
|
||||
mTvBuilding.setText("");
|
||||
|
||||
mSelUnit = null;
|
||||
mTvUnit.setText("");
|
||||
|
||||
mSelFloor = null;
|
||||
mTvFloor.setText("");
|
||||
|
||||
})
|
||||
.setTitleText("请选择小区")
|
||||
.isDialog(false)
|
||||
.setCancelColor(Color.parseColor("#1189FF"))
|
||||
.setSubmitColor(Color.parseColor("#1189FF"))
|
||||
.setTitleColor(Color.parseColor("#1189FF"))
|
||||
.build();
|
||||
mCommunityPicker.setPicker(mCommunityList);
|
||||
mCommunityPicker.show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 社区下全部小区
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
private void getAllCommunity(String id) {
|
||||
ProgressDialog dialog = UIUtil.initDialog(mActivity, "获取中...");
|
||||
dialog.show();
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getNewCommunityListAll(id, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<List<NewCommunityDetailBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<NewCommunityDetailBean> newCommunityDetailBeans) {
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
if (newCommunityDetailBeans != null && newCommunityDetailBeans.size() > 0) {
|
||||
mCommunityList = newCommunityDetailBeans;
|
||||
onShowCommunity();
|
||||
} else {
|
||||
ToastUtils.showShort("所选社区下暂无小区");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 房屋详情
|
||||
*
|
||||
* @param rowsBean
|
||||
*/
|
||||
private void showDetail(HousePersonBean.RowsBean rowsBean) {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("id", rowsBean.getHouseDTO().getHouseId());
|
||||
intent.setClass(mActivity, NewHouseDetailActivity.class);
|
||||
startActivityForResult(intent, 1234);
|
||||
}
|
||||
|
||||
// 加载更多
|
||||
private void loadMore() {
|
||||
doSearchPersonByHouse(mCurPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新数据
|
||||
*/
|
||||
private void refreshData() {
|
||||
mCurPage = 1;
|
||||
doSearchPersonByHouse(mCurPage);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void doSearch() {
|
||||
mDatas.clear();
|
||||
mAdapter.setData(mDatas);
|
||||
mCsvState.setState(CustomStateView.STATE_LOAD);
|
||||
mCurPage = 1;
|
||||
doSearchPersonByHouse(mCurPage);
|
||||
boolean isExpand = mElvContent.getIsExpand();
|
||||
if (isExpand) {
|
||||
mElvContent.toggle();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 进行搜索
|
||||
*/
|
||||
private void doSearchPersonByHouse(int page) {
|
||||
mCurPage = page;
|
||||
String streetID = mSelArea4 == null ? "" : mSelArea4.getId();
|
||||
String communityID = mSelArea5 == null ? "" : mSelArea5.getCommunityId();
|
||||
String communityAreaId = mSelCommunity == null ? "" : mSelCommunity.getResidentialId();
|
||||
String buildingId = mSelBuilding == null ? "" : mSelBuilding.getBuildingId();
|
||||
String unitId = mSelUnit == null ? "" : mSelUnit.getDictionaryName();
|
||||
String floorId = mSelFloor == null ? "" : mSelFloor.getDictionaryName();
|
||||
String roomNum = mEtRoom.getText().toString().trim();
|
||||
String isHire = mSwIsHire.isChecked() ? "1" : "0";
|
||||
String isEmpty = mSwIsHire.isChecked() ? "1" : "0";
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.doSearchPersonByHouseV3("" + page,
|
||||
streetID,
|
||||
communityID,
|
||||
communityAreaId,
|
||||
buildingId,
|
||||
unitId,
|
||||
floorId,
|
||||
roomNum,
|
||||
isHire,
|
||||
isEmpty,
|
||||
UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<HousePersonBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(HousePersonBean leaveListBean) {
|
||||
if (leaveListBean != null && leaveListBean.getRows().size() > 0) {
|
||||
++mCurPage;
|
||||
if (page == 1) {
|
||||
mDatas.clear();
|
||||
mDatas.addAll(leaveListBean.getRows());
|
||||
} else {
|
||||
mDatas.addAll(leaveListBean.getRows());
|
||||
}
|
||||
setStateView(14);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
mRlvItems.refreshComplete();
|
||||
if (mDatas.size() >= leaveListBean.getTotal()) {
|
||||
mRlvItems.loadMoreComplete();
|
||||
mRlvItems.setNoMore(true);
|
||||
} else {
|
||||
mRlvItems.loadMoreComplete();
|
||||
mRlvItems.setNoMore(false);
|
||||
}
|
||||
} else {
|
||||
if (page > 1) {
|
||||
mRlvItems.loadMoreComplete();
|
||||
mRlvItems.setNoMore(true);
|
||||
setStateView(14);
|
||||
} else {
|
||||
setStateView(15);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
setStateView(16);
|
||||
mRlvItems.refreshComplete();
|
||||
mRlvItems.loadMoreComplete();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态显示
|
||||
* 12 默认
|
||||
* 13 搜索中
|
||||
* 14 搜索完成有数据
|
||||
* 15 搜索完成没有数据
|
||||
* 16 搜索失败
|
||||
*
|
||||
* @param state
|
||||
*/
|
||||
private void setStateView(int state) {
|
||||
switch (state) {
|
||||
case 12://默认
|
||||
mRlvItems.setVisibility(View.GONE);
|
||||
mCsvState.setState(CustomStateView.STATE_SEARCH);
|
||||
break;
|
||||
case 13://搜索中
|
||||
mRlvItems.setVisibility(View.GONE);
|
||||
mCsvState.setState(CustomStateView.STATE_LOAD);
|
||||
break;
|
||||
case 14://搜索完成有数据
|
||||
mRlvItems.setVisibility(View.VISIBLE);
|
||||
mCsvState.setState(CustomStateView.STATE_SUCCESS);
|
||||
break;
|
||||
case 15://搜索完成没有数据
|
||||
mRlvItems.setVisibility(View.GONE);
|
||||
mCsvState.setState(CustomStateView.STATE_EMPTY);
|
||||
break;
|
||||
case 16://搜索失败
|
||||
mRlvItems.setVisibility(View.GONE);
|
||||
mCsvState.setState(CustomStateView.STATE_ERROR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -132,6 +132,9 @@ public class NewGroupHouseAddActivity extends BaseActivity {
|
||||
private List<NewCommunityDetailBean> mCommunityList;
|
||||
private OptionsPickerView<NewCommunityDetailBean> mCommunityPicker;
|
||||
private NewCommunityDetailBean mSelCommunity;
|
||||
private NewBuildingBean.RowsBean mSelBuilding;
|
||||
private List<NewBuildingBean.RowsBean> mBuildingList;
|
||||
private OptionsPickerView<NewBuildingBean.RowsBean> mBuildingPicker;
|
||||
|
||||
private List<DicBean> mUnitList;
|
||||
private List<DicBean> mFloorList;
|
||||
@ -139,9 +142,7 @@ public class NewGroupHouseAddActivity extends BaseActivity {
|
||||
private DicBean mSelFloor;
|
||||
private OptionsPickerView<DicBean> mUnitPicker;
|
||||
private OptionsPickerView<DicBean> mFloorPicker;
|
||||
private NewBuildingBean.RowsBean mSelBuilding;
|
||||
private List<NewBuildingBean.RowsBean> mBuildingList;
|
||||
private OptionsPickerView<NewBuildingBean.RowsBean> mBuildingPicker;
|
||||
|
||||
private SimpleDateFormat mDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
private String mId = "";
|
||||
private DicBean mSelHouseFrame;
|
||||
@ -562,6 +563,7 @@ public class NewGroupHouseAddActivity extends BaseActivity {
|
||||
ToastUtils.showShort("请选择楼/排");
|
||||
return false;
|
||||
}
|
||||
|
||||
List<SaveGroupHouse.ResultListBean> data = mUnitAdapter.getData();
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
if (TextUtils.isEmpty(data.get(i).getUnitValue())) {
|
||||
|
@ -0,0 +1,78 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.beloo.widget.chipslayoutmanager.ChipsLayoutManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.NewHousePersonHolder;
|
||||
import com.sucstepsoft.realtimelocation.beans.HousePersonBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 作者: adam
|
||||
* 日期: 2020/11/17 - 1:22 PM
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述: 楼宇
|
||||
*/
|
||||
public class NewSearchHouseAdapter extends BaseRecyclerAdapter<HousePersonBean.RowsBean, NewHousePersonHolder> {
|
||||
|
||||
private int mType = 1;
|
||||
|
||||
public NewSearchHouseAdapter(Context ctx, List<HousePersonBean.RowsBean> list) {
|
||||
super(ctx, list);
|
||||
}
|
||||
|
||||
public NewSearchHouseAdapter(Context ctx, List<HousePersonBean.RowsBean> list, int type) {
|
||||
super(ctx, list);
|
||||
this.mType = type;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NewHousePersonHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_house_person, parent, false);
|
||||
return new NewHousePersonHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(NewHousePersonHolder h, int i) {
|
||||
HousePersonBean.RowsBean bean = mData.get(i);
|
||||
if (mType == 1) {
|
||||
//以人找房
|
||||
h.mTvAreaName.setText(bean.getHouseDTO().getStreetName());
|
||||
h.mTvDistrictName.setText(bean.getHouseDTO().getBuildingName() + "(" + bean.getHouseDTO().getHouseNum() + ")");
|
||||
h.mTvCommunityName.setText(bean.getHouseDTO().getCommunityName());
|
||||
h.mTvBuilding.setVisibility(View.GONE);
|
||||
h.mTvUnit.setVisibility(View.VISIBLE);
|
||||
h.mTvUnit.setText(bean.getHouseDTO().getResidentialName());
|
||||
PersonInHouseAdapter adapter = new PersonInHouseAdapter(mContext, bean.getHouseDTO().getPopulationDTOList());
|
||||
ChipsLayoutManager chipsLayoutManager = ChipsLayoutManager.newBuilder(mContext)
|
||||
.setOrientation(ChipsLayoutManager.HORIZONTAL)
|
||||
.build();
|
||||
h.mRlvPerson.setLayoutManager(chipsLayoutManager);
|
||||
h.mRlvPerson.setAdapter(adapter);
|
||||
} else {
|
||||
//以房找人
|
||||
h.mTvDistrictName.setText(bean.getName());//人名
|
||||
h.mTvAreaName.setText(bean.getCardNum());//证件号码
|
||||
h.mTvCommunityName.setText(bean.getPhone());//联系电话
|
||||
List datas = new ArrayList();
|
||||
if(bean.getHouseDTO() != null){
|
||||
datas.add(bean.getHouseDTO());
|
||||
PersonInHouseAdapter adapter = new PersonInHouseAdapter(mContext, datas);
|
||||
ChipsLayoutManager chipsLayoutManager = ChipsLayoutManager.newBuilder(mContext)
|
||||
.setOrientation(ChipsLayoutManager.HORIZONTAL)
|
||||
.build();
|
||||
h.mRlvPerson.setLayoutManager(chipsLayoutManager);
|
||||
h.mRlvPerson.setAdapter(adapter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.beloo.widget.chipslayoutmanager.ChipsLayoutManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.sucstepsoft.cm_utils.utils.DesensitizationUtil;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.NewHousePersonByHolder;
|
||||
import com.sucstepsoft.realtimelocation.beans.HousePersonBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 作者: adam
|
||||
* 日期: 2020/11/17 - 1:22 PM
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述: 楼宇
|
||||
*/
|
||||
public class NewSearchHousePersonAdapter extends BaseRecyclerAdapter<HousePersonBean.RowsBean, NewHousePersonByHolder> {
|
||||
|
||||
private int mType = 1;
|
||||
|
||||
public NewSearchHousePersonAdapter(Context ctx, List<HousePersonBean.RowsBean> list) {
|
||||
super(ctx, list);
|
||||
}
|
||||
|
||||
public NewSearchHousePersonAdapter(Context ctx, List<HousePersonBean.RowsBean> list, int type) {
|
||||
super(ctx, list);
|
||||
this.mType = type;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NewHousePersonByHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_search_house_by_person, parent, false);
|
||||
return new NewHousePersonByHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(NewHousePersonByHolder h, int i) {
|
||||
HousePersonBean.RowsBean bean = mData.get(i);
|
||||
h.mTvName.setText(bean.getName());//人名
|
||||
h.mTvCard.setText("证件号码:" + DesensitizationUtil.idCardNum(bean.getCardNum()));//证件号码
|
||||
h.mTvPhone.setText("联系电话:" + DesensitizationUtil.mobilePhone(bean.getPhone()));//联系电话
|
||||
List datas = new ArrayList();
|
||||
if (bean.getHouseDTO() != null) {
|
||||
datas.add(bean.getHouseDTO());
|
||||
PersonInHouseAdapter adapter = new PersonInHouseAdapter(mContext, datas);
|
||||
ChipsLayoutManager chipsLayoutManager = ChipsLayoutManager.newBuilder(mContext)
|
||||
.setOrientation(ChipsLayoutManager.HORIZONTAL)
|
||||
.build();
|
||||
h.mRlvPerson.setLayoutManager(chipsLayoutManager);
|
||||
h.mRlvPerson.setAdapter(adapter);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.PersonInHouseHolder;
|
||||
import com.sucstepsoft.realtimelocation.beans.HousePersonBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 作者: adam
|
||||
* 日期: 2020/11/24 - 9:16 AM
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述: 房屋中的人
|
||||
*/
|
||||
public class PersonInHouseAdapter extends BaseRecyclerAdapter<Object, PersonInHouseHolder> {
|
||||
|
||||
public PersonInHouseAdapter(Context ctx, List list) {
|
||||
super(ctx, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersonInHouseHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_person_list, parent, false);
|
||||
return new PersonInHouseHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(PersonInHouseHolder h, int i) {
|
||||
if (mData.get(i) instanceof HousePersonBean.RowsBean.HouseDTOBean.PopulationDTOListBean) {
|
||||
//以人找房
|
||||
HousePersonBean.RowsBean.HouseDTOBean.PopulationDTOListBean bean = (HousePersonBean.RowsBean.HouseDTOBean.PopulationDTOListBean) mData.get(i);
|
||||
h.mTvPerson.setText(bean.getName());
|
||||
} else {
|
||||
//以房找人
|
||||
HousePersonBean.RowsBean.HouseDTOBean b = (HousePersonBean.RowsBean.HouseDTOBean) mData.get(i);
|
||||
h.mTvPerson.setText(b.getStreetName() + "/" + b.getCommunityName() + "/" + b.getResidentialName() + "/" + b.getUnitNum() + "(单元/列)/" + b.getFloorsNum() + "(层/院)/" + b.getBuildingName() + "/" + b.getHouseNum());
|
||||
h.mTvPerson.setGravity(Gravity.LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters.holders;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
|
||||
/**
|
||||
* 作者: adam
|
||||
* 日期: 2021/7/9 - 3:22 下午
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述:
|
||||
*/
|
||||
public class NewHousePersonByHolder extends RecyclerView.ViewHolder {
|
||||
public TextView mTvName;
|
||||
public TextView mTvPhone;
|
||||
public TextView mTvCard;
|
||||
public RecyclerView mRlvPerson;
|
||||
|
||||
public View mVLine;
|
||||
|
||||
public NewHousePersonByHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
mTvName = itemView.findViewById(R.id.tv_name);
|
||||
mTvPhone = itemView.findViewById(R.id.tv_phone);
|
||||
mTvCard = itemView.findViewById(R.id.tv_card);
|
||||
mVLine = itemView.findViewById(R.id.v_line);
|
||||
mRlvPerson = itemView.findViewById(R.id.rlv_person);
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters.holders;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
|
||||
/**
|
||||
* 作者: adam
|
||||
* 日期: 2021/7/9 - 3:22 下午
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述:
|
||||
*/
|
||||
public class NewHousePersonHolder extends RecyclerView.ViewHolder {
|
||||
public TextView mTvAreaName;//街道名称
|
||||
public TextView mTvCommunityName;//社区名称
|
||||
public TextView mTvDistrictName;//小区名称
|
||||
public TextView mTvUnit;//小区
|
||||
public TextView mTvBuilding;
|
||||
public RecyclerView mRlvPerson;
|
||||
|
||||
public View mVLine;
|
||||
|
||||
public NewHousePersonHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
mTvAreaName = itemView.findViewById(R.id.tv_area);
|
||||
mTvCommunityName = itemView.findViewById(R.id.tv_community);
|
||||
mTvDistrictName = itemView.findViewById(R.id.tv_district);
|
||||
mTvUnit = itemView.findViewById(R.id.tv_unit);
|
||||
mTvBuilding = itemView.findViewById(R.id.tv_building);
|
||||
mVLine = itemView.findViewById(R.id.v_line);
|
||||
mRlvPerson = itemView.findViewById(R.id.rlv_person);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters.holders;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
|
||||
/**
|
||||
* 作者: adam
|
||||
* 日期: 2021/7/9 - 3:22 下午
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述:
|
||||
*/
|
||||
public class PersonInHouseHolder extends RecyclerView.ViewHolder {
|
||||
public TextView mTvPerson;
|
||||
|
||||
public PersonInHouseHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
mTvPerson = itemView.findViewById(R.id.tv_person);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -20,6 +20,7 @@ import com.sucstepsoft.realtimelocation.beans.DicBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.HireHouseBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.HireHouseDetailBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.HouseLivePersonBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.HousePersonBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.HousePersonListBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.IssueSubBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.LeaveDetailBean;
|
||||
@ -789,6 +790,30 @@ public interface LocationApiService {
|
||||
@GET("app/buildinghouseuser/list-find-house-by-people")
|
||||
Observable<List<SearchHouseBean>> doNewSearchHouseByPerson(@Query("keywords") String keywords, @Header("token") String token);
|
||||
|
||||
/**
|
||||
* 新版以人找房
|
||||
*/
|
||||
@Headers({"base_url_name:person", "Content-Type: application/json", "Accept: application/json"})
|
||||
@GET("app/population/findHouse")
|
||||
Observable<HousePersonBean> doSearchHouseByPersonV3(@Query("keywords") String keywords, @Query("page") String page, @Header("token") String token);
|
||||
|
||||
/**
|
||||
* 新版以房找人
|
||||
*/
|
||||
@Headers({"base_url_name:person", "Content-Type: application/json", "Accept: application/json"})
|
||||
@GET("app/population/findPopulation")
|
||||
Observable<HousePersonBean> doSearchPersonByHouseV3(@Query("page") String page,
|
||||
@Query("street") String street,
|
||||
@Query("community") String community,
|
||||
@Query("residentialId") String rId,
|
||||
@Query("buildingId") String buildingId,
|
||||
@Query("affiliationUnit") String unit,
|
||||
@Query("affiliationFloors") String floor,
|
||||
@Query("houseNum") String houseNum,
|
||||
@Query("isRental") String isHire,
|
||||
@Query("isVacant") String isEmpty,
|
||||
@Header("token") String token);
|
||||
|
||||
// app/buildinghouse/listpage?keywords
|
||||
|
||||
/**
|
||||
@ -856,7 +881,6 @@ public interface LocationApiService {
|
||||
Observable<SuccessBean> doDelBaseRegister(@Path("ids") String id, @Header("token") String token);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
|
@ -71,6 +71,10 @@ public class ExpandableLinearLayout extends LinearLayout implements View.OnClick
|
||||
findViews();
|
||||
}
|
||||
|
||||
public boolean getIsExpand() {
|
||||
return isExpand;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化底部view
|
||||
*/
|
||||
|
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<include layout="@layout/item_search_idcard_like" />
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/ll_search_content"
|
||||
android:layout_marginTop="5dp">
|
||||
|
||||
<com.jcodecraeer.xrecyclerview.XRecyclerView
|
||||
android:id="@+id/xlv_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<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>
|
||||
</RelativeLayout>
|
256
app/src/main/res/layout/activity_new_search_person_by_house.xml
Normal file
256
app/src/main/res/layout/activity_new_search_person_by_house.xml
Normal file
@ -0,0 +1,256 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<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:gravity="right"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_reset"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/sel_btn_gray_white"
|
||||
android:minWidth="0dp"
|
||||
android:minHeight="0dp"
|
||||
android:padding="5dp"
|
||||
android:text="重置"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:background="@drawable/sel_btn_submit"
|
||||
android:minWidth="0dp"
|
||||
android:minHeight="0dp"
|
||||
android:padding="5dp"
|
||||
android:text="搜索"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14dp" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<com.sucstepsoft.realtimelocation.widget.ExpandableLinearLayout
|
||||
android:id="@+id/elv_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
app:defaultItemCount="2"
|
||||
app:expandText="展开"
|
||||
app:hideText="收起"
|
||||
app:tipTextSize="14dp">
|
||||
|
||||
|
||||
<LinearLayout style="@style/item_white_bottom_border">
|
||||
|
||||
|
||||
<TextView
|
||||
style="@style/item_title_wrap"
|
||||
android:text="所在街道" />
|
||||
|
||||
<ImageView
|
||||
style="@style/style_hint_star"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_street"
|
||||
style="@style/sel_text_arrow"
|
||||
android:hint="请选择所在街道" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout style="@style/item_white_bottom_border">
|
||||
|
||||
|
||||
<TextView
|
||||
style="@style/item_title_wrap"
|
||||
android:text="所在社区" />
|
||||
|
||||
<ImageView
|
||||
style="@style/style_hint_star"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_community"
|
||||
style="@style/sel_text_arrow"
|
||||
android:hint="请选择所在社区" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout style="@style/item_white_bottom_border">
|
||||
|
||||
|
||||
<TextView
|
||||
style="@style/item_title_wrap"
|
||||
android:text="所在小区" />
|
||||
|
||||
<ImageView
|
||||
style="@style/style_hint_star"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_community_area"
|
||||
style="@style/sel_text_arrow"
|
||||
android:hint="请选择所在小区" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout style="@style/item_white_bottom_border">
|
||||
|
||||
|
||||
<TextView
|
||||
style="@style/item_title_wrap"
|
||||
android:text="所在楼/排" />
|
||||
|
||||
<ImageView
|
||||
style="@style/style_hint_star"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_building"
|
||||
style="@style/sel_text_arrow"
|
||||
android:hint="请选择所在楼/排" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout style="@style/item_white_bottom_border">
|
||||
|
||||
|
||||
<TextView
|
||||
style="@style/item_title_wrap"
|
||||
android:text="所在单元/列" />
|
||||
|
||||
<ImageView
|
||||
style="@style/style_hint_star"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_unit"
|
||||
style="@style/sel_text_arrow"
|
||||
android:hint="请选择所在单元/列" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout style="@style/item_white_bottom_border">
|
||||
|
||||
|
||||
<TextView
|
||||
style="@style/item_title_wrap"
|
||||
android:text="所在院/层" />
|
||||
|
||||
<ImageView
|
||||
style="@style/style_hint_star"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_floor"
|
||||
style="@style/sel_text_arrow"
|
||||
android:hint="请选择所在院/层" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/item_white_bottom_border"
|
||||
android:visibility="visible">
|
||||
|
||||
|
||||
<TextView
|
||||
style="@style/item_title_wrap"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="门牌号" />
|
||||
|
||||
<ImageView
|
||||
style="@style/style_hint_star"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:visibility="gone" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_room"
|
||||
style="@style/item_content_match"
|
||||
android:hint="请输入门牌号" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout style="@style/item_white_bottom_border">
|
||||
|
||||
<TextView
|
||||
style="@style/item_title_wrap"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="是否出租房" />
|
||||
|
||||
|
||||
<Switch
|
||||
android:id="@+id/sw_is_hire"
|
||||
style="@style/item_switch" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout style="@style/item_white_bottom_border">
|
||||
|
||||
<TextView
|
||||
style="@style/item_title_wrap"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="是否空置房" />
|
||||
|
||||
|
||||
<Switch
|
||||
android:id="@+id/sw_is_empty"
|
||||
style="@style/item_switch" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</com.sucstepsoft.realtimelocation.widget.ExpandableLinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/ll_content"
|
||||
android:layout_marginTop="5dp">
|
||||
|
||||
<com.jcodecraeer.xrecyclerview.XRecyclerView
|
||||
android:id="@+id/rlv_items"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<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>
|
||||
</RelativeLayout>
|
@ -1,28 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:padding="10dp"
|
||||
>
|
||||
android:gravity="center_vertical|right"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="查看更多"
|
||||
/>
|
||||
android:layout_centerVertical="true"
|
||||
android:text="展开" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_arrow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_toRightOf="@id/tv_tip"
|
||||
/>
|
||||
tools:src="@drawable/arrow_down" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
118
app/src/main/res/layout/item_house_person.xml
Normal file
118
app/src/main/res/layout/item_house_person.xml
Normal file
@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/shape_rectangle_white"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_district"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
tools:text="小区名称" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_area"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shp_status_shallow_red"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="@color/red_ff"
|
||||
android:textSize="14dp"
|
||||
tools:text="街道" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_community"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:background="@drawable/shp_status_shallow_red"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="@color/red_ff"
|
||||
android:textSize="14dp"
|
||||
tools:text="社区名称" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_unit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:background="@drawable/shp_status_shallow_red"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="@color/red_ff"
|
||||
android:textSize="14dp"
|
||||
android:visibility="gone"
|
||||
tools:text="小区小区小区小区小区小区小区小区小区小区小区小区小区小区" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_building"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:background="@drawable/shp_status_shallow_red"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="@color/red_ff"
|
||||
android:textSize="14dp"
|
||||
android:visibility="gone"
|
||||
tools:text="楼宇" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/v_line"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@drawable/shp_line_dotted"
|
||||
android:layerType="software" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/rlv_person"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
22
app/src/main/res/layout/item_person_list.xml
Executable file
22
app/src/main/res/layout/item_person_list.xml
Executable file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_person"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shp_status_yellow"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="@color/text_yellow"
|
||||
android:textSize="14dp"
|
||||
tools:text="测试" />
|
||||
|
||||
</LinearLayout>
|
73
app/src/main/res/layout/item_search_house_by_person.xml
Normal file
73
app/src/main/res/layout/item_search_house_by_person.xml
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/shape_rectangle_white"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
tools:text="姓名" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="5dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_card"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/gray_text"
|
||||
android:textSize="14dp"
|
||||
tools:text="身份证号码" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_phone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/gray_text"
|
||||
android:textSize="14dp"
|
||||
tools:text="联系电话" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/v_line"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@drawable/shp_line_dotted"
|
||||
android:layerType="software" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/rlv_person"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -28,10 +28,12 @@
|
||||
android:drawableLeft="@color/line"
|
||||
android:gravity="left|center"
|
||||
android:hint="请输入要查询的内容"
|
||||
android:imeOptions="actionSearch"
|
||||
android:inputType="text"
|
||||
android:paddingLeft="5dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp"
|
||||
android:textSize="14dp"
|
||||
tools:text="" />
|
||||
|
||||
<ImageView
|
||||
|
@ -9,7 +9,7 @@ import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
*/
|
||||
public class BaseUrlApi {
|
||||
|
||||
public static final String IP = "http://219.147.99.164:8082/usercenter/"; /*正式统一用户*/
|
||||
public static final String IP = "http://219.147.99.164:8082/usercenter/"; /*正式统一用户*/
|
||||
// public static final String IP = "http://192.168.0.15:7021/usercenter/"; /*测试统一用户*/
|
||||
// public static final String IP = "http://175.24.42.217:7000/usercenter/"; /*测试统一用户*/
|
||||
public static final String BASE_URL = IP;
|
||||
@ -18,13 +18,13 @@ public class BaseUrlApi {
|
||||
public static final String FIELD_SAFETY = BASE_URL + "appFieldSafety/goFloorPlan";
|
||||
public static final int PHOTO_REQUEST = 233;
|
||||
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://192.168.0.15:7022/"; /*测试IP*/
|
||||
// public static final String BASE_IP_P = "http://192.168.0.9: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/";/*人口系统*/
|
||||
// public static final String BASE_POPULATION_IP = "http://192.168.0.9:7023/population/";/*人口系统 测试*/
|
||||
// public static final String BASE_POPULATION_IP = "http://192.168.0.9:7023/population/";/*人口系统 测试*/
|
||||
// public static final String BASE_POPULATION_IP = "http://192.168.0.15:7023/population/";/*人口系统*/
|
||||
public static final String BASE_IMG_URL = BASE_IP + "route/file/downloadfile/true/";
|
||||
public static final String SOCKET_IP = BASE_IP_P + "social/appws";/*SocketIP*/
|
||||
|
@ -4,17 +4,14 @@ import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.constraint.solver.widgets.WidgetContainer;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.sucstepsoft.cm_utils.R;
|
||||
import com.sucstepsoft.cm_utils.utils.LogUtils;
|
||||
|
||||
|
||||
/**
|
||||
@ -55,7 +52,8 @@ public class CenterFuncDialogView extends Dialog {
|
||||
view.findViewById(R.id.ll_house_add_rule).setOnClickListener(v -> choseType(3));//规则房屋
|
||||
view.findViewById(R.id.ll_build).setOnClickListener(v -> choseType(4));//房屋管理
|
||||
view.findViewById(R.id.ll_house_add_n_rule).setOnClickListener(v -> choseType(5));//不规则房屋
|
||||
view.findViewById(R.id.ll_house).setOnClickListener(v -> choseType(6));
|
||||
view.findViewById(R.id.ll_house).setOnClickListener(v -> choseType(6));//以人找房
|
||||
view.findViewById(R.id.ll_person).setOnClickListener(v -> choseType(7));//以房找人
|
||||
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
|
||||
Window window = this.getWindow();
|
||||
window.setGravity(Gravity.CENTER);
|
||||
@ -92,11 +90,14 @@ public class CenterFuncDialogView extends Dialog {
|
||||
mListener.changePwd();
|
||||
break;
|
||||
case 5:
|
||||
mListener.searchPerson();
|
||||
mListener.loginOut();
|
||||
break;
|
||||
case 6:
|
||||
mListener.searchHouse();
|
||||
break;
|
||||
case 7:
|
||||
mListener.searchPerson();
|
||||
break;
|
||||
}
|
||||
}
|
||||
// this.dismiss();
|
||||
|
@ -86,7 +86,7 @@ public class CustomStateView extends LinearLayout {
|
||||
mIvStateDate.setBackgroundResource(R.drawable.ic_empty_data);
|
||||
mPbStateLoading.setVisibility(View.GONE);
|
||||
mTvStateHint.setVisibility(View.VISIBLE);
|
||||
mTvStateHint.setText("请输入要搜索的内容");
|
||||
mTvStateHint.setText("请输入要查询的内容");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,250 @@
|
||||
package com.sucstepsoft.cm_utils.core.widget.views;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.sucstepsoft.cm_utils.R;
|
||||
import com.sucstepsoft.cm_utils.utils.ConvertUtils;
|
||||
|
||||
|
||||
/**
|
||||
* 可以展开的LinearLayout
|
||||
*/
|
||||
public class ExpandableLinearLayout extends LinearLayout implements View.OnClickListener {
|
||||
|
||||
private static final String TAG = ExpandableLinearLayout.class.getSimpleName();
|
||||
|
||||
private TextView tvTip;
|
||||
private ImageView ivArrow;
|
||||
|
||||
private boolean isExpand = false;//是否是展开状态,默认是隐藏
|
||||
|
||||
private int defaultItemCount;//一开始展示的条目数
|
||||
private String expandText;//待展开显示的文字
|
||||
private String hideText;//待隐藏显示的文字
|
||||
private boolean useDefaultBottom;//是否使用默认的底部,默认为true使用默认的底部
|
||||
private boolean hasBottom;//是否已经有底部,默认为false,没有
|
||||
private View bottomView;
|
||||
private float fontSize;
|
||||
private int textColor;
|
||||
private int arrowResId;
|
||||
private int mPosition;
|
||||
|
||||
public ExpandableLinearLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ExpandableLinearLayout(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public ExpandableLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.ExpandableLinearLayout);
|
||||
defaultItemCount = ta.getInt(R.styleable.ExpandableLinearLayout_defaultItemCount, 2);
|
||||
expandText = ta.getString(R.styleable.ExpandableLinearLayout_expandText);
|
||||
hideText = ta.getString(R.styleable.ExpandableLinearLayout_hideText);
|
||||
fontSize = ta.getDimension(R.styleable.ExpandableLinearLayout_tipTextSize, ConvertUtils.sp2px(14));
|
||||
textColor = ta.getColor(R.styleable.ExpandableLinearLayout_tipTextColor, Color.parseColor("#666666"));
|
||||
arrowResId = ta.getResourceId(R.styleable.ExpandableLinearLayout_arrowDownImg, R.drawable.arrow_down);
|
||||
useDefaultBottom = ta.getBoolean(R.styleable.ExpandableLinearLayout_useDefaultBottom, true);
|
||||
ta.recycle();
|
||||
|
||||
setOrientation(VERTICAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染完成时初始化默认底部view
|
||||
*/
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
findViews();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化底部view
|
||||
*/
|
||||
private void findViews() {
|
||||
bottomView = View.inflate(getContext(), R.layout.item_ell_bottom, null);
|
||||
ivArrow = (ImageView) bottomView.findViewById(R.id.iv_arrow);
|
||||
|
||||
tvTip = (TextView) bottomView.findViewById(R.id.tv_tip);
|
||||
tvTip.getPaint().setTextSize(fontSize);
|
||||
tvTip.setTextColor(textColor);
|
||||
ivArrow.setImageResource(arrowResId);
|
||||
|
||||
bottomView.setOnClickListener(this);
|
||||
}
|
||||
|
||||
|
||||
public void addItem(View view) {
|
||||
if (!useDefaultBottom) {
|
||||
//如果不使用默认底部
|
||||
addView(view);
|
||||
int childCount = getChildCount();
|
||||
if (childCount > defaultItemCount) {
|
||||
hide();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//使用默认底部
|
||||
if (!hasBottom) {
|
||||
//如果还没有底部
|
||||
addView(view);
|
||||
} else {
|
||||
int childCount = getChildCount();
|
||||
addView(view, childCount - 1);//插在底部之前
|
||||
}
|
||||
refreshUI(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation(int orientation) {
|
||||
if (LinearLayout.HORIZONTAL == orientation) {
|
||||
throw new IllegalArgumentException("ExpandableTextView only supports Vertical Orientation.");
|
||||
}
|
||||
super.setOrientation(orientation);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int childCount = getChildCount();
|
||||
Log.i(TAG, "childCount: " + childCount);
|
||||
justToAddBottom(childCount);
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否要添加底部
|
||||
*
|
||||
* @param childCount
|
||||
*/
|
||||
private void justToAddBottom(int childCount) {
|
||||
if (childCount > defaultItemCount) {
|
||||
if (useDefaultBottom && !hasBottom) {
|
||||
//要使用默认底部,并且还没有底部
|
||||
addView(bottomView);//添加底部
|
||||
hide();
|
||||
hasBottom = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新UI
|
||||
*
|
||||
* @param view
|
||||
*/
|
||||
private void refreshUI(View view) {
|
||||
int childCount = getChildCount();
|
||||
if (childCount > defaultItemCount) {
|
||||
if (childCount - defaultItemCount == 1) {
|
||||
//刚超过默认,判断是否要添加底部
|
||||
justToAddBottom(childCount);
|
||||
}
|
||||
view.setVisibility(GONE);//大于默认数目的先隐藏
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 展开
|
||||
*/
|
||||
private void expand() {
|
||||
for (int i = defaultItemCount; i < getChildCount(); i++) {
|
||||
//从默认显示条目位置以下的都显示出来
|
||||
View view = getChildAt(i);
|
||||
view.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 收起
|
||||
*/
|
||||
private void hide() {
|
||||
int endIndex = useDefaultBottom ? getChildCount() - 1 : getChildCount();//如果是使用默认底部,则结束的下标是到底部之前,否则则全部子条目都隐藏
|
||||
for (int i = defaultItemCount; i < endIndex; i++) {
|
||||
//从默认显示条目位置以下的都隐藏
|
||||
View view = getChildAt(i);
|
||||
view.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 箭头的动画
|
||||
private void doArrowAnim() {
|
||||
if (isExpand) {
|
||||
// 当前是展开,将执行收起,箭头由上变为下
|
||||
ObjectAnimator.ofFloat(ivArrow, "rotation", -180, 0).start();
|
||||
} else {
|
||||
// 当前是收起,将执行展开,箭头由下变为上
|
||||
ObjectAnimator.ofFloat(ivArrow, "rotation", 0, 180).start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
toggle();
|
||||
}
|
||||
|
||||
public void toggle() {
|
||||
if (isExpand) {
|
||||
hide();
|
||||
tvTip.setText(expandText);
|
||||
} else {
|
||||
expand();
|
||||
tvTip.setText(hideText);
|
||||
}
|
||||
doArrowAnim();
|
||||
isExpand = !isExpand;
|
||||
|
||||
//回调
|
||||
if (mStateListener != null) {
|
||||
mStateListener.onStateChanged(isExpand);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private OnStateChangeListener mStateListener;
|
||||
|
||||
/**
|
||||
* 定义状态改变接口
|
||||
*/
|
||||
public interface OnStateChangeListener {
|
||||
void onStateChanged(boolean isExpanded);
|
||||
}
|
||||
|
||||
public void setOnStateChangeListener(OnStateChangeListener mListener) {
|
||||
this.mStateListener = mListener;
|
||||
}
|
||||
|
||||
|
||||
public void setOnItemClickListener(final OnItemClickListener listener) {
|
||||
int endIndex = useDefaultBottom ? getChildCount() - 1 : getChildCount();//如果是使用默认底部,则结束的下标是到底部之前
|
||||
for (int i = 0; i < endIndex; i++) {
|
||||
View view = getChildAt(i);
|
||||
final int position = i;
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.onItemClick(v, position);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnItemClickListener {
|
||||
void onItemClick(View view, int position);
|
||||
}
|
||||
}
|
BIN
cm_utils/src/main/res/drawable-xhdpi/arrow_down.png
Normal file
BIN
cm_utils/src/main/res/drawable-xhdpi/arrow_down.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 206 B |
@ -38,32 +38,6 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_build"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shp_rectangle_gray"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/ic_build" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="房屋管理"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_outbound"
|
||||
@ -95,74 +69,39 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_person"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shp_rectangle_gray"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/ic_person_house" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="以人找房"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_house"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shp_rectangle_gray"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/ic_house_person" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="以房找人"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_build"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shp_rectangle_gray"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/ic_build" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="房屋管理"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_house_add_rule"
|
||||
android:layout_width="0dp"
|
||||
@ -216,4 +155,65 @@
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_person"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shp_rectangle_gray"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/ic_person_house" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="以人找房"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_house"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shp_rectangle_gray"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/ic_house_person" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="以房找人"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
22
cm_utils/src/main/res/layout/item_ell_bottom.xml
Normal file
22
cm_utils/src/main/res/layout/item_ell_bottom.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right|center_vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="查看更多" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_arrow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_toRightOf="@id/tv_tip" />
|
||||
|
||||
</LinearLayout>
|
@ -104,4 +104,21 @@
|
||||
<attr name="ddmenuUnselectedIcon" format="reference"/>
|
||||
<attr name="ddmenuMenuHeightPercent" format="float"/>
|
||||
</declare-styleable>
|
||||
<declare-styleable name="ExpandableLinearLayout">
|
||||
<!--默认显示的条目数-->
|
||||
<attr name="defaultItemCount" format="integer" />
|
||||
<!--提示文字的大小-->
|
||||
<attr name="tipTextSize" format="dimension" />
|
||||
<!--字体颜色-->
|
||||
<attr name="tipTextColor" format="color" />
|
||||
<!--待展开的文字提示-->
|
||||
<attr name="expandText" format="string" />
|
||||
<!--待收起时的文字提示-->
|
||||
<attr name="hideText" format="string" />
|
||||
<!--向下的箭头的图标-->
|
||||
<attr name="arrowDownImg" format="reference" />
|
||||
<!--是否使用默认的底部-->
|
||||
<attr name="useDefaultBottom" format="boolean" />
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user