mac
2024-05-20 b1f617d201ada34081aefc38414813cbf521fed5
app/src/main/java/com/hdl/photovoltaic/ui/message/SearchMessageActivity.java
@@ -56,6 +56,8 @@
    List<String> searchHistoryTitleList = new ArrayList<>();
    String mMessageStateType = "";
    @Override
    public Object getContentView() {
        viewBinding = ActivitySearchMessgeBinding.inflate(getLayoutInflater());
@@ -65,6 +67,7 @@
    @Override
    public void onBindView(Bundle savedInstanceState) {
        setStatusBarTranslucent();
        mMessageStateType = getIntent().getStringExtra("MessageStateType");
        //历史记录文件夹创建
        HdlFileLogic.getInstance().createFileDir(HdlFileLogic.getInstance().getCurrentUserRootPath());
        //初始化数据
@@ -288,7 +291,7 @@
        HdlMessageLogic.getInstance().getPageNoMessageList(
                "",
                pageNo,
                "",
                mMessageStateType,
                "",
                "",
                "",
@@ -380,6 +383,7 @@
     * 添加历史记录
     */
    private void addSearchTextToList() {
        int maxValue = 10;
        for (int i = 0; i < searchHistoryTitleList.size(); i++) {
            if (searchHistoryTitleList.get(i).equals(currSearchText)) {
                searchHistoryTitleList.remove(searchHistoryTitleList.get(i));
@@ -388,9 +392,9 @@
        searchHistoryTitleList.add(currSearchText);
        // 倒序排列数据(搜索最后排在前面)
        Collections.reverse(searchHistoryTitleList);
        if (searchHistoryTitleList.size() > 10) {
        if (searchHistoryTitleList.size() > maxValue) {
            //历史记录不能超出10
            searchHistoryTitleList.remove(searchHistoryTitleList.get(11));
            searchHistoryTitleList.remove(searchHistoryTitleList.get(maxValue + 1));
        }
    }