mac
2024-05-29 748e302167a333b08fb5813b6f48806210e53091
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/DeviceSearchActivity.java
@@ -179,6 +179,16 @@
            @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);
            }
        });
        //设备点击是事件
@@ -402,9 +412,10 @@
        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));
        }
    }