| | |
| | | @Override |
| | | public void onClick(int position, String title) { |
| | | viewBinding.powerStationSearchEt.setText(title); |
| | | //搜索关键字 |
| | | currSearchText = viewBinding.powerStationSearchEt.getText().toString().replace(" ", ""); |
| | | if (TextUtils.isEmpty(currSearchText)) { |
| | | HdlThreadLogic.toast(_mActivity, R.string.search_content_null); |
| | | return; |
| | | } |
| | | viewBinding.historyListParent.setVisibility(View.GONE); |
| | | viewBinding.listParent.setVisibility(View.VISIBLE); |
| | | addSearchTextToList(); |
| | | loadNextPageHouseList(true, 1, true); |
| | | } |
| | | }); |
| | | //设备点击是事件 |
| | |
| | | searchHistoryTitleList.add(currSearchText); |
| | | // 倒序排列数据(搜索最后排在前面) |
| | | Collections.reverse(searchHistoryTitleList); |
| | | if (searchHistoryTitleList.size() > 10) { |
| | | int maxValue = 10; |
| | | if (searchHistoryTitleList.size() > maxValue) { |
| | | //历史记录不能超出10 |
| | | searchHistoryTitleList.remove(searchHistoryTitleList.get(11)); |
| | | searchHistoryTitleList.remove(searchHistoryTitleList.get(maxValue)); |
| | | } |
| | | |
| | | } |