| File was renamed from qihealonelibrary/src/main/java/com/dayu/qihealonelibrary/activity/ReplacementActivity.java |
| | |
| | | |
| | | import com.dayu.baselibrary.utils.TipUtil; |
| | | import com.dayu.baselibrary.view.EdtDialog; |
| | | import com.dayu.qihealonelibrary.adapter.ReplacementAdapter; |
| | | import com.dayu.qihealonelibrary.databinding.ActivityReplacementQhaBinding; |
| | | import com.dayu.qihealonelibrary.adapter.ManagerCardAdapter; |
| | | import com.dayu.qihealonelibrary.adapter.NewCardAdapter; |
| | | import com.dayu.qihealonelibrary.card.ManageCard; |
| | | import com.dayu.qihealonelibrary.databinding.ActivityManagerListQhaBinding; |
| | | import com.dayu.qihealonelibrary.dbBean.UserCardBean; |
| | | import com.scwang.smart.refresh.footer.ClassicsFooter; |
| | | import com.scwang.smart.refresh.layout.api.RefreshLayout; |
| | |
| | | import io.reactivex.rxjava3.schedulers.Schedulers; |
| | | |
| | | /** |
| | | * Created by Android Studio. |
| | | * author: zuo |
| | | * Date: 2023-11-20 |
| | | * Time: 17:32 |
| | | * 备注: 补卡界面 |
| | | * Date: 2024-05-09 |
| | | * Time: 11:20 |
| | | * 备注:管理卡选择本地用户界面 |
| | | */ |
| | | public class ReplacementActivity extends BaseActivity { |
| | | ActivityReplacementQhaBinding newcardListBinding; |
| | | public class ManagerListActivity extends BaseActivity { |
| | | |
| | | ActivityManagerListQhaBinding binding; |
| | | List<UserCardBean> userCardBeanList = new ArrayList<>(); |
| | | ReplacementAdapter adapter; |
| | | long beginTime; |
| | | long endTime; |
| | | ManagerCardAdapter adapter; |
| | | int page = 0; |
| | | |
| | | //每页数据条数 |
| | | int limit = 30; |
| | | RefreshLayout myRefreshLayout; |
| | | EdtDialog edtDialog; |
| | | String cardNumber; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | newcardListBinding = ActivityReplacementQhaBinding.inflate(LayoutInflater.from(this)); |
| | | setContentView(newcardListBinding.getRoot()); |
| | | setRightButton(); |
| | | binding = ActivityManagerListQhaBinding.inflate(LayoutInflater.from(this)); |
| | | setContentView(binding.getRoot()); |
| | | cardNumber = this.getIntent().getStringExtra("cardNumber"); |
| | | initList(); |
| | | getList(); |
| | | setRightButton(); |
| | | } |
| | | |
| | | |
| | | public void itemClick(View view) { |
| | | UserCardBean userCardBean = userCardBeanList.get((int) view.getTag()); |
| | | Intent intent = new Intent(ReplacementActivity.this, NFCWreatActivity.class); |
| | | intent.putExtra("dbUserCard", userCardBean); |
| | | ManageCard manageCard = new ManageCard(); |
| | | manageCard.setUserCard(cardNumber); |
| | | Intent intent = new Intent(ManagerListActivity.this, NFCWreatActivity.class); |
| | | intent.putExtra("manageCard", manageCard); |
| | | intent.putExtra("userCardBean_manager", userCardBean); |
| | | startActivity(intent); |
| | | this.finish(); |
| | | } |
| | | |
| | | private void initList() { |
| | | myRefreshLayout = (RefreshLayout) newcardListBinding.refreshLayout; |
| | | myRefreshLayout = (RefreshLayout) binding.refreshLayout; |
| | | myRefreshLayout.setEnableRefresh(false); |
| | | myRefreshLayout.setRefreshFooter(new ClassicsFooter(this)); |
| | | myRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() { |
| | |
| | | getList(); |
| | | } |
| | | }); |
| | | adapter = new ReplacementAdapter(this, userCardBeanList); |
| | | adapter = new ManagerCardAdapter(this, userCardBeanList); |
| | | LinearLayoutManager layoutManager = new LinearLayoutManager(this); |
| | | newcardListBinding.recyclerView.setLayoutManager(layoutManager); |
| | | newcardListBinding.recyclerView.setAdapter(adapter); |
| | | binding.recyclerView.setLayoutManager(layoutManager); |
| | | binding.recyclerView.setAdapter(adapter); |
| | | } |
| | | |
| | | |
| | |
| | | Observable<List<UserCardBean>> observable = Observable.create(emitter -> { |
| | | // 在这里执行异步操作 |
| | | List<UserCardBean> beanList; |
| | | if (beginTime == 0 && endTime == 0) { |
| | | beanList = asynchBaseDao.userCardDao().findAll(page * limit, limit); |
| | | } else { |
| | | beanList = asynchBaseDao.userCardDao().findByTime(beginTime, endTime); |
| | | } |
| | | // 将结果发送给观察者 |
| | | emitter.onNext(beanList); |
| | | emitter.onComplete(); |
| | |
| | | ); |
| | | } |
| | | |
| | | |
| | | EdtDialog edtDialog; |
| | | |
| | | private void setRightButton() { |
| | | titleBar.setOnItemclickListner(ClickType_RIGHT_TEXT, new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | edtDialog = new EdtDialog(ReplacementActivity.this, new EdtDialog.DialogBack() { |
| | | titleBar.setOnItemclickListner(ClickType_RIGHT_TEXT, v -> { |
| | | edtDialog = new EdtDialog(ManagerListActivity.this, "可输入姓名、身份证号、手机号搜索", new EdtDialog.DialogBack() { |
| | | @Override |
| | | public void onOk(String data) { |
| | | List<UserCardBean> beans = baseDao.userCardDao().findByData(data); |
| | |
| | | } |
| | | }); |
| | | edtDialog.show(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |