| | |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.base.CustomBaseActivity; |
| | | import com.hdl.photovoltaic.bean.PageNumberObject; |
| | | import com.hdl.photovoltaic.databinding.ActivitySearchMessgeBinding; |
| | | import com.hdl.photovoltaic.enums.MessageStateType; |
| | | import com.hdl.photovoltaic.enums.ShowErrorMode; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlDeviceLogic; |
| | | import com.hdl.photovoltaic.other.HdlFileLogic; |
| | | import com.hdl.photovoltaic.other.HdlLogLogic; |
| | | import com.hdl.photovoltaic.other.HdlMessageLogic; |
| | | import com.hdl.photovoltaic.other.HdlThreadLogic; |
| | | import com.hdl.photovoltaic.ui.adapter.SearchHistoryAdapter; |
| | | import com.hdl.photovoltaic.ui.adapter.SearchMessageAdapter; |
| | | import com.hdl.photovoltaic.ui.bean.DeviceBean; |
| | | import com.hdl.photovoltaic.ui.bean.MessageBean; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | 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()); |
| | | //初始化数据 |
| | |
| | | @Override |
| | | public void onClick(int position, MessageBean messageBean) { |
| | | Intent intent = new Intent(); |
| | | intent.putExtra("msgId", messageBean.getMsgId().toString()); |
| | | intent.putExtra("messageBean",new Gson().toJson(messageBean)); |
| | | 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)); |
| | | } |
| | | |
| | | } |