| | |
| | | |
| | | List<String> searchHistoryTitleList = new ArrayList<>(); |
| | | |
| | | String mMessageStateType = ""; |
| | | |
| | | @Override |
| | | public Object getContentView() { |
| | | viewBinding = ActivitySearchMessgeBinding.inflate(getLayoutInflater()); |
| | |
| | | @Override |
| | | public void onBindView(Bundle savedInstanceState) { |
| | | setStatusBarTranslucent(); |
| | | mMessageStateType = getIntent().getStringExtra("MessageStateType"); |
| | | //历史记录文件夹创建 |
| | | HdlFileLogic.getInstance().createFileDir(HdlFileLogic.getInstance().getCurrentUserRootPath()); |
| | | //初始化数据 |
| | |
| | | public void onClick(int position, MessageBean messageBean) { |
| | | Intent intent = new Intent(); |
| | | intent.putExtra("msgId", messageBean.getMsgId().toString()); |
| | | intent.putExtra("messageStateType", mMessageStateType); |
| | | intent.setClass(_mActivity, MessageInfoActivity.class); |
| | | startActivity(intent); |
| | | } |
| | |
| | | HdlMessageLogic.getInstance().getPageNoMessageList( |
| | | "", |
| | | pageNo, |
| | | "", |
| | | mMessageStateType, |
| | | "", |
| | | "", |
| | | "", |
| | |
| | | * 添加历史记录 |
| | | */ |
| | | 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)); |
| | |
| | | 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)); |
| | | } |
| | | |
| | | } |